Bug 942756 - Unify debugger server startup: fix debugger test. r=mossop

This commit is contained in:
Paul Rouget 2014-04-23 17:50:00 +02:00
Родитель ffb622c9e6
Коммит 8832b5d42b
3 изменённых файлов: 6 добавлений и 40 удалений

Просмотреть файл

@ -34,7 +34,6 @@ 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;
@ -154,7 +153,6 @@ function initialize(event) {
gViewController.loadInitialView(view);
Services.prefs.addObserver(PREF_ADDON_DEBUGGING_ENABLED, debuggingPrefChanged, false);
Services.prefs.addObserver(PREF_REMOTE_DEBUGGING_ENABLED, debuggingPrefChanged, false);
}
function notifyInitialized() {
@ -176,7 +174,6 @@ function 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) {
@ -1014,9 +1011,7 @@ var gViewController = {
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;
}
},

Просмотреть файл

@ -1358,8 +1358,7 @@
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

Просмотреть файл

@ -13,8 +13,9 @@ 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);
@ -37,7 +38,6 @@ function test() {
Task.spawn(function* () {
addonDebuggingEnabled(false);
remoteDebuggingEnabled(false);
yield testDOM((nondebug, debuggable) => {
is(nondebug.disabled, true,
@ -51,35 +51,6 @@ function test() {
});
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,
@ -92,6 +63,7 @@ function test() {
"addon:enabled::remote:enabled button is visible for debuggable addons");
});
Services.prefs.clearUserPref("devtools.debugger.show-server-notifications");
finish();
});