Bug 942756 - Unify debugger server startup: fix debugger test. r=mossop
☠☠ backed out by 9a6ce1646135 ☠ ☠
authorPaul Rouget <paul@mozilla.com>
Wed, 23 Apr 2014 17:50:00 +0200
changeset 180406 61f910c1aa722a911e88c959c1053286bd17eae4
parent 180405 a45a8d47cf9c3c78c48b4b89c4cb6b21a6881205
child 180407 63bb9295a0704ef6816a0a6dd363363157890063
push id272
push userpvanderbeken@mozilla.com
push dateMon, 05 May 2014 16:31:18 +0000
reviewersmossop
bugs942756
milestone31.0a1
Bug 942756 - Unify debugger server startup: fix debugger test. r=mossop
toolkit/mozapps/extensions/content/extensions.js
toolkit/mozapps/extensions/content/extensions.xml
toolkit/mozapps/extensions/test/browser/browser_debug_button.js
--- a/toolkit/mozapps/extensions/content/extensions.js
+++ b/toolkit/mozapps/extensions/content/extensions.js
@@ -29,17 +29,16 @@ const PREF_DISCOVERURL = "extensions.web
 const PREF_DISCOVER_ENABLED = "extensions.getAddons.showPane";
 const PREF_XPI_ENABLED = "xpinstall.enabled";
 const PREF_MAXRESULTS = "extensions.getAddons.maxResults";
 const PREF_GETADDONS_CACHE_ENABLED = "extensions.getAddons.cache.enabled";
 const PREF_GETADDONS_CACHE_ID_ENABLED = "extensions.%ID%.getAddons.cache.enabled";
 const PREF_UI_TYPE_HIDDEN = "extensions.ui.%TYPE%.hidden";
 const PREF_UI_LASTCATEGORY = "extensions.ui.lastCategory";
 const PREF_ADDON_DEBUGGING_ENABLED = "devtools.chrome.enabled";
-const PREF_REMOTE_DEBUGGING_ENABLED = "devtools.debugger.remote-enabled";
 
 const LOADING_MSG_DELAY = 100;
 
 const SEARCH_SCORE_MULTIPLIER_NAME = 2;
 const SEARCH_SCORE_MULTIPLIER_DESCRIPTION = 2;
 
 // Use integers so search scores are sortable by nsIXULSortService
 const SEARCH_SCORE_MATCH_WHOLEWORD = 10;
