Bug 740551 - ThreadActor should automatically add appropriate debuggee globals - Patch v14; r=rcampbell

This commit is contained in:
Panos Astithas
2012-10-31 18:31:55 +02:00
parent 15e3960607
commit 7d85e45745
11 changed files with 514 additions and 216 deletions

View File

@@ -157,8 +157,13 @@ let DebuggerController = {
client.connect(function(aType, aTraits) {
client.listTabs(function(aResponse) {
let tab = aResponse.tabs[aResponse.selected];
this._startDebuggingTab(client, tab);
if (window._isChromeDebugger) {
let dbg = aResponse.chromeDebugger;
this._startChromeDebugging(client, dbg);
} else {
let tab = aResponse.tabs[aResponse.selected];
this._startDebuggingTab(client, tab);
}
window.dispatchEvent("Debugger:Connected");
}.bind(this));
}.bind(this));
@@ -236,6 +241,36 @@ let DebuggerController = {
}.bind(this));
},
/**
* Sets up a chrome debugging session.
*
* @param DebuggerClient aClient
* The debugger client.
* @param object aChromeDebugger
* The remote protocol grip of the chrome debugger.
*/
_startChromeDebugging: function DC__startChromeDebugging(aClient, aChromeDebugger) {
if (!aClient) {
Cu.reportError("No client found!");
return;
}
this.client = aClient;
aClient.attachThread(aChromeDebugger, function(aResponse, aThreadClient) {
if (!aThreadClient) {
Cu.reportError("Couldn't attach to thread: " + aResponse.error);
return;
}
this.activeThread = aThreadClient;
this.ThreadState.connect();
this.StackFrames.connect();
this.SourceScripts.connect();
aThreadClient.resume();
}.bind(this));
},
/**
* Attempts to quit the current process if allowed.
*/
@@ -687,6 +722,7 @@ StackFrames.prototype = {
*/
function SourceScripts() {
this._onNewScript = this._onNewScript.bind(this);
this._onNewGlobal = this._onNewGlobal.bind(this);
this._onScriptsAdded = this._onScriptsAdded.bind(this);
}
@@ -699,6 +735,7 @@ SourceScripts.prototype = {
*/
connect: function SS_connect() {
this.debuggerClient.addListener("newScript", this._onNewScript);
this.debuggerClient.addListener("newGlobal", this._onNewGlobal);
this._handleTabNavigation();
},
@@ -710,6 +747,7 @@ SourceScripts.prototype = {
return;
}
this.debuggerClient.removeListener("newScript", this._onNewScript);
this.debuggerClient.removeListener("newGlobal", this._onNewGlobal);
},
/**
@@ -771,6 +809,14 @@ SourceScripts.prototype = {
window.dispatchEvent("Debugger:AfterNewScript");
},
/**
* Handler for the debugger client's unsolicited newGlobal notification.
*/
_onNewGlobal: function SS__onNewGlobal(aNotification, aPacket) {
// TODO: bug 806775, update the globals list using aPacket.hostAnnotations
// from bug 801084.
},
/**
* Callback for the debugger's active thread getScripts() method.
*/