From f20dc8b560345a1ef7ba2dfb1ef3d321d8cc6fb8 Mon Sep 17 00:00:00 2001 From: JustOff Date: Thu, 9 Apr 2020 00:59:57 +0300 Subject: [PATCH] [Pale-Moon] Issue #1766 - Add pref to allow copying unescaped URL from the URL bar --- application/palemoon/app/profile/palemoon.js | 4 ++++ .../palemoon/base/content/urlbarBindings.xml | 20 +++++++++---------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/application/palemoon/app/profile/palemoon.js b/application/palemoon/app/profile/palemoon.js index a972b7a215..c33a57693d 100644 --- a/application/palemoon/app/profile/palemoon.js +++ b/application/palemoon/app/profile/palemoon.js @@ -324,6 +324,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/application/palemoon/base/content/urlbarBindings.xml b/application/palemoon/base/content/urlbarBindings.xml index 71a74a0361..ae9b8d58f4 100644 --- a/application/palemoon/base/content/urlbarBindings.xml +++ b/application/palemoon/base/content/urlbarBindings.xml @@ -521,19 +521,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) {