gecko/toolkit/devtools/server/tests/unit/test_dbgactor.js
Dave Camp f6c774eb5e Bug 872091 - Rename files in the debugger server. r=past,r=jimb
--HG--
rename : toolkit/devtools/debugger/Makefile.in => toolkit/devtools/client/Makefile.in
rename : toolkit/devtools/debugger/dbg-client.jsm => toolkit/devtools/client/dbg-client.jsm
rename : toolkit/devtools/debugger/moz.build => toolkit/devtools/client/moz.build
rename : toolkit/devtools/debugger/Makefile.in => toolkit/devtools/server/Makefile.in
rename : toolkit/devtools/gcli/dbg-gcli-actors.js => toolkit/devtools/server/actors/gcli.js
rename : toolkit/devtools/debugger/server/dbg-profiler-actors.js => toolkit/devtools/server/actors/profiler.js
rename : toolkit/devtools/debugger/server/dbg-script-actors.js => toolkit/devtools/server/actors/script.js
rename : toolkit/devtools/styleeditor/dbg-styleeditor-actors.js => toolkit/devtools/server/actors/styleeditor.js
rename : toolkit/devtools/debugger/server/dbg-browser-actors.js => toolkit/devtools/server/actors/webbrowser.js
rename : toolkit/devtools/webconsole/dbg-webconsole-actors.js => toolkit/devtools/server/actors/webconsole.js
rename : toolkit/devtools/debugger/server/dbg-server.jsm => toolkit/devtools/server/dbg-server.jsm
rename : toolkit/devtools/debugger/server/dbg-server.js => toolkit/devtools/server/main.js
rename : toolkit/devtools/debugger/moz.build => toolkit/devtools/server/moz.build
rename : toolkit/devtools/debugger/nsIJSInspector.idl => toolkit/devtools/server/nsIJSInspector.idl
rename : toolkit/devtools/debugger/nsJSInspector.cpp => toolkit/devtools/server/nsJSInspector.cpp
rename : toolkit/devtools/debugger/nsJSInspector.h => toolkit/devtools/server/nsJSInspector.h
rename : toolkit/devtools/debugger/tests/mochitest/Makefile.in => toolkit/devtools/server/tests/mochitest/Makefile.in
rename : toolkit/devtools/debugger/tests/mochitest/moz.build => toolkit/devtools/server/tests/mochitest/moz.build
rename : toolkit/devtools/debugger/tests/mochitest/nonchrome_unsafeDereference.html => toolkit/devtools/server/tests/mochitest/nonchrome_unsafeDereference.html
rename : toolkit/devtools/debugger/tests/mochitest/test_unsafeDereference.html => toolkit/devtools/server/tests/mochitest/test_unsafeDereference.html
rename : toolkit/devtools/debugger/tests/moz.build => toolkit/devtools/server/tests/moz.build
rename : toolkit/devtools/debugger/tests/unit/head_dbg.js => toolkit/devtools/server/tests/unit/head_dbg.js
rename : toolkit/devtools/debugger/tests/unit/post_init_global_actors.js => toolkit/devtools/server/tests/unit/post_init_global_actors.js
rename : toolkit/devtools/debugger/tests/unit/post_init_tab_actors.js => toolkit/devtools/server/tests/unit/post_init_tab_actors.js
rename : toolkit/devtools/debugger/tests/unit/pre_init_global_actors.js => toolkit/devtools/server/tests/unit/pre_init_global_actors.js
rename : toolkit/devtools/debugger/tests/unit/pre_init_tab_actors.js => toolkit/devtools/server/tests/unit/pre_init_tab_actors.js
rename : toolkit/devtools/debugger/tests/unit/source-map-data/sourcemapped.coffee => toolkit/devtools/server/tests/unit/source-map-data/sourcemapped.coffee
rename : toolkit/devtools/debugger/tests/unit/source-map-data/sourcemapped.map => toolkit/devtools/server/tests/unit/source-map-data/sourcemapped.map
rename : toolkit/devtools/debugger/tests/unit/sourcemapped.js => toolkit/devtools/server/tests/unit/sourcemapped.js
rename : toolkit/devtools/debugger/tests/unit/test_add_actors.js => toolkit/devtools/server/tests/unit/test_add_actors.js
rename : toolkit/devtools/debugger/tests/unit/test_attach.js => toolkit/devtools/server/tests/unit/test_attach.js
rename : toolkit/devtools/debugger/tests/unit/test_breakpoint-01.js => toolkit/devtools/server/tests/unit/test_breakpoint-01.js
rename : toolkit/devtools/debugger/tests/unit/test_breakpoint-02.js => toolkit/devtools/server/tests/unit/test_breakpoint-02.js
rename : toolkit/devtools/debugger/tests/unit/test_breakpoint-03.js => toolkit/devtools/server/tests/unit/test_breakpoint-03.js
rename : toolkit/devtools/debugger/tests/unit/test_breakpoint-04.js => toolkit/devtools/server/tests/unit/test_breakpoint-04.js
rename : toolkit/devtools/debugger/tests/unit/test_breakpoint-05.js => toolkit/devtools/server/tests/unit/test_breakpoint-05.js
rename : toolkit/devtools/debugger/tests/unit/test_breakpoint-06.js => toolkit/devtools/server/tests/unit/test_breakpoint-06.js
rename : toolkit/devtools/debugger/tests/unit/test_breakpoint-07.js => toolkit/devtools/server/tests/unit/test_breakpoint-07.js
rename : toolkit/devtools/debugger/tests/unit/test_breakpoint-08.js => toolkit/devtools/server/tests/unit/test_breakpoint-08.js
rename : toolkit/devtools/debugger/tests/unit/test_breakpoint-09.js => toolkit/devtools/server/tests/unit/test_breakpoint-09.js
rename : toolkit/devtools/debugger/tests/unit/test_breakpoint-10.js => toolkit/devtools/server/tests/unit/test_breakpoint-10.js
rename : toolkit/devtools/debugger/tests/unit/test_breakpoint-11.js => toolkit/devtools/server/tests/unit/test_breakpoint-11.js
rename : toolkit/devtools/debugger/tests/unit/test_breakpoint-12.js => toolkit/devtools/server/tests/unit/test_breakpoint-12.js
rename : toolkit/devtools/debugger/tests/unit/test_breakpointstore.js => toolkit/devtools/server/tests/unit/test_breakpointstore.js
rename : toolkit/devtools/debugger/tests/unit/test_dbgactor.js => toolkit/devtools/server/tests/unit/test_dbgactor.js
rename : toolkit/devtools/debugger/tests/unit/test_dbgclient_debuggerstatement.js => toolkit/devtools/server/tests/unit/test_dbgclient_debuggerstatement.js
rename : toolkit/devtools/debugger/tests/unit/test_dbgglobal.js => toolkit/devtools/server/tests/unit/test_dbgglobal.js
rename : toolkit/devtools/debugger/tests/unit/test_dbgsocket.js => toolkit/devtools/server/tests/unit/test_dbgsocket.js
rename : toolkit/devtools/debugger/tests/unit/test_eval-01.js => toolkit/devtools/server/tests/unit/test_eval-01.js
rename : toolkit/devtools/debugger/tests/unit/test_eval-02.js => toolkit/devtools/server/tests/unit/test_eval-02.js
rename : toolkit/devtools/debugger/tests/unit/test_eval-03.js => toolkit/devtools/server/tests/unit/test_eval-03.js
rename : toolkit/devtools/debugger/tests/unit/test_eval-04.js => toolkit/devtools/server/tests/unit/test_eval-04.js
rename : toolkit/devtools/debugger/tests/unit/test_eval-05.js => toolkit/devtools/server/tests/unit/test_eval-05.js
rename : toolkit/devtools/debugger/tests/unit/test_frameactor-01.js => toolkit/devtools/server/tests/unit/test_frameactor-01.js
rename : toolkit/devtools/debugger/tests/unit/test_frameactor-02.js => toolkit/devtools/server/tests/unit/test_frameactor-02.js
rename : toolkit/devtools/debugger/tests/unit/test_frameactor-03.js => toolkit/devtools/server/tests/unit/test_frameactor-03.js
rename : toolkit/devtools/debugger/tests/unit/test_frameactor-04.js => toolkit/devtools/server/tests/unit/test_frameactor-04.js
rename : toolkit/devtools/debugger/tests/unit/test_frameactor-05.js => toolkit/devtools/server/tests/unit/test_frameactor-05.js
rename : toolkit/devtools/debugger/tests/unit/test_framearguments-01.js => toolkit/devtools/server/tests/unit/test_framearguments-01.js
rename : toolkit/devtools/debugger/tests/unit/test_framebindings-01.js => toolkit/devtools/server/tests/unit/test_framebindings-01.js
rename : toolkit/devtools/debugger/tests/unit/test_framebindings-02.js => toolkit/devtools/server/tests/unit/test_framebindings-02.js
rename : toolkit/devtools/debugger/tests/unit/test_framebindings-03.js => toolkit/devtools/server/tests/unit/test_framebindings-03.js
rename : toolkit/devtools/debugger/tests/unit/test_framebindings-04.js => toolkit/devtools/server/tests/unit/test_framebindings-04.js
rename : toolkit/devtools/debugger/tests/unit/test_framebindings-05.js => toolkit/devtools/server/tests/unit/test_framebindings-05.js
rename : toolkit/devtools/debugger/tests/unit/test_framebindings-06.js => toolkit/devtools/server/tests/unit/test_framebindings-06.js
rename : toolkit/devtools/debugger/tests/unit/test_frameclient-01.js => toolkit/devtools/server/tests/unit/test_frameclient-01.js
rename : toolkit/devtools/debugger/tests/unit/test_frameclient-02.js => toolkit/devtools/server/tests/unit/test_frameclient-02.js
rename : toolkit/devtools/debugger/tests/unit/test_functiongrips-01.js => toolkit/devtools/server/tests/unit/test_functiongrips-01.js
rename : toolkit/devtools/debugger/tests/unit/test_getyoungestframe.js => toolkit/devtools/server/tests/unit/test_getyoungestframe.js
rename : toolkit/devtools/debugger/tests/unit/test_interrupt.js => toolkit/devtools/server/tests/unit/test_interrupt.js
rename : toolkit/devtools/debugger/tests/unit/test_listsources-01.js => toolkit/devtools/server/tests/unit/test_listsources-01.js
rename : toolkit/devtools/debugger/tests/unit/test_listsources-02.js => toolkit/devtools/server/tests/unit/test_listsources-02.js
rename : toolkit/devtools/debugger/tests/unit/test_listsources-03.js => toolkit/devtools/server/tests/unit/test_listsources-03.js
rename : toolkit/devtools/debugger/tests/unit/test_longstringactor.js => toolkit/devtools/server/tests/unit/test_longstringactor.js
rename : toolkit/devtools/debugger/tests/unit/test_longstringgrips-01.js => toolkit/devtools/server/tests/unit/test_longstringgrips-01.js
rename : toolkit/devtools/debugger/tests/unit/test_longstringgrips-02.js => toolkit/devtools/server/tests/unit/test_longstringgrips-02.js
rename : toolkit/devtools/debugger/tests/unit/test_nativewrappers.js => toolkit/devtools/server/tests/unit/test_nativewrappers.js
rename : toolkit/devtools/debugger/tests/unit/test_new_source-01.js => toolkit/devtools/server/tests/unit/test_new_source-01.js
rename : toolkit/devtools/debugger/tests/unit/test_nsjsinspector.js => toolkit/devtools/server/tests/unit/test_nsjsinspector.js
rename : toolkit/devtools/debugger/tests/unit/test_objectgrips-01.js => toolkit/devtools/server/tests/unit/test_objectgrips-01.js
rename : toolkit/devtools/debugger/tests/unit/test_objectgrips-02.js => toolkit/devtools/server/tests/unit/test_objectgrips-02.js
rename : toolkit/devtools/debugger/tests/unit/test_objectgrips-03.js => toolkit/devtools/server/tests/unit/test_objectgrips-03.js
rename : toolkit/devtools/debugger/tests/unit/test_objectgrips-04.js => toolkit/devtools/server/tests/unit/test_objectgrips-04.js
rename : toolkit/devtools/debugger/tests/unit/test_pause_exceptions-01.js => toolkit/devtools/server/tests/unit/test_pause_exceptions-01.js
rename : toolkit/devtools/debugger/tests/unit/test_pause_exceptions-02.js => toolkit/devtools/server/tests/unit/test_pause_exceptions-02.js
rename : toolkit/devtools/debugger/tests/unit/test_pauselifetime-01.js => toolkit/devtools/server/tests/unit/test_pauselifetime-01.js
rename : toolkit/devtools/debugger/tests/unit/test_pauselifetime-02.js => toolkit/devtools/server/tests/unit/test_pauselifetime-02.js
rename : toolkit/devtools/debugger/tests/unit/test_pauselifetime-03.js => toolkit/devtools/server/tests/unit/test_pauselifetime-03.js
rename : toolkit/devtools/debugger/tests/unit/test_pauselifetime-04.js => toolkit/devtools/server/tests/unit/test_pauselifetime-04.js
rename : toolkit/devtools/debugger/tests/unit/test_profiler_actor.js => toolkit/devtools/server/tests/unit/test_profiler_actor.js
rename : toolkit/devtools/debugger/tests/unit/test_source-01.js => toolkit/devtools/server/tests/unit/test_source-01.js
rename : toolkit/devtools/debugger/tests/unit/test_sourcemaps-01.js => toolkit/devtools/server/tests/unit/test_sourcemaps-01.js
rename : toolkit/devtools/debugger/tests/unit/test_sourcemaps-02.js => toolkit/devtools/server/tests/unit/test_sourcemaps-02.js
rename : toolkit/devtools/debugger/tests/unit/test_sourcemaps-03.js => toolkit/devtools/server/tests/unit/test_sourcemaps-03.js
rename : toolkit/devtools/debugger/tests/unit/test_sourcemaps-04.js => toolkit/devtools/server/tests/unit/test_sourcemaps-04.js
rename : toolkit/devtools/debugger/tests/unit/test_sourcemaps-05.js => toolkit/devtools/server/tests/unit/test_sourcemaps-05.js
rename : toolkit/devtools/debugger/tests/unit/test_sourcemaps-06.js => toolkit/devtools/server/tests/unit/test_sourcemaps-06.js
rename : toolkit/devtools/debugger/tests/unit/test_sourcemaps-07.js => toolkit/devtools/server/tests/unit/test_sourcemaps-07.js
rename : toolkit/devtools/debugger/tests/unit/test_sources_backwards_compat-01.js => toolkit/devtools/server/tests/unit/test_sources_backwards_compat-01.js
rename : toolkit/devtools/debugger/tests/unit/test_sources_backwards_compat-02.js => toolkit/devtools/server/tests/unit/test_sources_backwards_compat-02.js
rename : toolkit/devtools/debugger/tests/unit/test_stepping-01.js => toolkit/devtools/server/tests/unit/test_stepping-01.js
rename : toolkit/devtools/debugger/tests/unit/test_stepping-02.js => toolkit/devtools/server/tests/unit/test_stepping-02.js
rename : toolkit/devtools/debugger/tests/unit/test_stepping-03.js => toolkit/devtools/server/tests/unit/test_stepping-03.js
rename : toolkit/devtools/debugger/tests/unit/test_stepping-04.js => toolkit/devtools/server/tests/unit/test_stepping-04.js
rename : toolkit/devtools/debugger/tests/unit/test_stepping-05.js => toolkit/devtools/server/tests/unit/test_stepping-05.js
rename : toolkit/devtools/debugger/tests/unit/test_threadlifetime-01.js => toolkit/devtools/server/tests/unit/test_threadlifetime-01.js
rename : toolkit/devtools/debugger/tests/unit/test_threadlifetime-02.js => toolkit/devtools/server/tests/unit/test_threadlifetime-02.js
rename : toolkit/devtools/debugger/tests/unit/test_threadlifetime-03.js => toolkit/devtools/server/tests/unit/test_threadlifetime-03.js
rename : toolkit/devtools/debugger/tests/unit/test_threadlifetime-04.js => toolkit/devtools/server/tests/unit/test_threadlifetime-04.js
rename : toolkit/devtools/debugger/tests/unit/test_threadlifetime-05.js => toolkit/devtools/server/tests/unit/test_threadlifetime-05.js
rename : toolkit/devtools/debugger/tests/unit/test_threadlifetime-06.js => toolkit/devtools/server/tests/unit/test_threadlifetime-06.js
rename : toolkit/devtools/debugger/tests/unit/test_unsafeDereference.js => toolkit/devtools/server/tests/unit/test_unsafeDereference.js
rename : toolkit/devtools/debugger/tests/unit/testactors.js => toolkit/devtools/server/tests/unit/testactors.js
rename : toolkit/devtools/debugger/tests/unit/testcompatactors.js => toolkit/devtools/server/tests/unit/testcompatactors.js
rename : toolkit/devtools/debugger/tests/unit/xpcshell.ini => toolkit/devtools/server/tests/unit/xpcshell.ini
rename : toolkit/devtools/debugger/dbg-transport.js => toolkit/devtools/server/transport.js
2013-05-21 16:39:13 -07:00

