Bug 410726 - "address bar eats escaped newlines" (keep non-space whitespace encoded) [p=zeniko@gmail.com (Simon Bünzli) r=Mano a1.9=schrep]
authorreed@reedloden.com
Sat, 19 Jan 2008 18:58:30 -0800
changeset 10456 781e3a31ebdd618835ce99da3dfefda1a1518746
parent 10455 7bb56756798a63c97725bc7e1978ef9be6fc4911
child 10457 0a5b87aafba4561d2c8808e3f67e38b5192bcadf
push id1
push userbsmedberg@mozilla.com
push dateThu, 20 Mar 2008 16:49:24 +0000
treeherderautoland@61007906a1f8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMano
bugs410726
milestone1.9b3pre
Bug 410726 - "address bar eats escaped newlines" (keep non-space whitespace encoded) [p=zeniko@gmail.com (Simon Bünzli) r=Mano a1.9=schrep]
browser/base/content/browser.js
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -1906,19 +1906,20 @@ function URLBarSetURI(aURI) {
 
     value = aURI.spec;
     if (value == "about:blank") {
       // Replace "about:blank" with an empty string
       // only if there's no opener (bug 370555).
       if (!content.opener)
         value = "";
     } else {
-      // try to decode as UTF-8
+      // try to decode as UTF-8 (escaping whitespace so that it doesn't
+      // get eaten away by the location bar; cf. bug 410726)
       try {
-        value = decodeURI(value).replace(/%/g, "%25");
+        value = decodeURI(value).replace(/[%\r\n\t]/g, encodeURI);
       } catch(e) {}
 
       state = "valid";
     }
   }
 
   gURLBar.value = value;
   SetPageProxyState(state);