Bug 239533 - Add URL parameter support to about:config. r=gavin
authorJezreel Ng <jezreel@gmail.com>
Thu, 04 Aug 2011 09:05:29 +0200
changeset 73848 9bf06b1df4759fbf16db930037c74e22e0571e7d
parent 73847 4c509d9b5b597ac141215041b912465ffcbe5ba7
child 73849 9c523b57329eff6306d2990710e3991a3047412a
push id2
push userbsmedberg@mozilla.com
push dateFri, 19 Aug 2011 14:38:13 +0000
reviewersgavin
bugs239533
milestone8.0a1
Bug 239533 - Add URL parameter support to about:config. r=gavin
toolkit/components/viewconfig/content/config.js
--- a/toolkit/components/viewconfig/content/config.js
+++ b/toolkit/components/viewconfig/content/config.js
@@ -412,19 +412,26 @@ function ShowPrefs()
   configTree.view = view;
   configTree.controllers.insertControllerAt(0, configController);
 
   document.getElementById("configDeck").setAttribute("selectedIndex", 1);
   document.getElementById("configTreeKeyset").removeAttribute("disabled");
   if (!document.getElementById("showWarningNextTime").checked)
     gPrefBranch.setBoolPref("general.warnOnAboutConfig", false);
 
+  // Process about:config?filter=<string>
   var textbox = document.getElementById("textbox");
+  var uri = document.documentURIObject;
+  var matches = /[?&]filter\=([^&]+)/i.exec(uri.path);
+  if (matches)
+    textbox.value = decodeURIComponent(matches[1]);
+
+  // Even if we did not set the filter string via the URL query,
+  // textbox might have been set via some other mechanism
   if (textbox.value)
-    // somebody seems to already have tried to apply a filter
     FilterPrefs();
   textbox.focus();
 }
 
 function onConfigUnload()
 {
   if (document.getElementById("configDeck").getAttribute("selectedIndex") == 1) {
     gPrefBranch.removeObserver("", gPrefListener);