diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js index 91bd7adb5b02..d52c31f3b403 100644 --- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js @@ -2400,9 +2400,11 @@ function URLBarSetURI(aURI) { } function losslessDecodeURI(aURI) { - var value = aURI.spec; if (aURI.schemeIs("moz-action")) throw new Error("losslessDecodeURI should never get a moz-action URI"); + + var value = aURI.spec; + // Try to decode as UTF-8 if there's no encoding sequence that we would break. if (!/%25(?:3B|2F|3F|3A|40|26|3D|2B|24|2C|23)/i.test(value)) try {