Bug 798395 - Follow-up: Add URI escaping to about:memory's file argument. r=me
authorJustin Lebar <justin.lebar@gmail.com>
Fri, 19 Oct 2012 12:13:54 -0400
changeset 110917 fb33f8e799c8d3ccb0db558054623ed415c084dd
parent 110916 610a7c294f0ed3f3b094c654e86515af118bf6d3
child 110918 7e8a1440a598c5e61717d7a9ba611409f2a71bcf
push id93
push usernmatsakis@mozilla.com
push dateWed, 31 Oct 2012 21:26:57 +0000
reviewersme
bugs798395
milestone19.0a1
Bug 798395 - Follow-up: Add URI escaping to about:memory's file argument. r=me
toolkit/components/aboutmemory/content/aboutMemory.js
--- a/toolkit/components/aboutmemory/content/aboutMemory.js
+++ b/toolkit/components/aboutmemory/content/aboutMemory.js
@@ -6,22 +6,23 @@
 // This file is used for both about:memory and about:compartments.
 //
 //
 // about:memory will by default show information about the browser's current
 // memory usage, but you can direct it to load information from a file by
 // providing a file= query string.  For example,
 //
 //     about:memory?file=/foo/bar
-//     about:memory?verbose&file=/foo/bar
+//     about:memory?verbose&file=/foo/bar%26baz
 //
 // The order of "verbose" and "file=" isn't significant, and neither "verbose"
-// nor "file=" is case-sensitive.  Obviously the filename is case-sensitive iff
-// you're on a case-sensitive filesystem.  If you specify more than one "file="
-// argument, only the first one is used.
+// nor "file=" is case-sensitive.  We'll URI-unescape the contents of the
+// "file=" argument, and obviously the filename is case-sensitive iff you're on
+// a case-sensitive filesystem.  If you specify more than one "file=" argument,
+// only the first one is used.
 //
 // about:compartments doesn't support the "verbose" or "file=" parameters and
 // will ignore them if they're provided.
 
 "use strict";
 
 //---------------------------------------------------------------------------
 // Code shared by about:memory and about:compartments
@@ -364,17 +365,17 @@ function onLoadAboutMemory()
   // Check location.href to see if we're loading from a file.
   let search = location.href.split('?')[1];
   if (search) {
     let searchSplit = search.split('&');
     for (let i = 0; i < searchSplit.length; i++) {
       if (searchSplit[i].toLowerCase().startsWith('file=')) {
         let filename = searchSplit[i].substring('file='.length);
         let file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile);
-        file.initWithPath(filename);
+        file.initWithPath(decodeURIComponent(filename));
         updateAboutMemoryFromFile(file);
         return;
       }
     }
   }
 
   addChildObserversAndUpdate(updateAboutMemory);
 }