mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 697762 - Land the debugger in m-c - sr changes; r=msucan,rcampbell; sr=dtownsend
This commit is contained in:
parent
61072d64a7
commit
71a657e3b3
@ -127,7 +127,7 @@
|
||||
<command id="Tools:Downloads" oncommand="BrowserDownloadsUI();"/>
|
||||
<command id="Tools:WebConsole" oncommand="HUDConsoleUI.toggleHUD();"/>
|
||||
<command id="Tools:Inspect" oncommand="InspectorUI.toggleInspectorUI();" disabled="true"/>
|
||||
<command id="Tools:Debugger" oncommand="DebuggerUI.startDebugger();" disabled="true"/>
|
||||
<command id="Tools:Debugger" oncommand="DebuggerUI.toggleDebugger();" disabled="true"/>
|
||||
<command id="Tools:Scratchpad" oncommand="Scratchpad.openScratchpad();" disabled="true"/>
|
||||
<command id="Tools:StyleEditor" oncommand="StyleEditor.openChrome();" disabled="true"/>
|
||||
<command id="Tools:Addons" oncommand="BrowserOpenAddonsMgr();"/>
|
||||
|
@ -48,9 +48,9 @@ const Cu = Components.utils;
|
||||
|
||||
Cu.import("resource://gre/modules/NetUtil.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/devtools/dbg-server.jsm");
|
||||
Cu.import("resource://gre/modules/devtools/dbg-client.jsm");
|
||||
Cu.import("resource:///modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource:///modules/devtools/dbg-server.jsm");
|
||||
Cu.import("resource:///modules/devtools/dbg-client.jsm");
|
||||
Cu.import("resource:///modules/source-editor.jsm");
|
||||
|
||||
let EXPORTED_SYMBOLS = ["DebuggerUI"];
|
||||
@ -60,8 +60,8 @@ let EXPORTED_SYMBOLS = ["DebuggerUI"];
|
||||
*/
|
||||
function DebuggerPane(aTab) {
|
||||
this._tab = aTab;
|
||||
this.close = this.close.bind(this);
|
||||
this.debugTab = this.debugTab.bind(this);
|
||||
this._close = this.close.bind(this);
|
||||
this._debugTab = this.debugTab.bind(this);
|
||||
}
|
||||
|
||||
DebuggerPane.prototype = {
|
||||
@ -97,9 +97,9 @@ DebuggerPane.prototype = {
|
||||
};
|
||||
|
||||
let editorPlaceholder = self.frame.contentDocument.getElementById("editor");
|
||||
self.editor.init(editorPlaceholder, config, self.onEditorLoad.bind(self));
|
||||
self.editor.init(editorPlaceholder, config, self._onEditorLoad.bind(self));
|
||||
}, true);
|
||||
this.frame.addEventListener("DebuggerClose", this.close, true);
|
||||
this.frame.addEventListener("DebuggerClose", this._close, true);
|
||||
|
||||
this.frame.setAttribute("src", "chrome://browser/content/debugger.xul");
|
||||
},
|
||||
@ -108,7 +108,7 @@ DebuggerPane.prototype = {
|
||||
* The load event handler for the source editor. This method does post-load
|
||||
* editor initialization.
|
||||
*/
|
||||
onEditorLoad: function DP_onEditorLoad() {
|
||||
_onEditorLoad: function DP__onEditorLoad() {
|
||||
// Connect to the debugger server.
|
||||
this.connect();
|
||||
},
|
||||
@ -124,8 +124,8 @@ DebuggerPane.prototype = {
|
||||
if (this.frame) {
|
||||
DebuggerUIPreferences.height = this.frame.height;
|
||||
|
||||
this.frame.removeEventListener("unload", this.close, true);
|
||||
this.frame.removeEventListener("DebuggerClose", this.close, true);
|
||||
this.frame.removeEventListener("unload", this._close, true);
|
||||
this.frame.removeEventListener("DebuggerClose", this._close, true);
|
||||
if (this.frame.parentNode) {
|
||||
this.frame.parentNode.removeChild(this.frame);
|
||||
}
|
||||
@ -140,8 +140,8 @@ DebuggerPane.prototype = {
|
||||
|
||||
if (this._client) {
|
||||
this._client.removeListener("newScript", this.onNewScript);
|
||||
this._client.removeListener("tabDetached", this.close);
|
||||
this._client.removeListener("tabNavigated", this.debugTab);
|
||||
this._client.removeListener("tabDetached", this._close);
|
||||
this._client.removeListener("tabNavigated", this._debugTab);
|
||||
this._client.close();
|
||||
this._client = null;
|
||||
}
|
||||
@ -152,7 +152,7 @@ DebuggerPane.prototype = {
|
||||
* wiring event handlers as necessary.
|
||||
*/
|
||||
connect: function DP_connect() {
|
||||
this.frame.addEventListener("unload", this.close, true);
|
||||
this.frame.addEventListener("unload", this._close, true);
|
||||
|
||||
let transport = DebuggerServer.connectPipe();
|
||||
this._client = new DebuggerClient(transport);
|
||||
@ -160,10 +160,10 @@ DebuggerPane.prototype = {
|
||||
// don't need to go through the iframe, since it might be cleared.
|
||||
this.onNewScript = this.debuggerWindow.SourceScripts.onNewScript;
|
||||
let self = this;
|
||||
this._client.addListener("tabNavigated", this.debugTab);
|
||||
this._client.addListener("tabDetached", this.close);
|
||||
this._client.addListener("tabNavigated", this._debugTab);
|
||||
this._client.addListener("tabDetached", this._close);
|
||||
this._client.addListener("newScript", this.onNewScript);
|
||||
this._client.ready(function(aType, aTraits) {
|
||||
this._client.connect(function(aType, aTraits) {
|
||||
self._client.listTabs(function(aResponse) {
|
||||
let tab = aResponse.tabs[aResponse.selected];
|
||||
self.debuggerWindow.startDebuggingTab(self._client, tab);
|
||||
@ -213,14 +213,14 @@ DebuggerPane.prototype = {
|
||||
function DebuggerUI(aWindow) {
|
||||
this.aWindow = aWindow;
|
||||
|
||||
aWindow.addEventListener("Debugger:LoadSource", this.onLoadSource.bind(this));
|
||||
aWindow.addEventListener("Debugger:LoadSource", this._onLoadSource.bind(this));
|
||||
}
|
||||
|
||||
DebuggerUI.prototype = {
|
||||
/**
|
||||
* Starts the debugger or stops it, if it is already started.
|
||||
*/
|
||||
startDebugger: function DebuggerUI_startDebugger() {
|
||||
toggleDebugger: function DebuggerUI_toggleDebugger() {
|
||||
if (!DebuggerServer.initialized) {
|
||||
DebuggerServer.init();
|
||||
DebuggerServer.addBrowserActors();
|
||||
@ -244,7 +244,7 @@ DebuggerUI.prototype = {
|
||||
return aTab._scriptDebugger;
|
||||
},
|
||||
|
||||
getPreferences: function DebuggerUI_getPreferences() {
|
||||
get preferences() {
|
||||
return DebuggerUIPreferences;
|
||||
},
|
||||
|
||||
@ -255,7 +255,7 @@ DebuggerUI.prototype = {
|
||||
* without relying on caching when we can (not for eval, etc.):
|
||||
* http://www.softwareishard.com/blog/firebug/nsitraceablechannel-intercept-http-traffic/
|
||||
*/
|
||||
onLoadSource: function DebuggerUI_onLoadSource(aEvent) {
|
||||
_onLoadSource: function DebuggerUI__onLoadSource(aEvent) {
|
||||
let gBrowser = this.aWindow.gBrowser;
|
||||
|
||||
let url = aEvent.detail;
|
||||
@ -271,7 +271,7 @@ DebuggerUI.prototype = {
|
||||
}
|
||||
let source = NetUtil.readInputStreamToString(aStream, aStream.available());
|
||||
aStream.close();
|
||||
this.onSourceLoaded(url, source);
|
||||
this._onSourceLoaded(url, source);
|
||||
}.bind(this));
|
||||
} catch (ex) {
|
||||
return this.logError(url, ex.name);
|
||||
@ -295,7 +295,7 @@ DebuggerUI.prototype = {
|
||||
return this.logError(url, aStatusCode);
|
||||
}
|
||||
|
||||
this.onSourceLoaded(url, chunks.join(""));
|
||||
this._onSourceLoaded(url, chunks.join(""));
|
||||
}.bind(this)
|
||||
};
|
||||
|
||||
@ -326,7 +326,7 @@ DebuggerUI.prototype = {
|
||||
* @param string aSourceText
|
||||
* The text of the source script.
|
||||
*/
|
||||
onSourceLoaded: function DebuggerUI_onSourceLoaded(aSourceUrl, aSourceText) {
|
||||
_onSourceLoaded: function DebuggerUI__onSourceLoaded(aSourceUrl, aSourceText) {
|
||||
let dbg = this.getDebugger(this.aWindow.gBrowser.selectedTab);
|
||||
if (aSourceUrl.slice(-3) == ".js") {
|
||||
dbg.editor.setMode(SourceEditor.MODES.JAVASCRIPT);
|
||||
|
@ -56,7 +56,7 @@ let DebuggerView = {
|
||||
* L10N shortcut function
|
||||
*
|
||||
* @param string aName
|
||||
* @returns string
|
||||
* @return string
|
||||
*/
|
||||
getStr: function DV_getStr(aName) {
|
||||
return this.stringBundle.GetStringFromName(aName);
|
||||
@ -67,7 +67,7 @@ let DebuggerView = {
|
||||
*
|
||||
* @param string aName
|
||||
* @param array aArray
|
||||
* @returns string
|
||||
* @return string
|
||||
*/
|
||||
getFormatStr: function DV_getFormatStr(aName, aArray) {
|
||||
return this.stringBundle.formatStringFromName(aName, aArray, aArray.length);
|
||||
@ -228,11 +228,11 @@ DebuggerView.Stackframes = {
|
||||
/**
|
||||
* Sets if the active thread has more frames that need to be loaded.
|
||||
*
|
||||
* @param boolean value
|
||||
* @param boolean aValue
|
||||
* True if should load more frames.
|
||||
*/
|
||||
set dirty(value) {
|
||||
this._dirty = value;
|
||||
set dirty(aValue) {
|
||||
this._dirty = aValue;
|
||||
},
|
||||
|
||||
/**
|
||||
@ -243,7 +243,7 @@ DebuggerView.Stackframes = {
|
||||
/**
|
||||
* Listener handling the stackframes container scroll event.
|
||||
*/
|
||||
_onFramesScroll: function DVF__onFramesScroll(e) {
|
||||
_onFramesScroll: function DVF__onFramesScroll(aEvent) {
|
||||
// update the stackframes container only if we have to
|
||||
if (this._dirty) {
|
||||
let clientHeight = this._frames.clientHeight;
|
||||
|
@ -61,6 +61,11 @@ function initDebugger()
|
||||
|
||||
/**
|
||||
* Called by chrome to set up a debugging session.
|
||||
*
|
||||
* @param DebuggerClient aClient
|
||||
* The debugger client.
|
||||
* @param object aTabGrip
|
||||
* The remote protocol grip of the tab.
|
||||
*/
|
||||
function startDebuggingTab(aClient, aTabGrip)
|
||||
{
|
||||
@ -182,6 +187,9 @@ var StackFrames = {
|
||||
this.activeThread.removeListener("framescleared", this.onFramesCleared);
|
||||
},
|
||||
|
||||
/**
|
||||
* Handler for the thread client's paused notification.
|
||||
*/
|
||||
onPaused: function SF_onPaused() {
|
||||
this.activeThread.fillFrames(this.pageSize);
|
||||
},
|
||||
@ -216,8 +224,10 @@ var StackFrames = {
|
||||
DebuggerView.Properties.globalScope.empty();
|
||||
},
|
||||
|
||||
/**
|
||||
* Event handler for clicks on stack frames.
|
||||
*/
|
||||
onClick: function SF_onClick(aEvent) {
|
||||
// Check for clicks on stack frames.
|
||||
let target = aEvent.target;
|
||||
while (target) {
|
||||
if (target.stackFrame) {
|
||||
@ -228,6 +238,13 @@ var StackFrames = {
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Marks the stack frame in the specified depth as selected and updates the
|
||||
* properties view with the stack frame's data.
|
||||
*
|
||||
* @param number aDepth
|
||||
* The depth of the frame in the stack.
|
||||
*/
|
||||
selectFrame: function SF_selectFrame(aDepth) {
|
||||
if (this.selectedFrame !== null) {
|
||||
DebuggerView.Stackframes.highlightFrame(this.selectedFrame, false);
|
||||
@ -261,7 +278,7 @@ var StackFrames = {
|
||||
|
||||
// Add variables for every argument.
|
||||
let objClient = this.activeThread.pauseGrip(frame.callee);
|
||||
objClient.nameAndParameters(function SF_onNameAndParameters(aResponse) {
|
||||
objClient.getSignature(function SF_getSignature(aResponse) {
|
||||
for (let i = 0; i < aResponse.parameters.length; i++) {
|
||||
let param = aResponse.parameters[i];
|
||||
let paramVar = localScope.addVar(param);
|
||||
@ -310,7 +327,7 @@ var StackFrames = {
|
||||
}
|
||||
|
||||
let objClient = this.activeThread.pauseGrip(aObject);
|
||||
objClient.prototypeAndProperties(function SF_onProtoAndProps(aResponse) {
|
||||
objClient.getPrototypeAndProperties(function SF_onProtoAndProps(aResponse) {
|
||||
// Add __proto__.
|
||||
if (aResponse.prototype.type != "null") {
|
||||
let properties = {};
|
||||
@ -335,6 +352,12 @@ var StackFrames = {
|
||||
}.bind(this));
|
||||
},
|
||||
|
||||
/**
|
||||
* Adds the specified stack frame to the list.
|
||||
*
|
||||
* @param Debugger.Frame aFrame
|
||||
* The new frame to add.
|
||||
*/
|
||||
_addFramePanel: function SF_addFramePanel(aFrame) {
|
||||
let depth = aFrame.depth;
|
||||
let idText = "#" + aFrame.depth + " ";
|
||||
@ -347,11 +370,21 @@ var StackFrames = {
|
||||
}
|
||||
},
|
||||
|
||||
_addMoreFrames: function SF_addMoreLink(aFrame) {
|
||||
/**
|
||||
* Loads more stack frames from the debugger server cache.
|
||||
*/
|
||||
_addMoreFrames: function SF_addMoreFrames() {
|
||||
this.activeThread.fillFrames(
|
||||
this.activeThread.cachedFrames.length + this.pageSize);
|
||||
},
|
||||
|
||||
/**
|
||||
* Create a textual representation for the stack frame specified, for
|
||||
* displaying in the stack frame list.
|
||||
*
|
||||
* @param Debugger.Frame aFrame
|
||||
* The stack frame to label.
|
||||
*/
|
||||
_frameTitle: function SF_frameTitle(aFrame) {
|
||||
if (aFrame.type == "call") {
|
||||
return aFrame["calleeName"] ? aFrame["calleeName"] + "()" : "(anonymous)";
|
||||
@ -401,6 +434,9 @@ var SourceScripts = {
|
||||
this.activeThread.removeListener("scriptscleared", this.onScriptsCleared);
|
||||
},
|
||||
|
||||
/**
|
||||
* Handler for the thread client's paused notification.
|
||||
*/
|
||||
onPaused: function SS_onPaused() {
|
||||
this.activeThread.fillScripts();
|
||||
},
|
||||
|
@ -47,8 +47,8 @@
|
||||
]>
|
||||
<xul:window xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<xul:script type="text/javascript;version=1.8" src="debugger.js"/>
|
||||
<xul:script type="text/javascript;version=1.8" src="debugger-view.js"/>
|
||||
<xul:script type="text/javascript" src="debugger.js"/>
|
||||
<xul:script type="text/javascript" src="debugger-view.js"/>
|
||||
|
||||
<div id="body" class="vbox flex">
|
||||
<xul:toolbar id="dbg-toolbar">
|
||||
|
@ -16,7 +16,7 @@ function test()
|
||||
|
||||
let transport = DebuggerServer.connectPipe();
|
||||
gClient = new DebuggerClient(transport);
|
||||
gClient.ready(function(aType, aTraits) {
|
||||
gClient.connect(function(aType, aTraits) {
|
||||
is(aType, "browser", "Root actor should identify itself as a browser.");
|
||||
get_tab();
|
||||
});
|
||||
|
@ -16,7 +16,7 @@ function test()
|
||||
|
||||
let transport = DebuggerServer.connectPipe();
|
||||
gClient = new DebuggerClient(transport);
|
||||
gClient.ready(function(aType, aTraits) {
|
||||
gClient.connect(function(aType, aTraits) {
|
||||
is(aType, "browser", "Root actor should identify itself as a browser.");
|
||||
get_tab();
|
||||
});
|
||||
|
@ -16,7 +16,7 @@ function test()
|
||||
{
|
||||
let transport = DebuggerServer.connectPipe();
|
||||
gClient = new DebuggerClient(transport);
|
||||
gClient.ready(function(aType, aTraits) {
|
||||
gClient.connect(function(aType, aTraits) {
|
||||
gTab = addTab(DEBUGGER_TAB_URL, function() {
|
||||
attach_tab_actor_for_url(gClient, DEBUGGER_TAB_URL, function(actor, response) {
|
||||
test_early_debugger_statement(response);
|
||||
|
@ -13,7 +13,7 @@ function test()
|
||||
{
|
||||
let transport = DebuggerServer.connectPipe();
|
||||
gClient = new DebuggerClient(transport);
|
||||
gClient.ready(function(aType, aTraits) {
|
||||
gClient.connect(function(aType, aTraits) {
|
||||
is(aType, "browser", "Root actor should identify itself as a browser.");
|
||||
test_first_tab();
|
||||
});
|
||||
|
@ -14,7 +14,7 @@ function test()
|
||||
{
|
||||
let transport = DebuggerServer.connectPipe();
|
||||
gClient = new DebuggerClient(transport);
|
||||
gClient.ready(function(aType, aTraits) {
|
||||
gClient.connect(function(aType, aTraits) {
|
||||
is(aType, "browser", "Root actor should identify itself as a browser.");
|
||||
get_tab();
|
||||
});
|
||||
|
@ -11,29 +11,29 @@ function test() {
|
||||
ok(!DebuggerUI.getDebugger(gBrowser.selectedTab),
|
||||
"Shouldn't have a debugger pane for this tab yet.");
|
||||
|
||||
let pane = DebuggerUI.startDebugger();
|
||||
let pane = DebuggerUI.toggleDebugger();
|
||||
let someHeight = parseInt(Math.random() * 200) + 200;
|
||||
|
||||
ok(pane, "startDebugger() should return a pane.");
|
||||
ok(pane, "toggleDebugger() should return a pane.");
|
||||
|
||||
is(DebuggerUI.getDebugger(gBrowser.selectedTab), pane,
|
||||
"getDebugger() should return the same pane as startDebugger().");
|
||||
"getDebugger() should return the same pane as toggleDebugger().");
|
||||
|
||||
ok(DebuggerUI.getPreferences().height,
|
||||
ok(DebuggerUI.preferences.height,
|
||||
"The debugger preferences should have a saved height value.");
|
||||
|
||||
is(DebuggerUI.getPreferences().height, pane.frame.height,
|
||||
is(DebuggerUI.preferences.height, pane.frame.height,
|
||||
"The debugger pane height should be the same as the preferred value.");
|
||||
|
||||
pane.frame.height = someHeight;
|
||||
ok(DebuggerUI.getPreferences().height !== someHeight,
|
||||
ok(DebuggerUI.preferences.height !== someHeight,
|
||||
"Height preferences shouldn't have been updated yet.");
|
||||
|
||||
pane.onConnected = function() {
|
||||
removeTab(tab1);
|
||||
finish();
|
||||
|
||||
is(DebuggerUI.getPreferences().height, someHeight,
|
||||
is(DebuggerUI.preferences.height, someHeight,
|
||||
"Height preferences should have been updated by now.");
|
||||
};
|
||||
});
|
||||
|
@ -16,7 +16,7 @@ function test()
|
||||
|
||||
let transport = DebuggerServer.connectPipe();
|
||||
gClient = new DebuggerClient(transport);
|
||||
gClient.ready(function (aType, aTraits) {
|
||||
gClient.connect(function (aType, aTraits) {
|
||||
is(aType, "browser", "Root actor should identify itself as a browser.");
|
||||
get_tab();
|
||||
});
|
||||
|
@ -16,7 +16,7 @@ function test()
|
||||
|
||||
let transport = DebuggerServer.connectPipe();
|
||||
gClient = new DebuggerClient(transport);
|
||||
gClient.ready(function (aType, aTraits) {
|
||||
gClient.connect(function (aType, aTraits) {
|
||||
is(aType, "browser", "Root actor should identify itself as a browser.");
|
||||
get_tab();
|
||||
});
|
||||
|
@ -82,7 +82,7 @@ function debug_tab_pane(aURL, aOnDebugging)
|
||||
|
||||
let debuggee = tab.linkedBrowser.contentWindow.wrappedJSObject;
|
||||
|
||||
let pane = DebuggerUI.startDebugger();
|
||||
let pane = DebuggerUI.toggleDebugger();
|
||||
pane.onConnected = function() {
|
||||
// Wait for the initial resume...
|
||||
pane.debuggerWindow.gClient.addOneTimeListener("resumed", function() {
|
||||
|
@ -60,8 +60,8 @@ function dumpn(str)
|
||||
dump("DBG-CLIENT: " + str + "\n");
|
||||
}
|
||||
|
||||
let loader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
|
||||
.getService(Components.interfaces.mozIJSSubScriptLoader);
|
||||
let loader = Cc["@mozilla.org/moz/jssubscript-loader;1"]
|
||||
.getService(Ci.mozIJSSubScriptLoader);
|
||||
loader.loadSubScript("chrome://global/content/devtools/dbg-transport.js");
|
||||
|
||||
/**
|
||||
@ -79,12 +79,16 @@ function eventSource(aProto) {
|
||||
*
|
||||
* @param aName string
|
||||
* The event to listen for, or null to listen to all events.
|
||||
* @param aListener
|
||||
* @param aListener function
|
||||
* Called when the event is fired. If the same listener
|
||||
* is added more the once, it will be called once per
|
||||
* addListener call.
|
||||
*/
|
||||
aProto.addListener = function EV_addListener(aName, aListener) {
|
||||
if (typeof aListener != "function") {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this._listeners) {
|
||||
this._listeners = {};
|
||||
}
|
||||
@ -170,7 +174,12 @@ function eventSource(aProto) {
|
||||
}
|
||||
|
||||
for each (let listener in listeners) {
|
||||
listener.apply(null, arguments);
|
||||
try {
|
||||
listener.apply(null, arguments);
|
||||
} catch (e) {
|
||||
// Prevent a bad listener from interfering with the others.
|
||||
Cu.reportError(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -227,14 +236,13 @@ function DebuggerClient(aTransport)
|
||||
|
||||
DebuggerClient.prototype = {
|
||||
/**
|
||||
* Signals you are ready to communicate with the server. Will start
|
||||
* responding to messages from the debug server.
|
||||
* Connect to the server and start exchanging protocol messages.
|
||||
*
|
||||
* @param aOnConnected function
|
||||
* If specified, will be called when the greeting packet is
|
||||
* received from the debugging server.
|
||||
*/
|
||||
ready: function DC_ready(aOnConnected) {
|
||||
connect: function DC_connect(aOnConnected) {
|
||||
if (aOnConnected) {
|
||||
this.addOneTimeListener("connected", function(aName, aApplicationType, aTraits) {
|
||||
aOnConnected(aApplicationType, aTraits);
|
||||
@ -342,11 +350,11 @@ DebuggerClient.prototype = {
|
||||
/**
|
||||
* Send a request to the debugging server.
|
||||
*
|
||||
* @aRequest object
|
||||
* A JSON packet to send to the debugging server.
|
||||
* @aOnResponse function
|
||||
* If specified, will be called with the response packet when
|
||||
* debugging server responds.
|
||||
* @param aRequest object
|
||||
* A JSON packet to send to the debugging server.
|
||||
* @param aOnResponse function
|
||||
* If specified, will be called with the response packet when
|
||||
* debugging server responds.
|
||||
*/
|
||||
request: function DC_request(aRequest, aOnResponse) {
|
||||
if (!this._connected) {
|
||||
@ -380,8 +388,14 @@ DebuggerClient.prototype = {
|
||||
});
|
||||
},
|
||||
|
||||
// Transport hooks
|
||||
// Transport hooks.
|
||||
|
||||
/**
|
||||
* Called by DebuggerTransport to dispatch incoming packets as appropriate.
|
||||
*
|
||||
* @param aPacket object
|
||||
* The incoming packet.
|
||||
*/
|
||||
onPacket: function DC_onPacket(aPacket) {
|
||||
if (!this._connected) {
|
||||
// Hello packet.
|
||||
@ -422,7 +436,14 @@ DebuggerClient.prototype = {
|
||||
this._sendRequests();
|
||||
},
|
||||
|
||||
onClosed: function DC_onClosed() {
|
||||
/**
|
||||
* Called by DebuggerTransport when the underlying stream is closed.
|
||||
*
|
||||
* @param aStatus nsresult
|
||||
* The status code that corresponds to the reason for closing
|
||||
* the stream.
|
||||
*/
|
||||
onClosed: function DC_onClosed(aStatus) {
|
||||
this.notify("closed");
|
||||
},
|
||||
}
|
||||
@ -433,6 +454,11 @@ eventSource(DebuggerClient.prototype);
|
||||
* Creates a tab client for the remote debugging protocol server. This client
|
||||
* is a front to the tab actor created in the server side, hiding the protocol
|
||||
* details in a traditional JavaScript API.
|
||||
*
|
||||
* @param aClient DebuggerClient
|
||||
* The debugger client parent.
|
||||
* @param aActor string
|
||||
* The actor ID for this tab.
|
||||
*/
|
||||
function TabClient(aClient, aActor) {
|
||||
this._client = aClient;
|
||||
@ -467,6 +493,11 @@ eventSource(TabClient.prototype);
|
||||
* Creates a thread client for the remote debugging protocol server. This client
|
||||
* is a front to the thread actor created in the server side, hiding the
|
||||
* protocol details in a traditional JavaScript API.
|
||||
*
|
||||
* @param aClient DebuggerClient
|
||||
* The debugger client parent.
|
||||
* @param aActor string
|
||||
* The actor ID for this thread.
|
||||
*/
|
||||
function ThreadClient(aClient, aActor) {
|
||||
this._client = aClient;
|
||||
@ -563,9 +594,11 @@ ThreadClient.prototype = {
|
||||
/**
|
||||
* Request to set a breakpoint in the specified location.
|
||||
*
|
||||
* @param aLocation object The source location object where the breakpoint
|
||||
* will be set.
|
||||
* @param aOnResponse integer Called with the thread's response.
|
||||
* @param aLocation object
|
||||
* The source location object where the breakpoint
|
||||
* will be set.
|
||||
* @param aOnResponse integer
|
||||
* Called with the thread's response.
|
||||
*/
|
||||
setBreakpoint: function TC_setBreakpoint(aLocation, aOnResponse) {
|
||||
this._assertPaused("setBreakpoint");
|
||||
@ -585,9 +618,10 @@ ThreadClient.prototype = {
|
||||
/**
|
||||
* Request the loaded scripts for the current thread.
|
||||
*
|
||||
* @param aOnResponse integer Called with the thread's response.
|
||||
* @param aOnResponse integer
|
||||
* Called with the thread's response.
|
||||
*/
|
||||
scripts: function TC_scripts(aOnResponse) {
|
||||
getScripts: function TC_getScripts(aOnResponse) {
|
||||
let packet = { to: this._actor, type: DebugProtocolTypes.scripts };
|
||||
this._client.request(packet, aOnResponse);
|
||||
},
|
||||
@ -608,7 +642,7 @@ ThreadClient.prototype = {
|
||||
*/
|
||||
fillScripts: function TC_fillScripts() {
|
||||
let self = this;
|
||||
this.scripts(function(aResponse) {
|
||||
this.getScripts(function(aResponse) {
|
||||
for each (let script in aResponse.scripts) {
|
||||
self._scriptCache[script.url] = script;
|
||||
}
|
||||
@ -634,13 +668,16 @@ ThreadClient.prototype = {
|
||||
/**
|
||||
* Request frames from the callstack for the current thread.
|
||||
*
|
||||
* @param aStart integer The number of the youngest stack frame to return
|
||||
* (the youngest frame is 0).
|
||||
* @param aCount integer The maximum number of frames to return, or null
|
||||
* to return all frames.
|
||||
* @param aOnResponse integer Called with the thread's response.
|
||||
* @param aStart integer
|
||||
* The number of the youngest stack frame to return (the youngest
|
||||
* frame is 0).
|
||||
* @param aCount integer
|
||||
* The maximum number of frames to return, or null to return all
|
||||
* frames.
|
||||
* @param aOnResponse function
|
||||
* Called with the thread's response.
|
||||
*/
|
||||
frames: function TC_frames(aStart, aCount, aOnResponse) {
|
||||
getFrames: function TC_getFrames(aStart, aCount, aOnResponse) {
|
||||
this._assertPaused("frames");
|
||||
|
||||
let packet = { to: this._actor, type: DebugProtocolTypes.frames,
|
||||
@ -669,7 +706,8 @@ ThreadClient.prototype = {
|
||||
* ThreadClient's stack frame cache. A framesadded event will be
|
||||
* sent when the stack frame cache is updated.
|
||||
*
|
||||
* @param aTotal The minimum number of stack frames to be included.
|
||||
* @param aTotal number
|
||||
* The minimum number of stack frames to be included.
|
||||
*
|
||||
* @returns true if a framesadded notification should be expected.
|
||||
*/
|
||||
@ -683,7 +721,7 @@ ThreadClient.prototype = {
|
||||
let numFrames = this._frameCache.length;
|
||||
|
||||
let self = this;
|
||||
this.frames(numFrames, aTotal - numFrames, function(aResponse) {
|
||||
this.getFrames(numFrames, aTotal - numFrames, function(aResponse) {
|
||||
for each (let frame in aResponse.frames) {
|
||||
self._frameCache[frame.depth] = frame;
|
||||
}
|
||||
@ -709,10 +747,10 @@ ThreadClient.prototype = {
|
||||
/**
|
||||
* Return a GripClient object for the given object grip.
|
||||
*
|
||||
* @param aGrip object A pause-lifetime object grip returned by the
|
||||
* protocol.
|
||||
* @param aGrip object
|
||||
* A pause-lifetime object grip returned by the protocol.
|
||||
*/
|
||||
pauseGrip: function DC_pauseGrip(aGrip) {
|
||||
pauseGrip: function TC_pauseGrip(aGrip) {
|
||||
if (!this._pauseGrips) {
|
||||
this._pauseGrips = {};
|
||||
}
|
||||
@ -753,6 +791,11 @@ eventSource(ThreadClient.prototype);
|
||||
|
||||
/**
|
||||
* Grip clients are used to retrieve information about the relevant object.
|
||||
*
|
||||
* @param aClient DebuggerClient
|
||||
* The debugger client parent.
|
||||
* @param aGrip object
|
||||
* A pause-lifetime object grip returned by the protocol.
|
||||
*/
|
||||
function GripClient(aClient, aGrip)
|
||||
{
|
||||
@ -770,11 +813,12 @@ GripClient.prototype = {
|
||||
/**
|
||||
* Request the name of the function and its formal parameters.
|
||||
*
|
||||
* @param aOnResponse function Called with the request's response.
|
||||
* @param aOnResponse function
|
||||
* Called with the request's response.
|
||||
*/
|
||||
nameAndParameters: function GC_nameAndParameters(aOnResponse) {
|
||||
getSignature: function GC_getSignature(aOnResponse) {
|
||||
if (this._grip["class"] !== "Function") {
|
||||
throw "nameAndParameters is only valid for function grips.";
|
||||
throw "getSignature is only valid for function grips.";
|
||||
}
|
||||
|
||||
let packet = { to: this.actor, type: DebugProtocolTypes.nameAndParameters };
|
||||
@ -791,7 +835,7 @@ GripClient.prototype = {
|
||||
*
|
||||
* @param aOnResponse function Called with the request's response.
|
||||
*/
|
||||
ownPropertyNames: function GC_ownPropertyNames(aOnResponse) {
|
||||
getOwnPropertyNames: function GC_getOwnPropertyNames(aOnResponse) {
|
||||
let packet = { to: this.actor, type: DebugProtocolTypes.ownPropertyNames };
|
||||
this._client.request(packet, function (aResponse) {
|
||||
if (aOnResponse) {
|
||||
@ -805,7 +849,7 @@ GripClient.prototype = {
|
||||
*
|
||||
* @param aOnResponse function Called with the request's response.
|
||||
*/
|
||||
prototypeAndProperties: function GC_prototypeAndProperties(aOnResponse) {
|
||||
getPrototypeAndProperties: function GC_getPrototypeAndProperties(aOnResponse) {
|
||||
let packet = { to: this.actor,
|
||||
type: DebugProtocolTypes.prototypeAndProperties };
|
||||
this._client.request(packet, function (aResponse) {
|
||||
@ -821,7 +865,7 @@ GripClient.prototype = {
|
||||
* @param aName string The name of the requested property.
|
||||
* @param aOnResponse function Called with the request's response.
|
||||
*/
|
||||
property: function GC_property(aName, aOnResponse) {
|
||||
getProperty: function GC_getProperty(aName, aOnResponse) {
|
||||
let packet = { to: this.actor, type: DebugProtocolTypes.property,
|
||||
name: aName };
|
||||
this._client.request(packet, function (aResponse) {
|
||||
@ -836,7 +880,7 @@ GripClient.prototype = {
|
||||
*
|
||||
* @param aOnResponse function Called with the request's response.
|
||||
*/
|
||||
prototype: function GC_prototype(aOnResponse) {
|
||||
getPrototype: function GC_getPrototype(aOnResponse) {
|
||||
let packet = { to: this.actor, type: DebugProtocolTypes.prototype };
|
||||
this._client.request(packet, function (aResponse) {
|
||||
if (aOnResponse) {
|
||||
@ -848,6 +892,11 @@ GripClient.prototype = {
|
||||
|
||||
/**
|
||||
* Breakpoint clients are used to remove breakpoints that are no longer used.
|
||||
*
|
||||
* @param aClient DebuggerClient
|
||||
* The debugger client parent.
|
||||
* @param aActor string
|
||||
* The actor ID for this breakpoint.
|
||||
*/
|
||||
function BreakpointClient(aClient, aActor) {
|
||||
this._client = aClient;
|
||||
@ -875,7 +924,12 @@ BreakpointClient.prototype = {
|
||||
eventSource(BreakpointClient.prototype);
|
||||
|
||||
/**
|
||||
* Returns a DebuggerTransport.
|
||||
* Connects to a debugger server socket and returns a DebuggerTransport.
|
||||
*
|
||||
* @param aHost string
|
||||
* The host name or IP address of the debugger server.
|
||||
* @param aPort number
|
||||
* The port number of the debugger server.
|
||||
*/
|
||||
function debuggerSocketConnect(aHost, aPort)
|
||||
{
|
||||
|
@ -96,7 +96,7 @@ DebuggerTransport.prototype = {
|
||||
}
|
||||
},
|
||||
|
||||
onOutputStreamReady: function DT_ready(aStream) {
|
||||
onOutputStreamReady: function DT_onOutputStreamReady(aStream) {
|
||||
let written = aStream.write(this._outgoing, this._outgoing.length);
|
||||
this._outgoing = this._outgoing.slice(written);
|
||||
this._flushOutgoing();
|
||||
@ -125,7 +125,7 @@ DebuggerTransport.prototype = {
|
||||
try {
|
||||
this._incoming += NetUtil.readInputStreamToString(aStream,
|
||||
aStream.available());
|
||||
while (this.processIncoming()) {};
|
||||
while (this._processIncoming()) {};
|
||||
} catch(e) {
|
||||
dumpn("Unexpected error reading from debugging connection: " + e + " - " + e.stack);
|
||||
this.close();
|
||||
@ -134,13 +134,13 @@ DebuggerTransport.prototype = {
|
||||
},
|
||||
|
||||
/**
|
||||
* Process incomig packets. Returns true if a packet has been received, either
|
||||
* Process incoming packets. Returns true if a packet has been received, either
|
||||
* if it was properly parsed or not. Returns false if the incoming stream does
|
||||
* not contain a full packet yet. After a proper packet is parsed, the dispatch
|
||||
* handler DebuggerTransport.hooks.onPacket is called with the packet as a
|
||||
* parameter.
|
||||
*/
|
||||
processIncoming: function DT_processIncoming() {
|
||||
_processIncoming: function DT__processIncoming() {
|
||||
// Well this is ugly.
|
||||
let sep = this._incoming.indexOf(':');
|
||||
if (sep < 0) {
|
||||
|
@ -45,7 +45,7 @@
|
||||
interface nsIJSInspector : nsISupports
|
||||
{
|
||||
/**
|
||||
* Process the thread's event queue until exi
|
||||
* Process the thread's event queue until exit.
|
||||
*
|
||||
* @return depth Returns the number of times the event loop
|
||||
* has been nested using this API.
|
||||
|
@ -55,6 +55,9 @@ function createRootActor(aConnection)
|
||||
* The root actor is responsible for the initial 'hello' packet and for
|
||||
* responding to a 'listTabs' request that produces the list of currently open
|
||||
* tabs.
|
||||
*
|
||||
* @param aConnection DebuggerServerConnection
|
||||
* The conection to the client.
|
||||
*/
|
||||
function BrowserRootActor(aConnection)
|
||||
{
|
||||
@ -205,13 +208,18 @@ BrowserRootActor.prototype.requestTypes = {
|
||||
/**
|
||||
* Creates a tab actor for handling requests to a browser tab, like attaching
|
||||
* and detaching.
|
||||
*
|
||||
* @param aConnection DebuggerServerConnection
|
||||
* The conection to the client.
|
||||
* @param aBrowser browser
|
||||
* The browser instance that contains this tab.
|
||||
*/
|
||||
function BrowserTabActor(aConnection, aBrowser)
|
||||
{
|
||||
this.conn = aConnection;
|
||||
this._browser = aBrowser;
|
||||
|
||||
this.onWindowCreated = this.onWindowCreated.bind(this);
|
||||
this._onWindowCreated = this.onWindowCreated.bind(this);
|
||||
}
|
||||
|
||||
// XXX (bug 710213): BrowserTabActor attach/detach/exit/disconnect is a
|
||||
@ -282,7 +290,7 @@ BrowserTabActor.prototype = {
|
||||
this._pushContext();
|
||||
|
||||
// Watch for globals being created in this tab.
|
||||
this.browser.addEventListener("DOMWindowCreated", this.onWindowCreated, true);
|
||||
this.browser.addEventListener("DOMWindowCreated", this._onWindowCreated, true);
|
||||
|
||||
this._attached = true;
|
||||
},
|
||||
@ -323,7 +331,7 @@ BrowserTabActor.prototype = {
|
||||
return;
|
||||
}
|
||||
|
||||
this.browser.removeEventListener("DOMWindowCreated", this.onWindowCreated);
|
||||
this.browser.removeEventListener("DOMWindowCreated", this._onWindowCreated, true);
|
||||
|
||||
this._popContext();
|
||||
|
||||
@ -356,26 +364,26 @@ BrowserTabActor.prototype = {
|
||||
return { type: "detached" };
|
||||
},
|
||||
|
||||
onThreadActor: function BTA_onThreadActor(aRequest) {
|
||||
if (!this.attached) {
|
||||
return { error: "wrongState" };
|
||||
}
|
||||
|
||||
return { threadActor: this.threadActor.actorID };
|
||||
},
|
||||
|
||||
/**
|
||||
* Suppresses content-initiated events. Called right before entering the
|
||||
* nested event loop.
|
||||
*/
|
||||
preNest: function BTA_preNest() {
|
||||
this.browser.contentWindow
|
||||
.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils)
|
||||
.suppressEventHandling(true);
|
||||
.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils)
|
||||
.suppressEventHandling(true);
|
||||
},
|
||||
|
||||
/**
|
||||
* Re-enables content-initiated events. Called right after exiting the
|
||||
* nested event loop.
|
||||
*/
|
||||
postNest: function BTA_postNest(aNestData) {
|
||||
this.browser.contentWindow
|
||||
.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils)
|
||||
.suppressEventHandling(false);
|
||||
.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils)
|
||||
.suppressEventHandling(false);
|
||||
},
|
||||
|
||||
/**
|
||||
@ -404,6 +412,11 @@ BrowserTabActor.prototype.requestTypes = {
|
||||
/**
|
||||
* Registers handlers for new request types defined dynamically. This is used
|
||||
* for example by add-ons to augment the functionality of the tab actor.
|
||||
*
|
||||
* @param aName string
|
||||
* The name of the new request type.
|
||||
* @param aFunction function
|
||||
* The handler for this request type.
|
||||
*/
|
||||
DebuggerServer.addTabRequest = function DS_addTabRequest(aName, aFunction) {
|
||||
BrowserTabActor.prototype.requestTypes[aName] = function(aRequest) {
|
||||
|
@ -47,6 +47,10 @@
|
||||
*
|
||||
* ThreadActors manage a JSInspector object and manage execution/inspection
|
||||
* of debuggees.
|
||||
*
|
||||
* @param aHooks object
|
||||
* An object with preNest and postNest methods that can be called when
|
||||
* entering and exiting a nested event loop.
|
||||
*/
|
||||
function ThreadActor(aHooks)
|
||||
{
|
||||
@ -220,9 +224,9 @@ ThreadActor.prototype = {
|
||||
let packet = this._paused(youngest);
|
||||
packet.why = { type: "clientEvaluated" };
|
||||
if ("return" in completion) {
|
||||
packet.why.value = this.valueGrip(completion["return"]);
|
||||
packet.why.value = this.createValueGrip(completion["return"]);
|
||||
} else if ("throw" in completion) {
|
||||
packet.why.exception = this.valueGrip(completion["throw"]);
|
||||
packet.why.exception = this.createValueGrip(completion["throw"]);
|
||||
} else {
|
||||
// XXXspec
|
||||
packet.why.terminated = true;
|
||||
@ -254,7 +258,7 @@ ThreadActor.prototype = {
|
||||
// frames if count is not defined.
|
||||
let frames = [];
|
||||
for (; frame && (!count || i < (start + count)); i++) {
|
||||
let grip = this._frameActor(frame).grip();
|
||||
let grip = this._createFrameActor(frame).grip();
|
||||
grip.depth = i;
|
||||
frames.push(grip);
|
||||
frame = frame.older;
|
||||
@ -401,7 +405,7 @@ ThreadActor.prototype = {
|
||||
type: "paused",
|
||||
actor: this._pauseActor.actorID };
|
||||
if (aFrame) {
|
||||
packet.frame = this._frameActor(aFrame).grip();
|
||||
packet.frame = this._createFrameActor(aFrame).grip();
|
||||
}
|
||||
|
||||
if (poppedFrames) {
|
||||
@ -475,7 +479,7 @@ ThreadActor.prototype = {
|
||||
return popped;
|
||||
},
|
||||
|
||||
_frameActor: function TA_threadActor(aFrame) {
|
||||
_createFrameActor: function TA_createFrameActor(aFrame) {
|
||||
if (aFrame.actor) {
|
||||
return aFrame.actor;
|
||||
}
|
||||
@ -497,7 +501,7 @@ ThreadActor.prototype = {
|
||||
* The pool where the newly-created actor will be placed.
|
||||
* @return The EnvironmentActor for aObject.
|
||||
*/
|
||||
environmentActor: function TA_environmentActor(aObject, aPool) {
|
||||
createEnvironmentActor: function TA_createEnvironmentActor(aObject, aPool) {
|
||||
let environment = aObject.environment;
|
||||
// XXX: need to spec this: when the object is a function proxy or not a
|
||||
// function implemented in JavaScript, we don't return a scope property at
|
||||
@ -522,7 +526,7 @@ ThreadActor.prototype = {
|
||||
* Create a grip for the given debuggee value. If the value is an
|
||||
* object, will create a pause-lifetime actor.
|
||||
*/
|
||||
valueGrip: function TA_valueGrip(aValue) {
|
||||
createValueGrip: function TA_createValueGrip(aValue) {
|
||||
let type = typeof(aValue);
|
||||
if (type === "boolean" || type === "string" || type === "number") {
|
||||
return aValue;
|
||||
@ -544,6 +548,14 @@ ThreadActor.prototype = {
|
||||
return null;
|
||||
},
|
||||
|
||||
/**
|
||||
* Create a grip for the given debuggee object.
|
||||
*
|
||||
* @param aValue Debugger.Object
|
||||
* The debuggee object value.
|
||||
* @param aPool ActorPool
|
||||
* The actor pool where the new object actor will be added.
|
||||
*/
|
||||
objectGrip: function TA_objectGrip(aValue, aPool) {
|
||||
if (!aPool.objectActors) {
|
||||
aPool.objectActors = new WeakMap();
|
||||
@ -559,6 +571,12 @@ ThreadActor.prototype = {
|
||||
return actor.grip();
|
||||
},
|
||||
|
||||
/**
|
||||
* Create a grip for the given debuggee object with a pause lifetime.
|
||||
*
|
||||
* @param aValue Debugger.Object
|
||||
* The debuggee object value.
|
||||
*/
|
||||
pauseObjectGrip: function TA_pauseObjectGrip(aValue) {
|
||||
if (!this._pausePool) {
|
||||
throw "Object grip requested while not paused.";
|
||||
@ -567,15 +585,37 @@ ThreadActor.prototype = {
|
||||
return this.objectGrip(aValue, this._pausePool);
|
||||
},
|
||||
|
||||
/**
|
||||
* Create a grip for the given debuggee object with a thread lifetime.
|
||||
*
|
||||
* @param aValue Debugger.Object
|
||||
* The debuggee object value.
|
||||
*/
|
||||
threadObjectGrip: function TA_threadObjectGrip(aValue) {
|
||||
return this.objectGrip(aValue, this.threadLifetimePool);
|
||||
},
|
||||
|
||||
// JS Debugger hooks.
|
||||
// JS Debugger API hooks.
|
||||
|
||||
/**
|
||||
* A function that the engine calls when a call to a debug event hook,
|
||||
* breakpoint handler, watchpoint handler, or similar function throws some
|
||||
* exception.
|
||||
*
|
||||
* @param aException exception
|
||||
* The exception that was thrown in the debugger code.
|
||||
*/
|
||||
uncaughtExceptionHook: function TA_uncaughtExceptionHook(aException) {
|
||||
dumpn("Got an exception:" + aException);
|
||||
},
|
||||
|
||||
/**
|
||||
* A function that the engine calls when a debugger statement has been
|
||||
* executed in the specified frame.
|
||||
*
|
||||
* @param aFrame Debugger.Frame
|
||||
* The stack frame that contained the debugger statement.
|
||||
*/
|
||||
onDebuggerStatement: function TA_onDebuggerStatement(aFrame) {
|
||||
try {
|
||||
let packet = this._paused(aFrame);
|
||||
@ -591,6 +631,19 @@ ThreadActor.prototype = {
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* A function that the engine calls when a new script has been loaded into a
|
||||
* debuggee compartment. If the new code is part of a function, aFunction is
|
||||
* a Debugger.Object reference to the function object. (Not all code is part
|
||||
* of a function; for example, the code appearing in a <script> tag that is
|
||||
* outside of any functions defined in that tag would be passed to
|
||||
* onNewScript without an accompanying function argument.)
|
||||
*
|
||||
* @param aScript Debugger.Script
|
||||
* The source script that has been loaded into a debuggee compartment.
|
||||
* @param aFunction Debugger.Object
|
||||
* The function object that the ew code is part of.
|
||||
*/
|
||||
onNewScript: function TA_onNewScript(aScript, aFunction) {
|
||||
dumpn("Got a new script:" + aScript + ", url: " + aScript.url +
|
||||
", startLine: " + aScript.startLine + ", lineCount: " +
|
||||
@ -642,6 +695,14 @@ PauseActor.prototype = {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Creates an actor for the specified object.
|
||||
*
|
||||
* @param aObj Debugger.Object
|
||||
* The debuggee object.
|
||||
* @param aThreadActor ThreadActor
|
||||
* The parent thread actor for this object.
|
||||
*/
|
||||
function ObjectActor(aObj, aThreadActor)
|
||||
{
|
||||
this.obj = aObj;
|
||||
@ -656,12 +717,18 @@ ObjectActor.prototype = {
|
||||
message: "Object actors can only be accessed while the thread is paused."
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns a grip for this actor for returning in a protocol message.
|
||||
*/
|
||||
grip: function OA_grip() {
|
||||
return { "type": "object",
|
||||
"class": this.obj["class"],
|
||||
"actor": this.actorID };
|
||||
},
|
||||
|
||||
/**
|
||||
* Releases this actor from the pool.
|
||||
*/
|
||||
release: function OA_release() {
|
||||
this.registeredPool.objectActors.delete(this.obj);
|
||||
this.registeredPool.removeActor(this.actorID);
|
||||
@ -670,6 +737,9 @@ ObjectActor.prototype = {
|
||||
/**
|
||||
* Handle a protocol request to provide the names of the properties defined on
|
||||
* the object and not its prototype.
|
||||
*
|
||||
* @param aRequest object
|
||||
* The protocol request object.
|
||||
*/
|
||||
onOwnPropertyNames: function OA_onOwnPropertyNames(aRequest) {
|
||||
if (this.threadActor.state !== "paused") {
|
||||
@ -683,6 +753,9 @@ ObjectActor.prototype = {
|
||||
/**
|
||||
* Handle a protocol request to provide the prototype and own properties of
|
||||
* the object.
|
||||
*
|
||||
* @param aRequest object
|
||||
* The protocol request object.
|
||||
*/
|
||||
onPrototypeAndProperties: function OA_onPrototypeAndProperties(aRequest) {
|
||||
if (this.threadActor.state !== "paused") {
|
||||
@ -702,12 +775,15 @@ ObjectActor.prototype = {
|
||||
}
|
||||
}
|
||||
return { from: this.actorID,
|
||||
prototype: this.threadActor.valueGrip(this.obj.proto),
|
||||
prototype: this.threadActor.createValueGrip(this.obj.proto),
|
||||
ownProperties: ownProperties };
|
||||
},
|
||||
|
||||
/**
|
||||
* Handle a protocol request to provide the prototype of the object.
|
||||
*
|
||||
* @param aRequest object
|
||||
* The protocol request object.
|
||||
*/
|
||||
onPrototype: function OA_onPrototype(aRequest) {
|
||||
if (this.threadActor.state !== "paused") {
|
||||
@ -715,12 +791,15 @@ ObjectActor.prototype = {
|
||||
}
|
||||
|
||||
return { from: this.actorID,
|
||||
prototype: this.threadActor.valueGrip(this.obj.proto) };
|
||||
prototype: this.threadActor.createValueGrip(this.obj.proto) };
|
||||
},
|
||||
|
||||
/**
|
||||
* Handle a protocol request to provide the property descriptor of the
|
||||
* object's specified property.
|
||||
*
|
||||
* @param aRequest object
|
||||
* The protocol request object.
|
||||
*/
|
||||
onProperty: function OA_onProperty(aRequest) {
|
||||
if (this.threadActor.state !== "paused") {
|
||||
@ -738,8 +817,11 @@ ObjectActor.prototype = {
|
||||
},
|
||||
|
||||
/**
|
||||
* A helper method that creates a property descriptor, properly formatted for
|
||||
* sending in a protocol response.
|
||||
* A helper method that creates a property descriptor for the provided object,
|
||||
* properly formatted for sending in a protocol response.
|
||||
*
|
||||
* @param aObject object
|
||||
* The object that the descriptor is generated for.
|
||||
*/
|
||||
_propertyDescriptor: function OA_propertyDescriptor(aObject) {
|
||||
let descriptor = {};
|
||||
@ -747,16 +829,19 @@ ObjectActor.prototype = {
|
||||
descriptor.enumerable = aObject.enumerable;
|
||||
if (aObject.value) {
|
||||
descriptor.writable = aObject.writable;
|
||||
descriptor.value = this.threadActor.valueGrip(aObject.value);
|
||||
descriptor.value = this.threadActor.createValueGrip(aObject.value);
|
||||
} else {
|
||||
descriptor.get = this.threadActor.valueGrip(aObject.get);
|
||||
descriptor.set = this.threadActor.valueGrip(aObject.set);
|
||||
descriptor.get = this.threadActor.createValueGrip(aObject.get);
|
||||
descriptor.set = this.threadActor.createValueGrip(aObject.set);
|
||||
}
|
||||
return descriptor;
|
||||
},
|
||||
|
||||
/**
|
||||
* Handle a protocol request to provide the source code of a function.
|
||||
*
|
||||
* @param aRequest object
|
||||
* The protocol request object.
|
||||
*/
|
||||
onDecompile: function OA_onDecompile(aRequest) {
|
||||
if (this.threadActor.state !== "paused") {
|
||||
@ -776,6 +861,9 @@ ObjectActor.prototype = {
|
||||
|
||||
/**
|
||||
* Handle a protocol request to provide the lexical scope of a function.
|
||||
*
|
||||
* @param aRequest object
|
||||
* The protocol request object.
|
||||
*/
|
||||
onScope: function OA_onScope(aRequest) {
|
||||
if (this.threadActor.state !== "paused") {
|
||||
@ -790,7 +878,7 @@ ObjectActor.prototype = {
|
||||
}
|
||||
|
||||
let packet = { name: this.obj.name || null };
|
||||
let envActor = this.threadActor.environmentActor(this.obj, this.registeredPool);
|
||||
let envActor = this.threadActor.createEnvironmentActor(this.obj, this.registeredPool);
|
||||
packet.scope = envActor ? envActor.grip() : envActor;
|
||||
|
||||
return packet;
|
||||
@ -798,6 +886,9 @@ ObjectActor.prototype = {
|
||||
|
||||
/**
|
||||
* Handle a protocol request to provide the name and parameters of a function.
|
||||
*
|
||||
* @param aRequest object
|
||||
* The protocol request object.
|
||||
*/
|
||||
onNameAndParameters: function OA_onNameAndParameters(aRequest) {
|
||||
if (this.threadActor.state !== "paused") {
|
||||
@ -814,6 +905,13 @@ ObjectActor.prototype = {
|
||||
parameters: this.obj.parameterNames };
|
||||
},
|
||||
|
||||
/**
|
||||
* Handle a protocol request to promote a pause-lifetime grip to a
|
||||
* thread-lifetime grip.
|
||||
*
|
||||
* @param aRequest object
|
||||
* The protocol request object.
|
||||
*/
|
||||
onThreadGrip: function OA_onThreadGrip(aRequest) {
|
||||
if (this.threadActor.state !== "paused") {
|
||||
return this.WRONG_STATE_RESPONSE;
|
||||
@ -822,6 +920,12 @@ ObjectActor.prototype = {
|
||||
return { threadGrip: this.threadActor.threadObjectGrip(this.obj) };
|
||||
},
|
||||
|
||||
/**
|
||||
* Handle a protocol request to release a thread-lifetime grip.
|
||||
*
|
||||
* @param aRequest object
|
||||
* The protocol request object.
|
||||
*/
|
||||
onRelease: function OA_onRelease(aRequest) {
|
||||
if (this.threadActor.state !== "paused") {
|
||||
return this.WRONG_STATE_RESPONSE;
|
||||
@ -850,6 +954,14 @@ ObjectActor.prototype.requestTypes = {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Creates an actor for the specified stack frame.
|
||||
*
|
||||
* @param aFrame Debugger.Frame
|
||||
* The debuggee frame.
|
||||
* @param aThreadActor ThreadActor
|
||||
* The parent thread actor for this frame.
|
||||
*/
|
||||
function FrameActor(aFrame, aThreadActor)
|
||||
{
|
||||
this.frame = aFrame;
|
||||
@ -871,23 +983,32 @@ FrameActor.prototype = {
|
||||
return this._frameLifetimePool;
|
||||
},
|
||||
|
||||
/**
|
||||
* Finalization handler that is called when the actor is being evicted from
|
||||
* the pool.
|
||||
*/
|
||||
disconnect: function FA_disconnect() {
|
||||
this.conn.removeActorPool(this._frameLifetimePool);
|
||||
this._frameLifetimePool = null;
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns a grip for this actor for returning in a protocol message.
|
||||
*/
|
||||
grip: function FA_grip() {
|
||||
let grip = { actor: this.actorID,
|
||||
type: this.frame.type };
|
||||
if (this.frame.type === "call") {
|
||||
grip.callee = this.threadActor.valueGrip(this.frame.callee);
|
||||
grip.callee = this.threadActor.createValueGrip(this.frame.callee);
|
||||
grip.calleeName = this.frame.callee.name;
|
||||
}
|
||||
|
||||
let envActor = this.threadActor.environmentActor(this.frame, this.frameLifetimePool);
|
||||
let envActor = this.threadActor
|
||||
.createEnvironmentActor(this.frame,
|
||||
this.frameLifetimePool);
|
||||
grip.environment = envActor ? envActor.grip() : envActor;
|
||||
grip["this"] = this.threadActor.valueGrip(this.frame["this"]);
|
||||
grip.arguments = this.args();
|
||||
grip["this"] = this.threadActor.createValueGrip(this.frame["this"]);
|
||||
grip.arguments = this._args();
|
||||
|
||||
if (!this.frame.older) {
|
||||
grip.oldest = true;
|
||||
@ -896,15 +1017,21 @@ FrameActor.prototype = {
|
||||
return grip;
|
||||
},
|
||||
|
||||
args: function FA_args() {
|
||||
_args: function FA__args() {
|
||||
if (!this.frame["arguments"]) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return [this.threadActor.valueGrip(arg)
|
||||
return [this.threadActor.createValueGrip(arg)
|
||||
for each (arg in this.frame["arguments"])];
|
||||
},
|
||||
|
||||
/**
|
||||
* Handle a protocol request to pop this frame from the stack.
|
||||
*
|
||||
* @param aRequest object
|
||||
* The protocol request object.
|
||||
*/
|
||||
onPop: function FA_onPop(aRequest) {
|
||||
return { error: "notImplemented",
|
||||
message: "Popping frames is not yet implemented." };
|
||||
@ -920,6 +1047,7 @@ FrameActor.prototype.requestTypes = {
|
||||
* Creates a BreakpointActor. BreakpointActors exist for the lifetime of their
|
||||
* containing thread and are responsible for deleting breakpoints, handling
|
||||
* breakpoint hits and associating breakpoints with scripts.
|
||||
*
|
||||
* @param Debugger.Script aScript
|
||||
* The script this breakpoint is set on.
|
||||
* @param ThreadActor aThreadActor
|
||||
@ -934,6 +1062,12 @@ function BreakpointActor(aScript, aThreadActor)
|
||||
BreakpointActor.prototype = {
|
||||
actorPrefix: "breakpoint",
|
||||
|
||||
/**
|
||||
* A function that the engine calls when a breakpoint has been hit.
|
||||
*
|
||||
* @param aFrame Debugger.Frame
|
||||
* The stack frame that contained the breakpoint.
|
||||
*/
|
||||
hit: function BA_hit(aFrame) {
|
||||
try {
|
||||
let packet = this.threadActor._paused(aFrame);
|
||||
@ -950,6 +1084,12 @@ BreakpointActor.prototype = {
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Handle a protocol request to remove this breakpoint.
|
||||
*
|
||||
* @param aRequest object
|
||||
* The protocol request object.
|
||||
*/
|
||||
onDelete: function BA_onDelete(aRequest) {
|
||||
this.threadActor.breakpointActorPool.removeActor(this.actorID);
|
||||
this.script.clearBreakpoint(this);
|
||||
@ -968,6 +1108,7 @@ BreakpointActor.prototype.requestTypes = {
|
||||
* Creates an EnvironmentActor. EnvironmentActors are responsible for listing
|
||||
* the bindings introduced by a lexical environment and assigning new values to
|
||||
* those identifier bindings.
|
||||
*
|
||||
* @param Debugger.Object aObject
|
||||
* The object whose lexical environment will be used to create the actor.
|
||||
* @param ThreadActor aThreadActor
|
||||
@ -982,6 +1123,9 @@ function EnvironmentActor(aObject, aThreadActor)
|
||||
EnvironmentActor.prototype = {
|
||||
actorPrefix: "environment",
|
||||
|
||||
/**
|
||||
* Returns a grip for this actor for returning in a protocol message.
|
||||
*/
|
||||
grip: function EA_grip() {
|
||||
// Debugger.Frame might be dead by the time we get here, which will cause
|
||||
// accessing its properties to throw.
|
||||
@ -991,18 +1135,20 @@ EnvironmentActor.prototype = {
|
||||
|
||||
let parent;
|
||||
if (this.obj.environment.parent) {
|
||||
parent = this.threadActor.environmentActor(this.obj.environment.parent, this.registeredPool);
|
||||
parent = this.threadActor
|
||||
.createEnvironmentActor(this.obj.environment.parent,
|
||||
this.registeredPool);
|
||||
}
|
||||
let grip = { actor: this.actorID,
|
||||
parent: parent ? parent.grip() : parent };
|
||||
|
||||
if (this.obj.environment.type == "object") {
|
||||
grip.type = "object"; // XXX: how can we tell if it's "with"?
|
||||
grip.object = this.threadActor.valueGrip(this.obj.environment.object);
|
||||
grip.object = this.threadActor.createValueGrip(this.obj.environment.object);
|
||||
} else {
|
||||
if (this.obj["class"] == "Function") {
|
||||
grip.type = "function";
|
||||
grip["function"] = this.threadActor.valueGrip(this.obj);
|
||||
grip["function"] = this.threadActor.createValueGrip(this.obj);
|
||||
grip.functionName = this.obj.name;
|
||||
} else {
|
||||
grip.type = "block";
|
||||
@ -1042,6 +1188,9 @@ EnvironmentActor.prototype = {
|
||||
/**
|
||||
* Handle a protocol request to change the value of a variable bound in this
|
||||
* lexical environment.
|
||||
*
|
||||
* @param aRequest object
|
||||
* The protocol request object.
|
||||
*/
|
||||
onAssign: function EA_onAssign(aRequest) {
|
||||
let desc = this.obj.environment.getVariableDescriptor(aRequest.name);
|
||||
@ -1069,6 +1218,9 @@ EnvironmentActor.prototype = {
|
||||
/**
|
||||
* Handle a protocol request to fully enumerate the bindings introduced by the
|
||||
* lexical environment.
|
||||
*
|
||||
* @param aRequest object
|
||||
* The protocol request object.
|
||||
*/
|
||||
onBindings: function EA_onBindings(aRequest) {
|
||||
return { from: this.actorID,
|
||||
|
@ -93,7 +93,7 @@ var DebuggerServer = {
|
||||
*/
|
||||
initTransport: function DH_initTransport() {
|
||||
if (this._transportInitialized) {
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
this._connections = {};
|
||||
@ -411,6 +411,12 @@ DebuggerServerConnection.prototype = {
|
||||
|
||||
// Transport hooks.
|
||||
|
||||
/**
|
||||
* Called by DebuggerTransport to dispatch incoming packets as appropriate.
|
||||
*
|
||||
* @param aPacket object
|
||||
* The incoming packet.
|
||||
*/
|
||||
onPacket: function DSC_onPacket(aPacket) {
|
||||
let actor = this.getActor(aPacket.to);
|
||||
if (!actor) {
|
||||
@ -448,7 +454,14 @@ DebuggerServerConnection.prototype = {
|
||||
this.transport.send(ret);
|
||||
},
|
||||
|
||||
onClosed: function DSC_onClosed() {
|
||||
/**
|
||||
* Called by DebuggerTransport when the underlying stream is closed.
|
||||
*
|
||||
* @param aStatus nsresult
|
||||
* The status code that corresponds to the reason for closing
|
||||
* the stream.
|
||||
*/
|
||||
onClosed: function DSC_onClosed(aStatus) {
|
||||
dumpn("Cleaning up connection.");
|
||||
|
||||
this._actorPool.cleanup();
|
||||
|
@ -60,6 +60,7 @@ function loadSubScript(aURL)
|
||||
Cu.import("resource:///modules/devtools/dbg-client.jsm");
|
||||
|
||||
// Load the debugging server in a sandbox with its own compartment.
|
||||
// Note that this is slated for elimination in bug 703718.
|
||||
var systemPrincipal = Cc["@mozilla.org/systemprincipal;1"]
|
||||
.createInstance(Ci.nsIPrincipal);
|
||||
|
||||
|
@ -14,7 +14,7 @@ function run_test()
|
||||
|
||||
let transport = DebuggerServer.connectPipe();
|
||||
gClient = new DebuggerClient(transport);
|
||||
gClient.ready(function(aType, aTraits) {
|
||||
gClient.connect(function(aType, aTraits) {
|
||||
getTestGlobalContext(gClient, "test-1", function(aContext) {
|
||||
test_attach(aContext);
|
||||
});
|
||||
|
@ -14,7 +14,7 @@ function run_test()
|
||||
initTestDebuggerServer();
|
||||
gDebuggee = addTestGlobal("test-stack");
|
||||
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
||||
gClient.ready(function () {
|
||||
gClient.connect(function () {
|
||||
attachTestGlobalClientAndResume(gClient, "test-stack", function (aResponse, aThreadClient) {
|
||||
gThreadClient = aThreadClient;
|
||||
test_simple_breakpoint();
|
||||
|
@ -29,7 +29,7 @@ function run_test()
|
||||
do_check_true(false);
|
||||
});
|
||||
});
|
||||
gClient.ready();
|
||||
gClient.connect();
|
||||
|
||||
do_test_pending();
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ function run_test()
|
||||
|
||||
let transport = DebuggerServer.connectPipe();
|
||||
gClient = new DebuggerClient(transport);
|
||||
gClient.ready(function(aType, aTraits) {
|
||||
gClient.connect(function(aType, aTraits) {
|
||||
getTestGlobalContext(gClient, "test-1", function(aContext) {
|
||||
test_attach(aContext);
|
||||
});
|
||||
|
@ -76,7 +76,7 @@ function test_pipe_conn()
|
||||
do_check_eq(aPacket.from, "root");
|
||||
transport.close();
|
||||
},
|
||||
onClosed: function(aPacket) {
|
||||
onClosed: function(aStatus) {
|
||||
run_next_test();
|
||||
}
|
||||
};
|
||||
|
@ -14,7 +14,7 @@ function run_test()
|
||||
initTestDebuggerServer();
|
||||
gDebuggee = addTestGlobal("test-stack");
|
||||
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
||||
gClient.ready(function() {
|
||||
gClient.connect(function() {
|
||||
attachTestGlobalClientAndResume(gClient, "test-stack", function(aResponse, aThreadClient) {
|
||||
gThreadClient = aThreadClient;
|
||||
test_simple_eval();
|
||||
|
@ -14,7 +14,7 @@ function run_test()
|
||||
initTestDebuggerServer();
|
||||
gDebuggee = addTestGlobal("test-stack");
|
||||
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
||||
gClient.ready(function() {
|
||||
gClient.connect(function() {
|
||||
attachTestGlobalClientAndResume(gClient, "test-stack", function(aResponse, aThreadClient) {
|
||||
gThreadClient = aThreadClient;
|
||||
test_throw_eval();
|
||||
|
@ -14,7 +14,7 @@ function run_test()
|
||||
initTestDebuggerServer();
|
||||
gDebuggee = addTestGlobal("test-stack");
|
||||
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
||||
gClient.ready(function() {
|
||||
gClient.connect(function() {
|
||||
attachTestGlobalClientAndResume(gClient, "test-stack", function(aResponse, aThreadClient) {
|
||||
gThreadClient = aThreadClient;
|
||||
test_syntax_error_eval();
|
||||
|
@ -14,7 +14,7 @@ function run_test()
|
||||
initTestDebuggerServer();
|
||||
gDebuggee = addTestGlobal("test-stack");
|
||||
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
||||
gClient.ready(function() {
|
||||
gClient.connect(function() {
|
||||
attachTestGlobalClientAndResume(gClient, "test-stack", function(aResponse, aThreadClient) {
|
||||
gThreadClient = aThreadClient;
|
||||
test_syntax_error_eval();
|
||||
@ -27,7 +27,7 @@ function test_syntax_error_eval()
|
||||
{
|
||||
gThreadClient.addOneTimeListener("paused", function(aEvent, aPacket) {
|
||||
|
||||
gThreadClient.frames(0, 2, function(aResponse) {
|
||||
gThreadClient.getFrames(0, 2, function(aResponse) {
|
||||
let frame0 = aResponse.frames[0];
|
||||
let frame1 = aResponse.frames[1];
|
||||
|
||||
|
@ -14,7 +14,7 @@ function run_test()
|
||||
initTestDebuggerServer();
|
||||
gDebuggee = addTestGlobal("test-stack");
|
||||
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
||||
gClient.ready(function() {
|
||||
gClient.connect(function() {
|
||||
attachTestGlobalClientAndResume(gClient, "test-stack", function(aResponse, aThreadClient) {
|
||||
gThreadClient = aThreadClient;
|
||||
test_syntax_error_eval();
|
||||
|
@ -14,7 +14,7 @@ function run_test()
|
||||
initTestDebuggerServer();
|
||||
gDebuggee = addTestGlobal("test-stack");
|
||||
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
||||
gClient.ready(function() {
|
||||
gClient.connect(function() {
|
||||
attachTestGlobalClientAndResume(gClient, "test-stack", function(aResponse, aThreadClient) {
|
||||
gThreadClient = aThreadClient;
|
||||
test_pause_frame();
|
||||
|
@ -14,7 +14,7 @@ function run_test()
|
||||
initTestDebuggerServer();
|
||||
gDebuggee = addTestGlobal("test-stack");
|
||||
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
||||
gClient.ready(function() {
|
||||
gClient.connect(function() {
|
||||
attachTestGlobalClientAndResume(gClient, "test-stack", function(aResponse, aThreadClient) {
|
||||
gThreadClient = aThreadClient;
|
||||
test_pause_frame();
|
||||
|
@ -14,7 +14,7 @@ function run_test()
|
||||
initTestDebuggerServer();
|
||||
gDebuggee = addTestGlobal("test-stack");
|
||||
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
||||
gClient.ready(function() {
|
||||
gClient.connect(function() {
|
||||
attachTestGlobalClientAndResume(gClient, "test-stack", function(aResponse, aThreadClient) {
|
||||
gThreadClient = aThreadClient;
|
||||
test_pause_frame();
|
||||
@ -45,4 +45,4 @@ function test_pause_frame()
|
||||
debugger;
|
||||
")"
|
||||
} + ")()");
|
||||
}
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ function run_test()
|
||||
initTestDebuggerServer();
|
||||
gDebuggee = addTestGlobal("test-stack");
|
||||
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
||||
gClient.ready(function() {
|
||||
gClient.connect(function() {
|
||||
attachTestGlobalClientAndResume(gClient, "test-stack", function(aResponse, aThreadClient) {
|
||||
gThreadClient = aThreadClient;
|
||||
test_pause_frame();
|
||||
@ -51,7 +51,7 @@ function test_frame_slice() {
|
||||
}
|
||||
|
||||
let test = gSliceTests.shift();
|
||||
gThreadClient.frames(test.start, test.count, function(aResponse) {
|
||||
gThreadClient.getFrames(test.start, test.count, function(aResponse) {
|
||||
var testFrames = gFrames.slice(test.start, test.count ? test.start + test.count : undefined);
|
||||
do_check_eq(testFrames.length, aResponse.frames.length);
|
||||
for (var i = 0; i < testFrames.length; i++) {
|
||||
@ -89,4 +89,4 @@ function test_pause_frame()
|
||||
depth1();
|
||||
")"
|
||||
} + ")()");
|
||||
}
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ function run_test()
|
||||
initTestDebuggerServer();
|
||||
gDebuggee = addTestGlobal("test-stack");
|
||||
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
||||
gClient.ready(function() {
|
||||
gClient.connect(function() {
|
||||
attachTestGlobalClientAndResume(gClient, "test-stack", function(aResponse, aThreadClient) {
|
||||
gThreadClient = aThreadClient;
|
||||
test_pause_frame();
|
||||
@ -31,7 +31,7 @@ function test_frame_slice() {
|
||||
}
|
||||
|
||||
let test = gSliceTests.shift();
|
||||
gThreadClient.frames(test.start, test.count, function(aResponse) {
|
||||
gThreadClient.getFrames(test.start, test.count, function(aResponse) {
|
||||
var testFrames = gFrames.slice(test.start, test.count ? test.start + test.count : undefined);
|
||||
do_check_eq(testFrames.length, aResponse.frames.length);
|
||||
for (var i = 0; i < testFrames.length; i++) {
|
||||
@ -53,7 +53,7 @@ function test_frame_slice() {
|
||||
function test_pause_frame()
|
||||
{
|
||||
gThreadClient.addOneTimeListener("paused", function(aEvent, aPacket1) {
|
||||
gThreadClient.frames(0, null, function(aFrameResponse) {
|
||||
gThreadClient.getFrames(0, null, function(aFrameResponse) {
|
||||
do_check_eq(aFrameResponse.frames.length, 5);
|
||||
// Now wait for the next pause, after which the three
|
||||
// youngest actors should be popped..
|
||||
@ -87,4 +87,4 @@ function test_pause_frame()
|
||||
debugger;
|
||||
")"
|
||||
} + ")()");
|
||||
}
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ function run_test()
|
||||
initTestDebuggerServer();
|
||||
gDebuggee = addTestGlobal("test-stack");
|
||||
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
||||
gClient.ready(function() {
|
||||
gClient.connect(function() {
|
||||
attachTestGlobalClientAndResume(gClient, "test-stack", function(aResponse, aThreadClient) {
|
||||
gThreadClient = aThreadClient;
|
||||
test_pause_frame();
|
||||
|
@ -10,7 +10,7 @@ function run_test()
|
||||
initTestDebuggerServer();
|
||||
gDebuggee = addTestGlobal("test-stack");
|
||||
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
||||
gClient.ready(function() {
|
||||
gClient.connect(function() {
|
||||
attachTestGlobalClientAndResume(gClient, "test-stack", function(aResponse, aThreadClient) {
|
||||
gThreadClient = aThreadClient;
|
||||
test_pause_frame();
|
||||
|
@ -10,7 +10,7 @@ function run_test()
|
||||
initTestDebuggerServer();
|
||||
gDebuggee = addTestGlobal("test-stack");
|
||||
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
||||
gClient.ready(function() {
|
||||
gClient.connect(function() {
|
||||
attachTestGlobalClientAndResume(gClient, "test-stack", function(aResponse, aThreadClient) {
|
||||
gThreadClient = aThreadClient;
|
||||
test_pause_frame();
|
||||
|
@ -14,7 +14,7 @@ function run_test()
|
||||
}.toString());
|
||||
|
||||
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
||||
gClient.ready(function() {
|
||||
gClient.connect(function() {
|
||||
attachTestGlobalClientAndResume(gClient, "test-grips", function(aResponse, aThreadClient) {
|
||||
gThreadClient = aThreadClient;
|
||||
test_named_function();
|
||||
@ -32,7 +32,7 @@ function test_named_function()
|
||||
// No name for an anonymous function.
|
||||
|
||||
let objClient = gThreadClient.pauseGrip(args[0]);
|
||||
objClient.nameAndParameters(function(aResponse) {
|
||||
objClient.getSignature(function(aResponse) {
|
||||
do_check_eq(aResponse.name, "stopMe");
|
||||
do_check_eq(aResponse.parameters.length, 1);
|
||||
do_check_eq(aResponse.parameters[0], "arg1");
|
||||
@ -55,7 +55,7 @@ function test_anon_function() {
|
||||
// No name for an anonymous function.
|
||||
|
||||
let objClient = gThreadClient.pauseGrip(args[0]);
|
||||
objClient.nameAndParameters(function(aResponse) {
|
||||
objClient.getSignature(function(aResponse) {
|
||||
do_check_eq(aResponse.name, null);
|
||||
do_check_eq(aResponse.parameters.length, 3);
|
||||
do_check_eq(aResponse.parameters[0], "foo");
|
||||
|
@ -14,7 +14,7 @@ function run_test()
|
||||
initTestDebuggerServer();
|
||||
gDebuggee = addTestGlobal("test-stack");
|
||||
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
||||
gClient.ready(function () {
|
||||
gClient.connect(function () {
|
||||
attachTestGlobalClientAndResume(gClient, "test-stack", function (aResponse, aThreadClient) {
|
||||
gThreadClient = aThreadClient;
|
||||
test_simple_listscripts();
|
||||
@ -27,7 +27,7 @@ function test_simple_listscripts()
|
||||
{
|
||||
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
||||
var path = getFilePath('test_listscripts-01.js');
|
||||
gThreadClient.scripts(function (aResponse) {
|
||||
gThreadClient.getScripts(function (aResponse) {
|
||||
// Check the return value.
|
||||
do_check_eq(aResponse.scripts[0].url, path);
|
||||
do_check_eq(aResponse.scripts[0].startLine, 41);
|
||||
|
@ -14,7 +14,7 @@ function run_test()
|
||||
}.toString());
|
||||
|
||||
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
||||
gClient.ready(function() {
|
||||
gClient.connect(function() {
|
||||
attachTestGlobalClientAndResume(gClient, "test-grips", function(aResponse, aThreadClient) {
|
||||
gThreadClient = aThreadClient;
|
||||
test_object_grip();
|
||||
@ -31,7 +31,7 @@ function test_object_grip()
|
||||
do_check_eq(args[0]["class"], "Object");
|
||||
|
||||
let objClient = gThreadClient.pauseGrip(args[0]);
|
||||
objClient.ownPropertyNames(function(aResponse) {
|
||||
objClient.getOwnPropertyNames(function(aResponse) {
|
||||
do_check_eq(aResponse.ownPropertyNames.length, 3);
|
||||
do_check_eq(aResponse.ownPropertyNames[0], "a");
|
||||
do_check_eq(aResponse.ownPropertyNames[1], "b");
|
||||
|
@ -14,7 +14,7 @@ function run_test()
|
||||
}.toString());
|
||||
|
||||
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
||||
gClient.ready(function() {
|
||||
gClient.connect(function() {
|
||||
attachTestGlobalClientAndResume(gClient, "test-grips", function(aResponse, aThreadClient) {
|
||||
gThreadClient = aThreadClient;
|
||||
test_object_grip();
|
||||
@ -31,11 +31,11 @@ function test_object_grip()
|
||||
do_check_eq(args[0]["class"], "Object");
|
||||
|
||||
let objClient = gThreadClient.pauseGrip(args[0]);
|
||||
objClient.prototype(function(aResponse) {
|
||||
objClient.getPrototype(function(aResponse) {
|
||||
do_check_true(aResponse.prototype != undefined);
|
||||
|
||||
let protoClient = gThreadClient.pauseGrip(aResponse.prototype);
|
||||
protoClient.ownPropertyNames(function(aResponse) {
|
||||
protoClient.getOwnPropertyNames(function(aResponse) {
|
||||
do_check_eq(aResponse.ownPropertyNames.length, 2);
|
||||
do_check_eq(aResponse.ownPropertyNames[0], "b");
|
||||
do_check_eq(aResponse.ownPropertyNames[1], "c");
|
||||
|
@ -14,7 +14,7 @@ function run_test()
|
||||
}.toString());
|
||||
|
||||
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
||||
gClient.ready(function() {
|
||||
gClient.connect(function() {
|
||||
attachTestGlobalClientAndResume(gClient, "test-grips", function(aResponse, aThreadClient) {
|
||||
gThreadClient = aThreadClient;
|
||||
test_object_grip();
|
||||
@ -31,19 +31,19 @@ function test_object_grip()
|
||||
do_check_eq(args[0]["class"], "Object");
|
||||
|
||||
let objClient = gThreadClient.pauseGrip(args[0]);
|
||||
objClient.property("x", function(aResponse) {
|
||||
objClient.getProperty("x", function(aResponse) {
|
||||
do_check_eq(aResponse.descriptor.configurable, true);
|
||||
do_check_eq(aResponse.descriptor.enumerable, true);
|
||||
do_check_eq(aResponse.descriptor.writable, true);
|
||||
do_check_eq(aResponse.descriptor.value, 10);
|
||||
|
||||
objClient.property("y", function(aResponse) {
|
||||
objClient.getProperty("y", function(aResponse) {
|
||||
do_check_eq(aResponse.descriptor.configurable, true);
|
||||
do_check_eq(aResponse.descriptor.enumerable, true);
|
||||
do_check_eq(aResponse.descriptor.writable, true);
|
||||
do_check_eq(aResponse.descriptor.value, "kaiju");
|
||||
|
||||
objClient.property("a", function(aResponse) {
|
||||
objClient.getProperty("a", function(aResponse) {
|
||||
do_check_eq(aResponse.descriptor.configurable, true);
|
||||
do_check_eq(aResponse.descriptor.enumerable, true);
|
||||
do_check_eq(aResponse.descriptor.get.type, "object");
|
||||
|
@ -14,7 +14,7 @@ function run_test()
|
||||
}.toString());
|
||||
|
||||
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
||||
gClient.ready(function() {
|
||||
gClient.connect(function() {
|
||||
attachTestGlobalClientAndResume(gClient, "test-grips", function(aResponse, aThreadClient) {
|
||||
gThreadClient = aThreadClient;
|
||||
test_object_grip();
|
||||
@ -31,7 +31,7 @@ function test_object_grip()
|
||||
do_check_eq(args[0]["class"], "Object");
|
||||
|
||||
let objClient = gThreadClient.pauseGrip(args[0]);
|
||||
objClient.prototypeAndProperties(function(aResponse) {
|
||||
objClient.getPrototypeAndProperties(function(aResponse) {
|
||||
do_check_eq(aResponse.ownProperties.x.configurable, true);
|
||||
do_check_eq(aResponse.ownProperties.x.enumerable, true);
|
||||
do_check_eq(aResponse.ownProperties.x.writable, true);
|
||||
@ -51,7 +51,7 @@ function test_object_grip()
|
||||
do_check_true(aResponse.prototype != undefined);
|
||||
|
||||
let protoClient = gThreadClient.pauseGrip(aResponse.prototype);
|
||||
protoClient.ownPropertyNames(function(aResponse) {
|
||||
protoClient.getOwnPropertyNames(function(aResponse) {
|
||||
do_check_true(aResponse.ownPropertyNames.toString != undefined);
|
||||
|
||||
gThreadClient.resume(function() {
|
||||
|
@ -14,7 +14,7 @@ function run_test()
|
||||
initTestDebuggerServer();
|
||||
gDebuggee = addTestGlobal("test-stack");
|
||||
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
||||
gClient.ready(function() {
|
||||
gClient.connect(function() {
|
||||
attachTestGlobalClientAndResume(gClient, "test-stack", function(aResponse, aThreadClient) {
|
||||
gThreadClient = aThreadClient;
|
||||
test_pause_frame();
|
||||
|
@ -14,7 +14,7 @@ function run_test()
|
||||
initTestDebuggerServer();
|
||||
gDebuggee = addTestGlobal("test-stack");
|
||||
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
||||
gClient.ready(function() {
|
||||
gClient.connect(function() {
|
||||
attachTestGlobalClientAndResume(gClient, "test-stack", function(aResponse, aThreadClient) {
|
||||
gThreadClient = aThreadClient;
|
||||
test_pause_frame();
|
||||
|
@ -14,7 +14,7 @@ function run_test()
|
||||
initTestDebuggerServer();
|
||||
gDebuggee = addTestGlobal("test-stack");
|
||||
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
||||
gClient.ready(function() {
|
||||
gClient.connect(function() {
|
||||
attachTestGlobalClientAndResume(gClient, "test-stack", function(aResponse, aThreadClient) {
|
||||
gThreadClient = aThreadClient;
|
||||
test_pause_frame();
|
||||
|
@ -15,7 +15,7 @@ function run_test()
|
||||
initTestDebuggerServer();
|
||||
gDebuggee = addTestGlobal("test-stack");
|
||||
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
||||
gClient.ready(function() {
|
||||
gClient.connect(function() {
|
||||
attachTestGlobalClientAndResume(gClient, "test-stack", function(aResponse, aThreadClient) {
|
||||
gThreadClient = aThreadClient;
|
||||
test_pause_frame();
|
||||
@ -30,7 +30,7 @@ function test_pause_frame()
|
||||
let args = aPacket.frame["arguments"];
|
||||
let objActor1 = args[0].actor;
|
||||
|
||||
gThreadClient.frames(0, 1, function(aResponse) {
|
||||
gThreadClient.getFrames(0, 1, function(aResponse) {
|
||||
let frame = aResponse.frames[0];
|
||||
dump(JSON.stringify(frame));
|
||||
do_check_eq(objActor1, frame.arguments[0].actor);
|
||||
|
@ -14,7 +14,7 @@ function run_test()
|
||||
initTestDebuggerServer();
|
||||
gDebuggee = addTestGlobal("test-grips");
|
||||
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
||||
gClient.ready(function() {
|
||||
gClient.connect(function() {
|
||||
attachTestGlobalClientAndResume(gClient, "test-grips", function(aResponse, aThreadClient) {
|
||||
gThreadClient = aThreadClient;
|
||||
test_thread_lifetime();
|
||||
@ -60,4 +60,4 @@ function test_thread_lifetime()
|
||||
stopMe({obj: true});
|
||||
")"
|
||||
} + ")()");
|
||||
}
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ function run_test()
|
||||
initTestDebuggerServer();
|
||||
gDebuggee = addTestGlobal("test-grips");
|
||||
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
||||
gClient.ready(function() {
|
||||
gClient.connect(function() {
|
||||
attachTestGlobalClientAndResume(gClient, "test-grips", function(aResponse, aThreadClient) {
|
||||
gThreadClient = aThreadClient;
|
||||
test_thread_lifetime();
|
||||
@ -54,4 +54,4 @@ function test_thread_lifetime()
|
||||
stopMe({obj: true});
|
||||
")"
|
||||
} + ")()");
|
||||
}
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ function run_test()
|
||||
initTestDebuggerServer();
|
||||
gDebuggee = addTestGlobal("test-grips");
|
||||
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
||||
gClient.ready(function() {
|
||||
gClient.connect(function() {
|
||||
attachTestGlobalClientAndResume(gClient, "test-grips", function(aResponse, aThreadClient) {
|
||||
gThreadClient = aThreadClient;
|
||||
test_thread_lifetime();
|
||||
|
@ -15,7 +15,7 @@ function run_test()
|
||||
initTestDebuggerServer();
|
||||
gDebuggee = addTestGlobal("test-grips");
|
||||
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
||||
gClient.ready(function() {
|
||||
gClient.connect(function() {
|
||||
attachTestGlobalClientAndResume(gClient, "test-grips", function (aResponse, aThreadClient) {
|
||||
gThreadClient = aThreadClient;
|
||||
test_thread_lifetime();
|
||||
@ -50,4 +50,4 @@ function test_thread_lifetime()
|
||||
stopMe({obj: true});
|
||||
")"
|
||||
} + ")()");
|
||||
}
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ function run_test()
|
||||
initTestDebuggerServer();
|
||||
gDebuggee = addTestGlobal("test-grips");
|
||||
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
||||
gClient.ready(function() {
|
||||
gClient.connect(function() {
|
||||
attachTestGlobalClientAndResume(gClient, "test-grips", function(aResponse, aThreadClient) {
|
||||
gThreadClient = aThreadClient;
|
||||
test_thread_lifetime();
|
||||
|
Loading…
Reference in New Issue
Block a user