summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Groman <tgroman@nuegia.net>2020-05-08 01:51:36 -0700
committerThomas Groman <tgroman@nuegia.net>2020-05-08 01:51:36 -0700
commit12ff2f06ad611371200ae5625319b497a7cbfb13 (patch)
tree950d1d6459ac9fd3a1719620183752f5df4431cf
parent60a9bc8421ebfb6e9a8ed563d15fa157cfcf796a (diff)
downloadwebbrowser-12ff2f06ad611371200ae5625319b497a7cbfb13.tar
webbrowser-12ff2f06ad611371200ae5625319b497a7cbfb13.tar.gz
webbrowser-12ff2f06ad611371200ae5625319b497a7cbfb13.tar.lz
webbrowser-12ff2f06ad611371200ae5625319b497a7cbfb13.tar.xz
webbrowser-12ff2f06ad611371200ae5625319b497a7cbfb13.zip
Add pref to allow copying unescaped URL from the URL bar
-rw-r--r--webbrowser/app/profile/webbrowser.js7
-rw-r--r--webbrowser/base/content/urlbarBindings.xml20
2 files changed, 13 insertions, 14 deletions
diff --git a/webbrowser/app/profile/webbrowser.js b/webbrowser/app/profile/webbrowser.js
index 3aa8426..567a7b5 100644
--- a/webbrowser/app/profile/webbrowser.js
+++ b/webbrowser/app/profile/webbrowser.js
@@ -1,7 +1,4 @@
# -*- Mode: JavaScript; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
// XXX Toolkit-specific preferences should be moved into toolkit.js
@@ -321,6 +318,10 @@ pref("browser.identity.display_punycode", 1);
// Address bar RSS icon control, show by default
pref("browser.urlbar.rss", true);
+// If changed to true, copying the entire URL from the location bar will put
+// the human readable (percent-decoded) URL on the clipboard.
+pref("browser.urlbar.decodeURLsOnCopy", false);
+
pref("browser.altClickSave", true);
// Enable logging downloads operations to the Error Console.
diff --git a/webbrowser/base/content/urlbarBindings.xml b/webbrowser/base/content/urlbarBindings.xml
index 31d6aa5..7da925f 100644
--- a/webbrowser/base/content/urlbarBindings.xml
+++ b/webbrowser/base/content/urlbarBindings.xml
@@ -520,19 +520,17 @@
uri = uriFixup.createExposableURI(uri);
} catch (ex) {}
- // If the entire URL is selected, just use the actual loaded URI.
- if (inputVal == selectedVal) {
- // ... but only if isn't a javascript: or data: URI, since those
- // are hard to read when encoded
- if (!uri.schemeIs("javascript") && !uri.schemeIs("data")) {
- selectedVal = uri.spec;
- }
-
- return selectedVal;
+ // If the entire URL is selected, just use the actual loaded URI,
+ // unless we want a decoded URI, or it's a data: or javascript: URI,
+ // since those are hard to read when encoded.
+ if (inputVal == selectedVal &&
+ !uri.schemeIs("javascript") && !uri.schemeIs("data") &&
+ !Services.prefs.getBoolPref("browser.urlbar.decodeURLsOnCopy")) {
+ return uri.spec;
}
- // Just the beginning of the URL is selected, check for a trimmed
- // value
+ // Just the beginning of the URL is selected, or we want a decoded
+ // url. First check for a trimmed value.
let spec = uri.spec;
let trimmedSpec = this.trimValue(spec);
if (spec != trimmedSpec) {