@@ -149,17 +148,16 @@ function initialize(event) {
   if ("arguments" in window && window.arguments.length > 0 &&
       window.arguments[0] !== null && "view" in window.arguments[0]) {
     view = window.arguments[0].view;
   }
 
   gViewController.loadInitialView(view);
 
   Services.prefs.addObserver(PREF_ADDON_DEBUGGING_ENABLED, debuggingPrefChanged, false);
-  Services.prefs.addObserver(PREF_REMOTE_DEBUGGING_ENABLED, debuggingPrefChanged, false);
 }
 
 function notifyInitialized() {
   if (!gIsInitializing)
     return;
 
   gPendingInitializations--;
   if (!gIsInitializing) {
@@ -171,17 +169,16 @@ function notifyInitialized() {
 
 function shutdown() {
   gCategories.shutdown();
   gSearchView.shutdown();
   gEventManager.shutdown();
   gViewController.shutdown();
   Services.obs.removeObserver(sendEMPong, "EM-ping");
   Services.prefs.removeObserver(PREF_ADDON_DEBUGGING_ENABLED, debuggingPrefChanged);
-  Services.prefs.removeObserver(PREF_REMOTE_DEBUGGING_ENABLED, debuggingPrefChanged);
 }
 
 function sendEMPong(aSubject, aTopic, aData) {
   Services.obs.notifyObservers(window, "EM-pong", "");
 }
 
 // Used by external callers to load a specific view into the manager
 function loadView(aViewId) {
@@ -1009,19 +1006,17 @@ var gViewController = {
     cmd_debugItem: {
       doCommand: function cmd_debugItem_doCommand(aAddon) {
         BrowserToolboxProcess.init({ addonID: aAddon.id });
       },
 
       isEnabled: function cmd_debugItem_isEnabled(aAddon) {
         let debuggerEnabled = Services.prefs.
                               getBoolPref(PREF_ADDON_DEBUGGING_ENABLED);
-        let remoteEnabled = Services.prefs.
-                            getBoolPref(PREF_REMOTE_DEBUGGING_ENABLED);
-        return aAddon && aAddon.isDebuggable && debuggerEnabled && remoteEnabled;
+        return aAddon && aAddon.isDebuggable && debuggerEnabled;
       }
     },
 
     cmd_showItemPreferences: {
       isEnabled: function cmd_showItemPreferences_isEnabled(aAddon) {
         if (!aAddon || !aAddon.isActive || !aAddon.optionsURL)
           return false;
         if (gViewController.currentViewObj == gDetailView &&
--- a/toolkit/mozapps/extensions/content/extensions.xml
+++ b/toolkit/mozapps/extensions/content/extensions.xml
@@ -1353,18 +1353,17 @@
 
           this.setAttribute("active", this.mAddon.isActive);
 
           var showProgress = this.mAddon.purchaseURL || (this.mAddon.install &&
                              this.mAddon.install.state != AddonManager.STATE_INSTALLED);
           this._showStatus(showProgress ? "progress" : "none");
 
           let debuggable = this.mAddon.isDebuggable &&
-                           Services.prefs.getBoolPref('devtools.chrome.enabled') &&
-                           Services.prefs.getBoolPref('devtools.debugger.remote-enabled');
+                           Services.prefs.getBoolPref('devtools.chrome.enabled');
 
           this._debugBtn.disabled = this._debugBtn.hidden = !debuggable
 
           if (this.mAddon.type == "experiment") {
             let prefix = "experiment.";
             let active = this.mAddon.isActive;
 
             let stateKey = prefix + "state." + (active ? "active" : "complete");
--- a/toolkit/mozapps/extensions/test/browser/browser_debug_button.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_debug_button.js
@@ -8,18 +8,19 @@
 
 let { Promise } = Components.utils.import("resource://gre/modules/Promise.jsm", {});
 let { Task } = Components.utils.import("resource://gre/modules/Task.jsm", {});
 
 const getDebugButton = node =>
     node.ownerDocument.getAnonymousElementByAttribute(node, "anonid", "debug-btn");
 const addonDebuggingEnabled = bool =>
   Services.prefs.setBoolPref("devtools.chrome.enabled", !!bool);
-const remoteDebuggingEnabled = bool =>
-  Services.prefs.setBoolPref("devtools.debugger.remote-enabled", !!bool);
+
+Services.prefs.setBoolPref("devtools.debugger.show-server-notifications", false);
+
 
 function test() {
   requestLongerTimeout(2);
 
   waitForExplicitFinish();
 
 
   var gProvider = new MockProvider();
@@ -32,71 +33,42 @@ function test() {
     id: "debuggable@tests.mozilla.org",
     name: "Debuggable",
     description: "bar",
     isDebuggable: true
   }]);
 
   Task.spawn(function* () {
     addonDebuggingEnabled(false);
-    remoteDebuggingEnabled(false);
 
     yield testDOM((nondebug, debuggable) => {
       is(nondebug.disabled, true,
         "addon:disabled::remote:disabled button is disabled for legacy addons");
       is(nondebug.hidden, true,
         "addon:disabled::remote:disabled button is hidden for legacy addons");
       is(debuggable.disabled, true,
         "addon:disabled::remote:disabled button is disabled for debuggable addons");
       is(debuggable.hidden, true,
         "addon:disabled::remote:disabled button is hidden for debuggable addons");
     });
     
     addonDebuggingEnabled(true);
-    remoteDebuggingEnabled(false);
-
-    yield testDOM((nondebug, debuggable) => {
-      is(nondebug.disabled, true,
-        "addon:enabled::remote:disabled button is disabled for legacy addons");
-      is(nondebug.disabled, true,
-        "addon:enabled::remote:disabled button is hidden for legacy addons");
-      is(debuggable.disabled, true,
-        "addon:enabled::remote:disabled button is disabled for debuggable addons");
-      is(debuggable.disabled, true,
-        "addon:enabled::remote:disabled button is hidden for debuggable addons");
-    });
-    
-    addonDebuggingEnabled(false);
-    remoteDebuggingEnabled(true);
-
-    yield testDOM((nondebug, debuggable) => {
-      is(nondebug.disabled, true,
-        "addon:disabled::remote:enabled button is disabled for legacy addons");
-      is(nondebug.disabled, true,
-        "addon:disabled::remote:enabled button is hidden for legacy addons");
-      is(debuggable.disabled, true,
-        "addon:disabled::remote:enabled button is disabled for debuggable addons");
-      is(debuggable.disabled, true,
-        "addon:disabled::remote:enabled button is hidden for debuggable addons");
-    });
-    
-    addonDebuggingEnabled(true);
-    remoteDebuggingEnabled(true);
 
     yield testDOM((nondebug, debuggable) => {
       is(nondebug.disabled, true,
         "addon:enabled::remote:enabled button is disabled for legacy addons");
       is(nondebug.disabled, true,
         "addon:enabled::remote:enabled button is hidden for legacy addons");
       is(debuggable.disabled, false,
         "addon:enabled::remote:enabled button is enabled for debuggable addons");
       is(debuggable.hidden, false,
         "addon:enabled::remote:enabled button is visible for debuggable addons");
     });
 
+    Services.prefs.clearUserPref("devtools.debugger.show-server-notifications");
     finish();
   });
 
   function testDOM (testCallback) {
     let deferred = Promise.defer();
     open_manager("addons://list/extension", function(aManager) {
       const {document} = aManager;
       const addonList = document.getElementById("addon-list");