119 lines
3.5 KiB
JavaScript

/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
Cu.import("resource://gre/modules/devtools/dbg-server.jsm");
Cu.import("resource://gre/modules/devtools/dbg-client.jsm");
var gClient;
var gDebuggee;
const xpcInspector = Cc["@mozilla.org/jsinspector;1"].getService(Ci.nsIJSInspector);
function run_test()
{
initTestDebuggerServer();
gDebuggee = testGlobal("test-1");
DebuggerServer.addTestGlobal(gDebuggee);
let transport = DebuggerServer.connectPipe();
gClient = new DebuggerClient(transport);
gClient.addListener("connected", function(aEvent, aType, aTraits) {
gClient.listTabs((aResponse) => {
do_check_true('tabs' in aResponse);
for (let tab of aResponse.tabs) {
if (tab.title == "test-1") {
test_attach_tab(tab.actor);
return false;
}
}
do_check_true(false); // We should have found our tab in the list.
});
});
gClient.connect();
do_test_pending();
}
// Attach to |aTabActor|, and check the response.
function test_attach_tab(aTabActor)
{
gClient.request({ to: aTabActor, type: "attach" }, function(aResponse) {
do_check_false("error" in aResponse);
do_check_eq(aResponse.from, aTabActor);
do_check_eq(aResponse.type, "tabAttached");
do_check_true(typeof aResponse.threadActor === "string");
test_attach_thread(aResponse.threadActor);
});
}
// Attach to |aThreadActor|, check the response, and resume it.
function test_attach_thread(aThreadActor)
{
gClient.request({ to: aThreadActor, type: "attach" }, function(aResponse) {
do_check_false("error" in aResponse);
do_check_eq(aResponse.from, aThreadActor);
do_check_eq(aResponse.type, "paused");
do_check_true("why" in aResponse);
do_check_eq(aResponse.why.type, "attached");
test_resume_thread(aThreadActor);
});
}
// Resume |aThreadActor|, and see that it stops at the 'debugger'
// statement.
function test_resume_thread(aThreadActor)
{
// Allow the client to resume execution.
gClient.request({ to: aThreadActor, type: "resume" }, function (aResponse) {
do_check_false("error" in aResponse);
do_check_eq(aResponse.from, aThreadActor);
do_check_eq(aResponse.type, "resumed");
do_check_eq(xpcInspector.eventLoopNestLevel, 0);
// Now that we know we're resumed, we can make the debuggee do something.
Cu.evalInSandbox("var a = true; var b = false; debugger; var b = true;", gDebuggee);
// Now make sure that we've run the code after the debugger statement...
do_check_true(gDebuggee.b);
});
gClient.addListener("paused", function(aName, aPacket) {
do_check_eq(aName, "paused");
do_check_false("error" in aPacket);
do_check_eq(aPacket.from, aThreadActor);
do_check_eq(aPacket.type, "paused");
do_check_true("actor" in aPacket);
do_check_true("why" in aPacket)
do_check_eq(aPacket.why.type, "debuggerStatement");
// Reach around the protocol to check that the debuggee is in the state
// we expect.
do_check_true(gDebuggee.a);
do_check_false(gDebuggee.b);
do_check_eq(xpcInspector.eventLoopNestLevel, 1);
// Let the debuggee continue execution.
gClient.request({ to: aThreadActor, type: "resume" }, cleanup);
});
}
function cleanup()
{
gClient.addListener("closed", function(aEvent, aResult) {
do_test_finished();
});
try {
let xpcInspector = Cc["@mozilla.org/jsinspector;1"].getService(Ci.nsIJSInspector);
do_check_eq(xpcInspector.eventLoopNestLevel, 0);
} catch(e) {
dump(e);
}
gClient.close();
}