From 12ff2f06ad611371200ae5625319b497a7cbfb13 Mon Sep 17 00:00:00 2001 From: Thomas Groman Date: Fri, 8 May 2020 01:51:36 -0700 Subject: Add pref to allow copying unescaped URL from the URL bar --- webbrowser/base/content/urlbarBindings.xml | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'webbrowser/base/content/urlbarBindings.xml') 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) { -- cgit v1.2.3