Browse Source

b=565453, r=mfinkle, about:config access for Prism apps

matthew.gertner@gmail.com 14 years ago
parent
commit
3880856af7

+ 11 - 0
chrome/content/webrunner.js

@@ -949,6 +949,17 @@ var WebRunner = {
       case "cmd_findPrevious":
         document.getElementById("findbar").onFindAgainCommand(true);
         break;
+      case "cmd_aboutConfig":
+        var prefs = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch);
+        if (prefs.getBoolPref("prism.shortcut.aboutConfig.enabled")) {
+          if (this._getBrowser().contentWindow.location.href != "about:config") {
+            this._getBrowser().loadURI("about:config", null, null);
+          }
+          else {
+            this._getBrowser().loadURI(WebAppProperties.uri, null, null);
+          }
+        }
+        break;
     }
   },
 

+ 2 - 0
chrome/content/webrunner.xul

@@ -77,6 +77,7 @@
     <command id="cmd_find" label="&findOnCmd.label;" oncommand="WebRunner.doCommand(this.id);"/>
     <command id="cmd_findNext" label="&findNextCmd.label;" oncommand="WebRunner.doCommand(this.id);"/>
     <command id="cmd_findPrevious" label="&findPreviousCmd.label;" oncommand="WebRunner.doCommand(this.id);"/>
+    <command id="cmd_aboutConfig" oncommand="WebRunner.doCommand(this.id);"/>
 #ifdef XP_MACOSX
     <command id="cmd_minimizeWindow" label="&minimizeWindow.label;" oncommand="window.minimize();" />
 #endif
@@ -105,6 +106,7 @@
     <key id="key_findPrevious" key="&findNextCmd.commandkey;" command="cmd_findPrevious" modifiers="accel,shift"/>
     <key keycode="&findNextCmd.commandkey2;" command="cmd_findNext"/>
     <key keycode="&findNextCmd.commandkey2;"  command="cmd_findPrevious" modifiers="shift"/>
+    <key id="key_aboutConfig" key="a" command="cmd_aboutConfig" modifiers="control,shift"/>
   </keyset>
 
   <popupset id="popupset_main">

+ 3 - 0
defaults/preferences/preferences.js

@@ -105,3 +105,6 @@ pref("app.update.log.UpdateService", true);
 /* SSL error page behaviour */
 pref("browser.ssl_override_behavior", 2);
 pref("browser.xul.error_pages.expert_bad_cert", false);
+
+/* Prism-specific prefs */
+pref("prism.shortcut.aboutConfig.enabled", false);

+ 1 - 1
extension/build/Makefile.in

@@ -20,7 +20,7 @@
 # the Initial Developer. All Rights Reserved.
 #
 # Contributor(s):
-#   Matthew Gertner <matthew@allpeers.com>
+#   Matthew Gertner <matthew.gertner@gmail.com>
 #
 # Alternatively, the contents of this file may be used under the terms of
 # either of the GNU General Public License Version 2 or later (the "GPL"),