Bug 787181 - DebuggerController._isChromeDebugger is broken, r=past

This commit is contained in:
Victor Porof 2012-09-14 00:00:18 +03:00
parent ee4a61df54
commit 481687d4ca
4 changed files with 30 additions and 34 deletions

View File

@ -245,7 +245,7 @@ DebuggerPane.prototype = {
_initServer: function DP__initServer() {
if (!DebuggerServer.initialized) {
// Always allow connections from nsIPipe transports.
DebuggerServer.init(function () { return true; });
DebuggerServer.init(function() true);
DebuggerServer.addBrowserActors();
}
},
@ -494,7 +494,7 @@ ChromeDebuggerProcess.prototype = {
}
if (result == 2) {
DebuggerServer.closeListener();
Services.prefs.setBoolPref("devtools.debugger.remote-enabled", false);
Services.prefs.setBoolPref("devtools.debugger.chrome-enabled", false);
}
return false;
},

View File

@ -248,23 +248,6 @@ let DebuggerController = {
}.bind(this));
},
/**
* Returns true if this is a remote debugger instance.
* @return boolean
*/
get _isRemoteDebugger() {
return window._remoteFlag;
},
/**
* Returns true if this is a chrome debugger instance.
* @return boolean
*/
get _isChromeDebugger() {
// Directly accessing window.parent.content may throw in some cases.
return !("content" in window.parent) && !this._isRemoteDebugger;
},
/**
* Attempts to quit the current process if allowed.
*/
@ -297,6 +280,26 @@ let DebuggerController = {
}
};
/**
* Returns true if this is a remote debugger instance.
* @return boolean
*/
XPCOMUtils.defineLazyGetter(DebuggerController, "_isRemoteDebugger", function() {
// We're inside a single top level XUL window, not an iframe container.
return !(window.frameElement instanceof XULElement) &&
!!window._remoteFlag;
});
/**
* Returns true if this is a chrome debugger instance.
* @return boolean
*/
XPCOMUtils.defineLazyGetter(DebuggerController, "_isChromeDebugger", function() {
// We're inside a single top level XUL window, but not a remote debugger.
return !(window.frameElement instanceof XULElement) &&
!window._remoteFlag;
});
/**
* ThreadState keeps the UI up to date with the state of the
* thread (paused/attached/etc.).

View File

@ -16,9 +16,7 @@ function test() {
ok(pane, "toggleDebugger() should return a pane.");
let frame = pane._frame;
frame.addEventListener("Debugger:Loaded", function dbgLoaded() {
frame.removeEventListener("Debugger:Loaded", dbgLoaded, true);
wait_for_connect_and_resume(function() {
let cmd = document.getElementById("Tools:Debugger");
is(cmd.getAttribute("checked"), "true", "<command Tools:Debugger> is checked.");
@ -33,10 +31,10 @@ function test() {
let pane = DebuggerUI.toggleDebugger();
is(cmd.getAttribute("checked"), "false", "<command Tools:Debugger> is unchecked once closed.");
}, true);
});
frame.addEventListener("Debugger:Unloaded", function dbgUnloaded() {
frame.removeEventListener("Debugger:Unloaded", dbgUnloaded, true);
window.addEventListener("Debugger:Shutdown", function dbgShutdown() {
window.removeEventListener("Debugger:Shutdown", dbgShutdown, true);
removeTab(tab1);
removeTab(tab2);
@ -45,4 +43,3 @@ function test() {
});
});
}

View File

@ -20,14 +20,11 @@ function test() {
is(DebuggerUI.getDebugger(), pane,
"getDebugger() should return the same pane as toggleDebugger().");
let frame = pane._frame;
let content = pane.contentWindow;
let stackframes;
let variables;
frame.addEventListener("Debugger:Loaded", function dbgLoaded() {
frame.removeEventListener("Debugger:Loaded", dbgLoaded, true);
wait_for_connect_and_resume(function() {
ok(content.Prefs.stackframesWidth,
"The debugger preferences should have a saved stackframesWidth value.");
ok(content.Prefs.variablesWidth,
@ -45,11 +42,10 @@ function test() {
variables.setAttribute("width", someWidth2);
removeTab(tab1);
});
}, true);
frame.addEventListener("Debugger:Unloaded", function dbgUnloaded() {
frame.removeEventListener("Debugger:Unloaded", dbgUnloaded, true);
window.addEventListener("Debugger:Shutdown", function dbgShutdown() {
window.removeEventListener("Debugger:Shutdown", dbgShutdown, true);
is(content.Prefs.stackframesWidth, stackframes.getAttribute("width"),
"The stackframes pane width should have been saved by now.");