[Mypal] Add pref to allow copying unescaped URL from the URL bar.

master
Fedor 2020-05-07 14:46:03 +03:00
parent 6d0a42e587
commit 4cacb7aa6d
3 changed files with 17 additions and 11 deletions

View File

@ -324,6 +324,10 @@ pref("browser.identity.display_punycode", 1);
// Address bar RSS icon control, show by default // Address bar RSS icon control, show by default
pref("browser.urlbar.rss", true); 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", true);
pref("browser.altClickSave", true); pref("browser.altClickSave", true);
// Enable logging downloads operations to the Error Console. // Enable logging downloads operations to the Error Console.

View File

@ -324,6 +324,10 @@ pref("browser.identity.display_punycode", 1);
// Address bar RSS icon control, show by default // Address bar RSS icon control, show by default
pref("browser.urlbar.rss", true); 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", true);
pref("browser.altClickSave", true); pref("browser.altClickSave", true);
// Enable logging downloads operations to the Error Console. // Enable logging downloads operations to the Error Console.

View File

@ -521,19 +521,17 @@
uri = uriFixup.createExposableURI(uri); uri = uriFixup.createExposableURI(uri);
} catch (ex) {} } catch (ex) {}
// If the entire URL is selected, just use the actual loaded URI. // If the entire URL is selected, just use the actual loaded URI,
if (inputVal == selectedVal) { // unless we want a decoded URI, or it's a data: or javascript: URI,
// ... but only if isn't a javascript: or data: URI, since those // since those are hard to read when encoded.
// are hard to read when encoded if (inputVal == selectedVal &&
if (!uri.schemeIs("javascript") && !uri.schemeIs("data")) { !uri.schemeIs("javascript") && !uri.schemeIs("data") &&
selectedVal = uri.spec; !Services.prefs.getBoolPref("browser.urlbar.decodeURLsOnCopy")) {
} return uri.spec;
return selectedVal;
} }
// Just the beginning of the URL is selected, check for a trimmed // Just the beginning of the URL is selected, or we want a decoded
// value // url. First check for a trimmed value.
let spec = uri.spec; let spec = uri.spec;
let trimmedSpec = this.trimValue(spec); let trimmedSpec = this.trimValue(spec);
if (spec != trimmedSpec) { if (spec != trimmedSpec) {