forked from mirrors/gecko-dev
Merge inbound to central, a=merge
MozReview-Commit-ID: 6od53T3ozcm
This commit is contained in:
commit
2ea6238e55
483 changed files with 16692 additions and 9682 deletions
11
.cron.yml
11
.cron.yml
|
|
@ -59,14 +59,3 @@ jobs:
|
||||||
- mozilla-central
|
- mozilla-central
|
||||||
when:
|
when:
|
||||||
- {hour: 18, minute: 0}
|
- {hour: 18, minute: 0}
|
||||||
|
|
||||||
- name: nightly-stylo-talos
|
|
||||||
job:
|
|
||||||
type: decision-task
|
|
||||||
treeherder-symbol: T
|
|
||||||
target-tasks-method: stylo_talos
|
|
||||||
run-on-projects:
|
|
||||||
- mozilla-central
|
|
||||||
when:
|
|
||||||
- {hour: 4, minute: 0}
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -131,7 +131,7 @@ devtools/server/actors/stylesheets.js
|
||||||
devtools/server/tests/browser/storage-*.html
|
devtools/server/tests/browser/storage-*.html
|
||||||
!devtools/server/tests/browser/storage-unsecured-iframe.html
|
!devtools/server/tests/browser/storage-unsecured-iframe.html
|
||||||
devtools/server/tests/browser/stylesheets-nested-iframes.html
|
devtools/server/tests/browser/stylesheets-nested-iframes.html
|
||||||
devtools/server/tests/unit/**
|
devtools/server/tests/unit/xpcshell_debugging_script.js
|
||||||
devtools/shared/platform/content/test/test_clipboard.html
|
devtools/shared/platform/content/test/test_clipboard.html
|
||||||
devtools/shared/qrcode/tests/mochitest/test_decode.html
|
devtools/shared/qrcode/tests/mochitest/test_decode.html
|
||||||
devtools/shared/tests/mochitest/*.html
|
devtools/shared/tests/mochitest/*.html
|
||||||
|
|
@ -174,6 +174,7 @@ devtools/client/debugger/test/mochitest/code_worker-source-map.js
|
||||||
devtools/client/framework/test/code_ugly*
|
devtools/client/framework/test/code_ugly*
|
||||||
devtools/server/tests/unit/babel_and_browserify_script_with_source_map.js
|
devtools/server/tests/unit/babel_and_browserify_script_with_source_map.js
|
||||||
devtools/server/tests/unit/setBreakpoint*
|
devtools/server/tests/unit/setBreakpoint*
|
||||||
|
devtools/server/tests/unit/sourcemapped.js
|
||||||
|
|
||||||
# dom/ exclusions
|
# dom/ exclusions
|
||||||
dom/animation/**
|
dom/animation/**
|
||||||
|
|
|
||||||
|
|
@ -755,8 +755,11 @@ NotificationController::WillRefresh(mozilla::TimeStamp aTime)
|
||||||
childDoc->Shutdown();
|
childDoc->Shutdown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mHangingChildDocuments.Clear();
|
mHangingChildDocuments.Clear();
|
||||||
|
MOZ_ASSERT(mDocument, "Illicit document shutdown");
|
||||||
|
if (!mDocument) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// If the document is ready and all its subdocuments are completely loaded
|
// If the document is ready and all its subdocuments are completely loaded
|
||||||
// then process the document load.
|
// then process the document load.
|
||||||
|
|
|
||||||
|
|
@ -204,16 +204,17 @@ var ctrlTab = {
|
||||||
},
|
},
|
||||||
|
|
||||||
uninit: function ctrlTab_uninit() {
|
uninit: function ctrlTab_uninit() {
|
||||||
this._recentlyUsedTabs = null;
|
if (this._recentlyUsedTabs) {
|
||||||
this._init(false);
|
this._recentlyUsedTabs = null;
|
||||||
|
this._init(false);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
prefName: "browser.ctrlTab.previews",
|
prefName: "browser.ctrlTab.previews",
|
||||||
readPref: function ctrlTab_readPref() {
|
readPref: function ctrlTab_readPref() {
|
||||||
var enable =
|
var enable =
|
||||||
gPrefService.getBoolPref(this.prefName) &&
|
gPrefService.getBoolPref(this.prefName) &&
|
||||||
(!gPrefService.prefHasUserValue("browser.ctrlTab.disallowForScreenReaders") ||
|
!gPrefService.getBoolPref("browser.ctrlTab.disallowForScreenReaders", false);
|
||||||
!gPrefService.getBoolPref("browser.ctrlTab.disallowForScreenReaders"));
|
|
||||||
|
|
||||||
if (enable)
|
if (enable)
|
||||||
this.init();
|
this.init();
|
||||||
|
|
@ -535,15 +536,15 @@ var ctrlTab = {
|
||||||
_init: function ctrlTab__init(enable) {
|
_init: function ctrlTab__init(enable) {
|
||||||
var toggleEventListener = enable ? "addEventListener" : "removeEventListener";
|
var toggleEventListener = enable ? "addEventListener" : "removeEventListener";
|
||||||
|
|
||||||
window[toggleEventListener]("SSWindowRestored", this, false);
|
window[toggleEventListener]("SSWindowRestored", this);
|
||||||
|
|
||||||
var tabContainer = gBrowser.tabContainer;
|
var tabContainer = gBrowser.tabContainer;
|
||||||
tabContainer[toggleEventListener]("TabOpen", this, false);
|
tabContainer[toggleEventListener]("TabOpen", this);
|
||||||
tabContainer[toggleEventListener]("TabAttrModified", this, false);
|
tabContainer[toggleEventListener]("TabAttrModified", this);
|
||||||
tabContainer[toggleEventListener]("TabSelect", this, false);
|
tabContainer[toggleEventListener]("TabSelect", this);
|
||||||
tabContainer[toggleEventListener]("TabClose", this, false);
|
tabContainer[toggleEventListener]("TabClose", this);
|
||||||
|
|
||||||
document[toggleEventListener]("keypress", this, false);
|
document[toggleEventListener]("keypress", this);
|
||||||
gBrowser.mTabBox.handleCtrlTab = !enable;
|
gBrowser.mTabBox.handleCtrlTab = !enable;
|
||||||
|
|
||||||
if (enable)
|
if (enable)
|
||||||
|
|
|
||||||
|
|
@ -338,7 +338,7 @@
|
||||||
<key id="key_fullZoomReset" key="&fullZoomResetCmd.commandkey;" command="cmd_fullZoomReset" modifiers="accel"/>
|
<key id="key_fullZoomReset" key="&fullZoomResetCmd.commandkey;" command="cmd_fullZoomReset" modifiers="accel"/>
|
||||||
<key key="&fullZoomResetCmd.commandkey2;" command="cmd_fullZoomReset" modifiers="accel"/>
|
<key key="&fullZoomResetCmd.commandkey2;" command="cmd_fullZoomReset" modifiers="accel"/>
|
||||||
|
|
||||||
<key id="key_showAllTabs" command="Browser:ShowAllTabs" keycode="VK_TAB" modifiers="control,shift"/>
|
<key id="key_showAllTabs" command="Browser:ShowAllTabs" keycode="VK_TAB" modifiers="control,shift" disabled="true"/>
|
||||||
|
|
||||||
<key id="key_switchTextDirection" key="&bidiSwitchTextDirectionItem.commandkey;" command="cmd_switchTextDirection" modifiers="accel,shift" />
|
<key id="key_switchTextDirection" key="&bidiSwitchTextDirectionItem.commandkey;" command="cmd_switchTextDirection" modifiers="accel,shift" />
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,5 +2,8 @@
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
// Extend from the common devtools xpcshell eslintrc config.
|
// Extend from the common devtools xpcshell eslintrc config.
|
||||||
"extends": "../../../.eslintrc.xpcshell.js"
|
"extends": "../../../.eslintrc.xpcshell.js",
|
||||||
|
"rules": {
|
||||||
|
"no-debugger": 0,
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
/* eslint no-unused-vars: ["error", {"vars": "local"}] */
|
||||||
|
/* eslint-disable no-shadow */
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
var Cc = Components.classes;
|
var Cc = Components.classes;
|
||||||
|
|
@ -42,11 +44,11 @@ const { MemoryFront } = require("devtools/shared/fronts/memory");
|
||||||
|
|
||||||
const { addDebuggerToGlobal } = Cu.import("resource://gre/modules/jsdebugger.jsm", {});
|
const { addDebuggerToGlobal } = Cu.import("resource://gre/modules/jsdebugger.jsm", {});
|
||||||
|
|
||||||
const systemPrincipal = Cc["@mozilla.org/systemprincipal;1"].createInstance(Ci.nsIPrincipal);
|
const systemPrincipal = Cc["@mozilla.org/systemprincipal;1"]
|
||||||
|
.createInstance(Ci.nsIPrincipal);
|
||||||
|
|
||||||
var loadSubScript = Cc[
|
var { loadSubScript } = Cc["@mozilla.org/moz/jssubscript-loader;1"]
|
||||||
"@mozilla.org/moz/jssubscript-loader;1"
|
.getService(Ci.mozIJSSubScriptLoader);
|
||||||
].getService(Ci.mozIJSSubScriptLoader).loadSubScript;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes any test that needs to work with add-ons.
|
* Initializes any test that needs to work with add-ons.
|
||||||
|
|
@ -150,9 +152,8 @@ function makeFullRuntimeMemoryActorTest(testGeneratorFunction) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function createTestGlobal(name) {
|
function createTestGlobal(name) {
|
||||||
let sandbox = Cu.Sandbox(
|
let sandbox = Cu.Sandbox(Cc["@mozilla.org/systemprincipal;1"]
|
||||||
Cc["@mozilla.org/systemprincipal;1"].createInstance(Ci.nsIPrincipal)
|
.createInstance(Ci.nsIPrincipal));
|
||||||
);
|
|
||||||
sandbox.__name = name;
|
sandbox.__name = name;
|
||||||
return sandbox;
|
return sandbox;
|
||||||
}
|
}
|
||||||
|
|
@ -236,24 +237,27 @@ function dumpn(msg) {
|
||||||
function testExceptionHook(ex) {
|
function testExceptionHook(ex) {
|
||||||
try {
|
try {
|
||||||
do_report_unexpected_exception(ex);
|
do_report_unexpected_exception(ex);
|
||||||
} catch (ex) {
|
} catch (e) {
|
||||||
return {throw: ex};
|
return {throw: e};
|
||||||
}
|
}
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convert an nsIScriptError 'aFlags' value into an appropriate string.
|
// Convert an nsIScriptError 'flags' value into an appropriate string.
|
||||||
function scriptErrorFlagsToKind(aFlags) {
|
function scriptErrorFlagsToKind(flags) {
|
||||||
var kind;
|
let kind;
|
||||||
if (aFlags & Ci.nsIScriptError.warningFlag)
|
if (flags & Ci.nsIScriptError.warningFlag) {
|
||||||
kind = "warning";
|
kind = "warning";
|
||||||
if (aFlags & Ci.nsIScriptError.exceptionFlag)
|
}
|
||||||
|
if (flags & Ci.nsIScriptError.exceptionFlag) {
|
||||||
kind = "exception";
|
kind = "exception";
|
||||||
else
|
} else {
|
||||||
kind = "error";
|
kind = "error";
|
||||||
|
}
|
||||||
|
|
||||||
if (aFlags & Ci.nsIScriptError.strictFlag)
|
if (flags & Ci.nsIScriptError.strictFlag) {
|
||||||
kind = "strict " + kind;
|
kind = "strict " + kind;
|
||||||
|
}
|
||||||
|
|
||||||
return kind;
|
return kind;
|
||||||
}
|
}
|
||||||
|
|
@ -262,24 +266,25 @@ function scriptErrorFlagsToKind(aFlags) {
|
||||||
// into the ether.
|
// into the ether.
|
||||||
var errorCount = 0;
|
var errorCount = 0;
|
||||||
var listener = {
|
var listener = {
|
||||||
observe: function (aMessage) {
|
observe: function (message) {
|
||||||
try {
|
try {
|
||||||
|
let string;
|
||||||
errorCount++;
|
errorCount++;
|
||||||
try {
|
try {
|
||||||
// If we've been given an nsIScriptError, then we can print out
|
// If we've been given an nsIScriptError, then we can print out
|
||||||
// something nicely formatted, for tools like Emacs to pick up.
|
// something nicely formatted, for tools like Emacs to pick up.
|
||||||
var scriptError = aMessage.QueryInterface(Ci.nsIScriptError);
|
message.QueryInterface(Ci.nsIScriptError);
|
||||||
dumpn(aMessage.sourceName + ":" + aMessage.lineNumber + ": " +
|
dumpn(message.sourceName + ":" + message.lineNumber + ": " +
|
||||||
scriptErrorFlagsToKind(aMessage.flags) + ": " +
|
scriptErrorFlagsToKind(message.flags) + ": " +
|
||||||
aMessage.errorMessage);
|
message.errorMessage);
|
||||||
var string = aMessage.errorMessage;
|
string = message.errorMessage;
|
||||||
} catch (x) {
|
} catch (e1) {
|
||||||
// Be a little paranoid with message, as the whole goal here is to lose
|
// Be a little paranoid with message, as the whole goal here is to lose
|
||||||
// no information.
|
// no information.
|
||||||
try {
|
try {
|
||||||
var string = "" + aMessage.message;
|
string = "" + message.message;
|
||||||
} catch (x) {
|
} catch (e2) {
|
||||||
var string = "<error converting error message to string>";
|
string = "<error converting error message to string>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -310,8 +315,7 @@ var listener = {
|
||||||
var consoleService = Cc["@mozilla.org/consoleservice;1"].getService(Ci.nsIConsoleService);
|
var consoleService = Cc["@mozilla.org/consoleservice;1"].getService(Ci.nsIConsoleService);
|
||||||
consoleService.registerListener(listener);
|
consoleService.registerListener(listener);
|
||||||
|
|
||||||
function check_except(func)
|
function check_except(func) {
|
||||||
{
|
|
||||||
try {
|
try {
|
||||||
func();
|
func();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
@ -322,70 +326,67 @@ function check_except(func)
|
||||||
do_check_true(false);
|
do_check_true(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
function testGlobal(aName) {
|
function testGlobal(name) {
|
||||||
let systemPrincipal = Cc["@mozilla.org/systemprincipal;1"]
|
let sandbox = Cu.Sandbox(Cc["@mozilla.org/systemprincipal;1"]
|
||||||
.createInstance(Ci.nsIPrincipal);
|
.createInstance(Ci.nsIPrincipal));
|
||||||
|
sandbox.__name = name;
|
||||||
let sandbox = Cu.Sandbox(systemPrincipal);
|
|
||||||
sandbox.__name = aName;
|
|
||||||
return sandbox;
|
return sandbox;
|
||||||
}
|
}
|
||||||
|
|
||||||
function addTestGlobal(aName, aServer = DebuggerServer)
|
function addTestGlobal(name, server = DebuggerServer) {
|
||||||
{
|
let global = testGlobal(name);
|
||||||
let global = testGlobal(aName);
|
server.addTestGlobal(global);
|
||||||
aServer.addTestGlobal(global);
|
|
||||||
return global;
|
return global;
|
||||||
}
|
}
|
||||||
|
|
||||||
// List the DebuggerClient |aClient|'s tabs, look for one whose title is
|
// List the DebuggerClient |client|'s tabs, look for one whose title is
|
||||||
// |aTitle|, and apply |aCallback| to the packet's entry for that tab.
|
// |title|, and apply |callback| to the packet's entry for that tab.
|
||||||
function getTestTab(aClient, aTitle, aCallback) {
|
function getTestTab(client, title, callback) {
|
||||||
aClient.listTabs(function (aResponse) {
|
client.listTabs(function (response) {
|
||||||
for (let tab of aResponse.tabs) {
|
for (let tab of response.tabs) {
|
||||||
if (tab.title === aTitle) {
|
if (tab.title === title) {
|
||||||
aCallback(tab, aResponse);
|
callback(tab, response);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
aCallback(null);
|
callback(null);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attach to |aClient|'s tab whose title is |aTitle|; pass |aCallback| the
|
// Attach to |client|'s tab whose title is |title|; pass |callback| the
|
||||||
// response packet and a TabClient instance referring to that tab.
|
// response packet and a TabClient instance referring to that tab.
|
||||||
function attachTestTab(aClient, aTitle, aCallback) {
|
function attachTestTab(client, title, callback) {
|
||||||
getTestTab(aClient, aTitle, function (aTab) {
|
getTestTab(client, title, function (tab) {
|
||||||
aClient.attachTab(aTab.actor, aCallback);
|
client.attachTab(tab.actor, callback);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attach to |aClient|'s tab whose title is |aTitle|, and then attach to
|
// Attach to |client|'s tab whose title is |title|, and then attach to
|
||||||
// that tab's thread. Pass |aCallback| the thread attach response packet, a
|
// that tab's thread. Pass |callback| the thread attach response packet, a
|
||||||
// TabClient referring to the tab, and a ThreadClient referring to the
|
// TabClient referring to the tab, and a ThreadClient referring to the
|
||||||
// thread.
|
// thread.
|
||||||
function attachTestThread(aClient, aTitle, aCallback) {
|
function attachTestThread(client, title, callback) {
|
||||||
attachTestTab(aClient, aTitle, function (aTabResponse, aTabClient) {
|
attachTestTab(client, title, function (tabResponse, tabClient) {
|
||||||
function onAttach(aResponse, aThreadClient) {
|
function onAttach(response, threadClient) {
|
||||||
aCallback(aResponse, aTabClient, aThreadClient, aTabResponse);
|
callback(response, tabClient, threadClient, tabResponse);
|
||||||
}
|
}
|
||||||
aTabClient.attachThread({
|
tabClient.attachThread({
|
||||||
useSourceMaps: true,
|
useSourceMaps: true,
|
||||||
autoBlackBox: true
|
autoBlackBox: true
|
||||||
}, onAttach);
|
}, onAttach);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attach to |aClient|'s tab whose title is |aTitle|, attach to the tab's
|
// Attach to |client|'s tab whose title is |title|, attach to the tab's
|
||||||
// thread, and then resume it. Pass |aCallback| the thread's response to
|
// thread, and then resume it. Pass |callback| the thread's response to
|
||||||
// the 'resume' packet, a TabClient for the tab, and a ThreadClient for the
|
// the 'resume' packet, a TabClient for the tab, and a ThreadClient for the
|
||||||
// thread.
|
// thread.
|
||||||
function attachTestTabAndResume(aClient, aTitle, aCallback = () => {}) {
|
function attachTestTabAndResume(client, title, callback = () => {}) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve) => {
|
||||||
attachTestThread(aClient, aTitle, function (aResponse, aTabClient, aThreadClient) {
|
attachTestThread(client, title, function (response, tabClient, threadClient) {
|
||||||
aThreadClient.resume(function (aResponse) {
|
threadClient.resume(function (response) {
|
||||||
aCallback(aResponse, aTabClient, aThreadClient);
|
callback(response, tabClient, threadClient);
|
||||||
resolve([aResponse, aTabClient, aThreadClient]);
|
resolve([response, tabClient, threadClient]);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
@ -394,11 +395,12 @@ function attachTestTabAndResume(aClient, aTitle, aCallback = () => {}) {
|
||||||
/**
|
/**
|
||||||
* Initialize the testing debugger server.
|
* Initialize the testing debugger server.
|
||||||
*/
|
*/
|
||||||
function initTestDebuggerServer(aServer = DebuggerServer)
|
function initTestDebuggerServer(server = DebuggerServer) {
|
||||||
{
|
server.registerModule("xpcshell-test/testactors");
|
||||||
aServer.registerModule("xpcshell-test/testactors");
|
|
||||||
// Allow incoming connections.
|
// Allow incoming connections.
|
||||||
aServer.init(function () { return true; });
|
server.init(function () {
|
||||||
|
return true;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -415,18 +417,16 @@ function startTestDebuggerServer(title, server = DebuggerServer) {
|
||||||
return connect(client).then(() => client);
|
return connect(client).then(() => client);
|
||||||
}
|
}
|
||||||
|
|
||||||
function finishClient(aClient)
|
function finishClient(client) {
|
||||||
{
|
client.close(function () {
|
||||||
aClient.close(function () {
|
|
||||||
DebuggerServer.destroy();
|
DebuggerServer.destroy();
|
||||||
do_test_finished();
|
do_test_finished();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a server, connect to it and fetch tab actors for the parent process;
|
// Create a server, connect to it and fetch tab actors for the parent process;
|
||||||
// pass |aCallback| the debugger client and tab actor form with all actor IDs.
|
// pass |callback| the debugger client and tab actor form with all actor IDs.
|
||||||
function get_chrome_actors(callback)
|
function get_chrome_actors(callback) {
|
||||||
{
|
|
||||||
if (!DebuggerServer.initialized) {
|
if (!DebuggerServer.initialized) {
|
||||||
DebuggerServer.init();
|
DebuggerServer.init();
|
||||||
DebuggerServer.addBrowserActors();
|
DebuggerServer.addBrowserActors();
|
||||||
|
|
@ -449,8 +449,8 @@ function getChromeActors(client, server = DebuggerServer) {
|
||||||
/**
|
/**
|
||||||
* Takes a relative file path and returns the absolute file url for it.
|
* Takes a relative file path and returns the absolute file url for it.
|
||||||
*/
|
*/
|
||||||
function getFileUrl(aName, aAllowMissing = false) {
|
function getFileUrl(name, allowMissing = false) {
|
||||||
let file = do_get_file(aName, aAllowMissing);
|
let file = do_get_file(name, allowMissing);
|
||||||
return Services.io.newFileURI(file).spec;
|
return Services.io.newFileURI(file).spec;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -458,9 +458,8 @@ function getFileUrl(aName, aAllowMissing = false) {
|
||||||
* Returns the full path of the file with the specified name in a
|
* Returns the full path of the file with the specified name in a
|
||||||
* platform-independent and URL-like form.
|
* platform-independent and URL-like form.
|
||||||
*/
|
*/
|
||||||
function getFilePath(aName, aAllowMissing = false, aUsePlatformPathSeparator = false)
|
function getFilePath(name, allowMissing = false, usePlatformPathSeparator = false) {
|
||||||
{
|
let file = do_get_file(name, allowMissing);
|
||||||
let file = do_get_file(aName, aAllowMissing);
|
|
||||||
let path = Services.io.newFileURI(file).spec;
|
let path = Services.io.newFileURI(file).spec;
|
||||||
let filePrePath = "file://";
|
let filePrePath = "file://";
|
||||||
if ("nsILocalFileWin" in Ci &&
|
if ("nsILocalFileWin" in Ci &&
|
||||||
|
|
@ -470,7 +469,7 @@ function getFilePath(aName, aAllowMissing = false, aUsePlatformPathSeparator = f
|
||||||
|
|
||||||
path = path.slice(filePrePath.length);
|
path = path.slice(filePrePath.length);
|
||||||
|
|
||||||
if (aUsePlatformPathSeparator && path.match(/^\w:/)) {
|
if (usePlatformPathSeparator && path.match(/^\w:/)) {
|
||||||
path = path.replace(/\//g, "\\");
|
path = path.replace(/\//g, "\\");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -480,8 +479,8 @@ function getFilePath(aName, aAllowMissing = false, aUsePlatformPathSeparator = f
|
||||||
/**
|
/**
|
||||||
* Returns the full text contents of the given file.
|
* Returns the full text contents of the given file.
|
||||||
*/
|
*/
|
||||||
function readFile(aFileName) {
|
function readFile(fileName) {
|
||||||
let f = do_get_file(aFileName);
|
let f = do_get_file(fileName);
|
||||||
let s = Cc["@mozilla.org/network/file-input-stream;1"]
|
let s = Cc["@mozilla.org/network/file-input-stream;1"]
|
||||||
.createInstance(Ci.nsIFileInputStream);
|
.createInstance(Ci.nsIFileInputStream);
|
||||||
s.init(f, -1, -1, false);
|
s.init(f, -1, -1, false);
|
||||||
|
|
@ -492,16 +491,16 @@ function readFile(aFileName) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function writeFile(aFileName, aContent) {
|
function writeFile(fileName, content) {
|
||||||
let file = do_get_file(aFileName, true);
|
let file = do_get_file(fileName, true);
|
||||||
let stream = Cc["@mozilla.org/network/file-output-stream;1"]
|
let stream = Cc["@mozilla.org/network/file-output-stream;1"]
|
||||||
.createInstance(Ci.nsIFileOutputStream);
|
.createInstance(Ci.nsIFileOutputStream);
|
||||||
stream.init(file, -1, -1, 0);
|
stream.init(file, -1, -1, 0);
|
||||||
try {
|
try {
|
||||||
do {
|
do {
|
||||||
let numWritten = stream.write(aContent, aContent.length);
|
let numWritten = stream.write(content, content.length);
|
||||||
aContent = aContent.slice(numWritten);
|
content = content.slice(numWritten);
|
||||||
} while (aContent.length > 0);
|
} while (content.length > 0);
|
||||||
} finally {
|
} finally {
|
||||||
stream.close();
|
stream.close();
|
||||||
}
|
}
|
||||||
|
|
@ -585,9 +584,9 @@ StubTransport.prototype.ready = function () {};
|
||||||
StubTransport.prototype.send = function () {};
|
StubTransport.prototype.send = function () {};
|
||||||
StubTransport.prototype.close = function () {};
|
StubTransport.prototype.close = function () {};
|
||||||
|
|
||||||
function executeSoon(aFunc) {
|
function executeSoon(func) {
|
||||||
Services.tm.mainThread.dispatch({
|
Services.tm.mainThread.dispatch({
|
||||||
run: DevToolsUtils.makeInfallible(aFunc)
|
run: DevToolsUtils.makeInfallible(func)
|
||||||
}, Ci.nsIThread.DISPATCH_NORMAL);
|
}, Ci.nsIThread.DISPATCH_NORMAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -810,8 +809,7 @@ function getSource(threadClient, url) {
|
||||||
});
|
});
|
||||||
if (source.length) {
|
if (source.length) {
|
||||||
deferred.resolve(threadClient.source(source[0]));
|
deferred.resolve(threadClient.source(source[0]));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
deferred.reject(new Error("source not found"));
|
deferred.reject(new Error("source not found"));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
/* eslint no-unused-vars: ["error", {"vars": "local"}] */
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
const protocol = require("devtools/shared/protocol");
|
const protocol = require("devtools/shared/protocol");
|
||||||
|
|
||||||
|
|
@ -12,7 +15,5 @@ const helloSpec = protocol.generateActorSpec({
|
||||||
});
|
});
|
||||||
|
|
||||||
var HelloActor = protocol.ActorClassWithSpec(helloSpec, {
|
var HelloActor = protocol.ActorClassWithSpec(helloSpec, {
|
||||||
hello: function () {
|
hello: function () {}
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,13 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
|
||||||
function PostInitGlobalActor(aConnection) {}
|
"use strict";
|
||||||
|
|
||||||
|
function PostInitGlobalActor(connection) {}
|
||||||
|
|
||||||
PostInitGlobalActor.prototype = {
|
PostInitGlobalActor.prototype = {
|
||||||
actorPrefix: "postInitGlobal",
|
actorPrefix: "postInitGlobal",
|
||||||
onPing: function onPing(aRequest) {
|
onPing(request) {
|
||||||
return { message: "pong" };
|
return { message: "pong" };
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,13 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
|
||||||
function PostInitTabActor(aConnection) {}
|
"use strict";
|
||||||
|
|
||||||
|
function PostInitTabActor(connection) {}
|
||||||
|
|
||||||
PostInitTabActor.prototype = {
|
PostInitTabActor.prototype = {
|
||||||
actorPostfix: "postInitTab",
|
actorPostfix: "postInitTab",
|
||||||
onPing: function onPing(aRequest) {
|
onPing(request) {
|
||||||
return { message: "pong" };
|
return { message: "pong" };
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,13 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
|
||||||
function PreInitGlobalActor(aConnection) {}
|
"use strict";
|
||||||
|
|
||||||
|
function PreInitGlobalActor(connection) {}
|
||||||
|
|
||||||
PreInitGlobalActor.prototype = {
|
PreInitGlobalActor.prototype = {
|
||||||
actorPrefix: "preInitGlobal",
|
actorPrefix: "preInitGlobal",
|
||||||
onPing: function onPing(aRequest) {
|
onPing(request) {
|
||||||
return { message: "pong" };
|
return { message: "pong" };
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,13 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
|
||||||
function PreInitTabActor(aConnection) {}
|
"use strict";
|
||||||
|
|
||||||
|
function PreInitTabActor(connection) {}
|
||||||
|
|
||||||
PreInitTabActor.prototype = {
|
PreInitTabActor.prototype = {
|
||||||
actorPrefix: "preInitTab",
|
actorPrefix: "preInitTab",
|
||||||
onPing: function onPing(aRequest) {
|
onPing(request) {
|
||||||
return { message: "pong" };
|
return { message: "pong" };
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
function Actor() {}
|
function Actor() {}
|
||||||
|
|
||||||
exports.register = function (handle) {
|
exports.register = function (handle) {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
function Actor() {}
|
function Actor() {}
|
||||||
|
|
||||||
exports.register = function (handle) {
|
exports.register = function (handle) {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,9 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
|
||||||
var {method, RetVal, Actor, ActorClassWithSpec, Front, FrontClassWithSpec,
|
"use strict";
|
||||||
|
|
||||||
|
var {RetVal, Actor, ActorClassWithSpec, Front, FrontClassWithSpec,
|
||||||
generateActorSpec} = require("devtools/shared/protocol");
|
generateActorSpec} = require("devtools/shared/protocol");
|
||||||
var Services = require("Services");
|
var Services = require("Services");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check that you can register new actors via the ActorRegistrationActor.
|
* Check that you can register new actors via the ActorRegistrationActor.
|
||||||
*/
|
*/
|
||||||
|
|
@ -12,8 +14,7 @@ var gOldPref;
|
||||||
|
|
||||||
const { ActorRegistryFront } = require("devtools/shared/fronts/actor-registry");
|
const { ActorRegistryFront } = require("devtools/shared/fronts/actor-registry");
|
||||||
|
|
||||||
function run_test()
|
function run_test() {
|
||||||
{
|
|
||||||
gOldPref = Services.prefs.getBoolPref("devtools.debugger.forbid-certified-apps");
|
gOldPref = Services.prefs.getBoolPref("devtools.debugger.forbid-certified-apps");
|
||||||
Services.prefs.setBoolPref("devtools.debugger.forbid-certified-apps", false);
|
Services.prefs.setBoolPref("devtools.debugger.forbid-certified-apps", false);
|
||||||
initTestDebuggerServer();
|
initTestDebuggerServer();
|
||||||
|
|
@ -39,7 +40,7 @@ function registerNewActor() {
|
||||||
|
|
||||||
gRegistryFront
|
gRegistryFront
|
||||||
.registerActor("resource://test/hello-actor.js", options)
|
.registerActor("resource://test/hello-actor.js", options)
|
||||||
.then(actorFront => gActorFront = actorFront)
|
.then(actorFront => (gActorFront = actorFront))
|
||||||
.then(talkToNewActor)
|
.then(talkToNewActor)
|
||||||
.then(null, e => {
|
.then(null, e => {
|
||||||
DevToolsUtils.reportException("registerNewActor", e);
|
DevToolsUtils.reportException("registerNewActor", e);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
var gClient;
|
var gClient;
|
||||||
var gActors;
|
var gActors;
|
||||||
|
|
||||||
|
|
@ -11,8 +13,7 @@ var gActors;
|
||||||
* in order to add actors after initialization but rather can add actors anytime
|
* in order to add actors after initialization but rather can add actors anytime
|
||||||
* regardless of the object's state.
|
* regardless of the object's state.
|
||||||
*/
|
*/
|
||||||
function run_test()
|
function run_test() {
|
||||||
{
|
|
||||||
DebuggerServer.addActors("resource://test/pre_init_global_actors.js");
|
DebuggerServer.addActors("resource://test/pre_init_global_actors.js");
|
||||||
DebuggerServer.addActors("resource://test/pre_init_tab_actors.js");
|
DebuggerServer.addActors("resource://test/pre_init_tab_actors.js");
|
||||||
|
|
||||||
|
|
@ -32,52 +33,47 @@ function run_test()
|
||||||
run_next_test();
|
run_next_test();
|
||||||
}
|
}
|
||||||
|
|
||||||
function init()
|
function init() {
|
||||||
{
|
|
||||||
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
||||||
gClient.connect()
|
gClient.connect()
|
||||||
.then(() => gClient.listTabs())
|
.then(() => gClient.listTabs())
|
||||||
.then(aResponse => {
|
.then(response => {
|
||||||
gActors = aResponse;
|
gActors = response;
|
||||||
run_next_test();
|
run_next_test();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_pre_init_global_actor()
|
function test_pre_init_global_actor() {
|
||||||
{
|
|
||||||
gClient.request({ to: gActors.preInitGlobalActor, type: "ping" },
|
gClient.request({ to: gActors.preInitGlobalActor, type: "ping" },
|
||||||
function onResponse(aResponse) {
|
function onResponse(response) {
|
||||||
do_check_eq(aResponse.message, "pong");
|
do_check_eq(response.message, "pong");
|
||||||
run_next_test();
|
run_next_test();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_pre_init_tab_actor()
|
function test_pre_init_tab_actor() {
|
||||||
{
|
|
||||||
gClient.request({ to: gActors.preInitTabActor, type: "ping" },
|
gClient.request({ to: gActors.preInitTabActor, type: "ping" },
|
||||||
function onResponse(aResponse) {
|
function onResponse(response) {
|
||||||
do_check_eq(aResponse.message, "pong");
|
do_check_eq(response.message, "pong");
|
||||||
run_next_test();
|
run_next_test();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_post_init_global_actor()
|
function test_post_init_global_actor() {
|
||||||
{
|
|
||||||
gClient.request({ to: gActors.postInitGlobalActor, type: "ping" },
|
gClient.request({ to: gActors.postInitGlobalActor, type: "ping" },
|
||||||
function onResponse(aResponse) {
|
function onResponse(response) {
|
||||||
do_check_eq(aResponse.message, "pong");
|
do_check_eq(response.message, "pong");
|
||||||
run_next_test();
|
run_next_test();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_post_init_tab_actor()
|
function test_post_init_tab_actor() {
|
||||||
{
|
|
||||||
gClient.request({ to: gActors.postInitTabActor, type: "ping" },
|
gClient.request({ to: gActors.postInitTabActor, type: "ping" },
|
||||||
function onResponse(aResponse) {
|
function onResponse(response) {
|
||||||
do_check_eq(aResponse.message, "pong");
|
do_check_eq(response.message, "pong");
|
||||||
run_next_test();
|
run_next_test();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
@ -88,16 +84,17 @@ function getActorInstance(connID, actorID) {
|
||||||
return DebuggerServer._connections[connID].getActor(actorID);
|
return DebuggerServer._connections[connID].getActor(actorID);
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_stable_global_actor_instances()
|
function test_stable_global_actor_instances() {
|
||||||
{
|
|
||||||
// Consider that there is only one connection,
|
// Consider that there is only one connection,
|
||||||
// and the first one is ours
|
// and the first one is ours
|
||||||
let connID = Object.keys(DebuggerServer._connections)[0];
|
let connID = Object.keys(DebuggerServer._connections)[0];
|
||||||
let postInitGlobalActor = getActorInstance(connID, gActors.postInitGlobalActor);
|
let postInitGlobalActor = getActorInstance(connID, gActors.postInitGlobalActor);
|
||||||
let preInitGlobalActor = getActorInstance(connID, gActors.preInitGlobalActor);
|
let preInitGlobalActor = getActorInstance(connID, gActors.preInitGlobalActor);
|
||||||
gClient.listTabs(function onListTabs(aResponse) {
|
gClient.listTabs(function onListTabs(response) {
|
||||||
do_check_eq(postInitGlobalActor, getActorInstance(connID, aResponse.postInitGlobalActor));
|
do_check_eq(postInitGlobalActor,
|
||||||
do_check_eq(preInitGlobalActor, getActorInstance(connID, aResponse.preInitGlobalActor));
|
getActorInstance(connID, response.postInitGlobalActor));
|
||||||
|
do_check_eq(preInitGlobalActor,
|
||||||
|
getActorInstance(connID, response.preInitGlobalActor));
|
||||||
run_next_test();
|
run_next_test();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,9 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
/* eslint-disable no-shadow */
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
const protocol = require("devtools/shared/protocol");
|
|
||||||
const {AddonManager} = require("resource://gre/modules/AddonManager.jsm");
|
const {AddonManager} = require("resource://gre/modules/AddonManager.jsm");
|
||||||
|
|
||||||
startupAddonsManager();
|
startupAddonsManager();
|
||||||
|
|
@ -80,7 +82,7 @@ add_task(function* testReloadExitedAddon() {
|
||||||
// Uninstall the decoy add-on, which should cause its actor to exit.
|
// Uninstall the decoy add-on, which should cause its actor to exit.
|
||||||
const onUninstalled = promiseAddonEvent("onUninstalled");
|
const onUninstalled = promiseAddonEvent("onUninstalled");
|
||||||
installedAddon2.uninstall();
|
installedAddon2.uninstall();
|
||||||
const [uninstalledAddon] = yield onUninstalled;
|
yield onUninstalled;
|
||||||
|
|
||||||
// Try to re-list all add-ons after a reload.
|
// Try to re-list all add-ons after a reload.
|
||||||
// This was throwing an exception because of the exited actor.
|
// This was throwing an exception because of the exited actor.
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,9 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
/* eslint-disable no-shadow */
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
const protocol = require("devtools/shared/protocol");
|
|
||||||
const {AddonsActor} = require("devtools/server/actors/addons");
|
|
||||||
const {AddonsFront} = require("devtools/shared/fronts/addons");
|
const {AddonsFront} = require("devtools/shared/fronts/addons");
|
||||||
|
|
||||||
startupAddonsManager();
|
startupAddonsManager();
|
||||||
|
|
|
||||||
|
|
@ -1,36 +1,35 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
var gClient;
|
var gClient;
|
||||||
var gDebuggee;
|
var gDebuggee;
|
||||||
|
|
||||||
function run_test()
|
function run_test() {
|
||||||
{
|
|
||||||
initTestDebuggerServer();
|
initTestDebuggerServer();
|
||||||
gDebuggee = testGlobal("test-1");
|
gDebuggee = testGlobal("test-1");
|
||||||
DebuggerServer.addTestGlobal(gDebuggee);
|
DebuggerServer.addTestGlobal(gDebuggee);
|
||||||
|
|
||||||
let transport = DebuggerServer.connectPipe();
|
let transport = DebuggerServer.connectPipe();
|
||||||
gClient = new DebuggerClient(transport);
|
gClient = new DebuggerClient(transport);
|
||||||
gClient.connect().then(function ([aType, aTraits]) {
|
gClient.connect().then(function ([type, traits]) {
|
||||||
attachTestTab(gClient, "test-1", function (aReply, aTabClient) {
|
attachTestTab(gClient, "test-1", function (reply, tabClient) {
|
||||||
test_attach(aTabClient);
|
test_attach(tabClient);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_attach(aTabClient)
|
function test_attach(tabClient) {
|
||||||
{
|
tabClient.attachThread({}, function (response, threadClient) {
|
||||||
aTabClient.attachThread({}, function (aResponse, aThreadClient) {
|
do_check_eq(threadClient.state, "paused");
|
||||||
do_check_eq(aThreadClient.state, "paused");
|
threadClient.resume(cleanup);
|
||||||
aThreadClient.resume(cleanup);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function cleanup()
|
function cleanup() {
|
||||||
{
|
gClient.addListener("closed", function (event) {
|
||||||
gClient.addListener("closed", function (aEvent) {
|
|
||||||
do_test_finished();
|
do_test_finished();
|
||||||
});
|
});
|
||||||
gClient.close();
|
gClient.close();
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test basic black boxing.
|
* Test basic black boxing.
|
||||||
*/
|
*/
|
||||||
|
|
@ -9,16 +11,16 @@ var gDebuggee;
|
||||||
var gClient;
|
var gClient;
|
||||||
var gThreadClient;
|
var gThreadClient;
|
||||||
|
|
||||||
function run_test()
|
function run_test() {
|
||||||
{
|
|
||||||
initTestDebuggerServer();
|
initTestDebuggerServer();
|
||||||
gDebuggee = addTestGlobal("test-black-box");
|
gDebuggee = addTestGlobal("test-black-box");
|
||||||
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
||||||
gClient.connect().then(function () {
|
gClient.connect().then(function () {
|
||||||
attachTestTabAndResume(gClient, "test-black-box", function (aResponse, aTabClient, aThreadClient) {
|
attachTestTabAndResume(gClient, "test-black-box",
|
||||||
gThreadClient = aThreadClient;
|
function (response, tabClient, threadClient) {
|
||||||
testBlackBox();
|
gThreadClient = threadClient;
|
||||||
});
|
testBlackBox();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
}
|
}
|
||||||
|
|
@ -43,27 +45,27 @@ const testBlackBox = Task.async(function* () {
|
||||||
|
|
||||||
// Test that we can step into `doStuff` when we are not black boxed.
|
// Test that we can step into `doStuff` when we are not black boxed.
|
||||||
yield runTest(
|
yield runTest(
|
||||||
function onSteppedLocation(aLocation) {
|
function onSteppedLocation(location) {
|
||||||
do_check_eq(aLocation.source.url, BLACK_BOXED_URL);
|
do_check_eq(location.source.url, BLACK_BOXED_URL);
|
||||||
do_check_eq(aLocation.line, 2);
|
do_check_eq(location.line, 2);
|
||||||
},
|
},
|
||||||
function onDebuggerStatementFrames(aFrames) {
|
function onDebuggerStatementFrames(frames) {
|
||||||
do_check_true(!aFrames.some(f => f.where.source.isBlackBoxed));
|
do_check_true(!frames.some(f => f.where.source.isBlackBoxed));
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
let blackBoxResponse = yield blackBox(sourceClient);
|
yield blackBox(sourceClient);
|
||||||
do_check_true(sourceClient.isBlackBoxed);
|
do_check_true(sourceClient.isBlackBoxed);
|
||||||
|
|
||||||
// Test that we step through `doStuff` when we are black boxed and its frame
|
// Test that we step through `doStuff` when we are black boxed and its frame
|
||||||
// doesn't show up.
|
// doesn't show up.
|
||||||
yield runTest(
|
yield runTest(
|
||||||
function onSteppedLocation(aLocation) {
|
function onSteppedLocation(location) {
|
||||||
do_check_eq(aLocation.source.url, SOURCE_URL);
|
do_check_eq(location.source.url, SOURCE_URL);
|
||||||
do_check_eq(aLocation.line, 4);
|
do_check_eq(location.line, 4);
|
||||||
},
|
},
|
||||||
function onDebuggerStatementFrames(aFrames) {
|
function onDebuggerStatementFrames(frames) {
|
||||||
for (let f of aFrames) {
|
for (let f of frames) {
|
||||||
if (f.where.source.url == BLACK_BOXED_URL) {
|
if (f.where.source.url == BLACK_BOXED_URL) {
|
||||||
do_check_true(f.where.source.isBlackBoxed);
|
do_check_true(f.where.source.isBlackBoxed);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -73,17 +75,17 @@ const testBlackBox = Task.async(function* () {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
let unBlackBoxResponse = yield unBlackBox(sourceClient);
|
yield unBlackBox(sourceClient);
|
||||||
do_check_true(!sourceClient.isBlackBoxed);
|
do_check_true(!sourceClient.isBlackBoxed);
|
||||||
|
|
||||||
// Test that we can step into `doStuff` again.
|
// Test that we can step into `doStuff` again.
|
||||||
yield runTest(
|
yield runTest(
|
||||||
function onSteppedLocation(aLocation) {
|
function onSteppedLocation(location) {
|
||||||
do_check_eq(aLocation.source.url, BLACK_BOXED_URL);
|
do_check_eq(location.source.url, BLACK_BOXED_URL);
|
||||||
do_check_eq(aLocation.line, 2);
|
do_check_eq(location.line, 2);
|
||||||
},
|
},
|
||||||
function onDebuggerStatementFrames(aFrames) {
|
function onDebuggerStatementFrames(frames) {
|
||||||
do_check_true(!aFrames.some(f => f.where.source.isBlackBoxed));
|
do_check_true(!frames.some(f => f.where.source.isBlackBoxed));
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -91,6 +93,7 @@ const testBlackBox = Task.async(function* () {
|
||||||
});
|
});
|
||||||
|
|
||||||
function evalCode() {
|
function evalCode() {
|
||||||
|
/* eslint-disable */
|
||||||
Components.utils.evalInSandbox(
|
Components.utils.evalInSandbox(
|
||||||
"" + function doStuff(k) { // line 1
|
"" + function doStuff(k) { // line 1
|
||||||
let arg = 15; // line 2 - Step in here
|
let arg = 15; // line 2 - Step in here
|
||||||
|
|
@ -116,6 +119,7 @@ function evalCode() {
|
||||||
SOURCE_URL,
|
SOURCE_URL,
|
||||||
1
|
1
|
||||||
);
|
);
|
||||||
|
/* eslint-enable */
|
||||||
}
|
}
|
||||||
|
|
||||||
const runTest = Task.async(function* (onSteppedLocation, onDebuggerStatementFrames) {
|
const runTest = Task.async(function* (onSteppedLocation, onDebuggerStatementFrames) {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
/* eslint-disable no-shadow */
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test that we don't hit breakpoints in black boxed sources, and that when we
|
* Test that we don't hit breakpoints in black boxed sources, and that when we
|
||||||
|
|
@ -11,16 +14,16 @@ var gDebuggee;
|
||||||
var gClient;
|
var gClient;
|
||||||
var gThreadClient;
|
var gThreadClient;
|
||||||
|
|
||||||
function run_test()
|
function run_test() {
|
||||||
{
|
|
||||||
initTestDebuggerServer();
|
initTestDebuggerServer();
|
||||||
gDebuggee = addTestGlobal("test-black-box");
|
gDebuggee = addTestGlobal("test-black-box");
|
||||||
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
||||||
gClient.connect().then(function () {
|
gClient.connect().then(function () {
|
||||||
attachTestTabAndResume(gClient, "test-black-box", function (aResponse, aTabClient, aThreadClient) {
|
attachTestTabAndResume(gClient, "test-black-box",
|
||||||
gThreadClient = aThreadClient;
|
function (response, tabClient, threadClient) {
|
||||||
test_black_box();
|
gThreadClient = threadClient;
|
||||||
});
|
test_black_box();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
}
|
}
|
||||||
|
|
@ -28,27 +31,27 @@ function run_test()
|
||||||
const BLACK_BOXED_URL = "http://example.com/blackboxme.js";
|
const BLACK_BOXED_URL = "http://example.com/blackboxme.js";
|
||||||
const SOURCE_URL = "http://example.com/source.js";
|
const SOURCE_URL = "http://example.com/source.js";
|
||||||
|
|
||||||
function test_black_box()
|
function test_black_box() {
|
||||||
{
|
gClient.addOneTimeListener("paused", function (event, packet) {
|
||||||
gClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
gThreadClient.eval(packet.frame.actor, "doStuff", function (response) {
|
||||||
gThreadClient.eval(aPacket.frame.actor, "doStuff", function (aResponse) {
|
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||||
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
let obj = gThreadClient.pauseGrip(packet.why.frameFinished.return);
|
||||||
let obj = gThreadClient.pauseGrip(aPacket.why.frameFinished.return);
|
|
||||||
obj.getDefinitionSite(runWithSource);
|
obj.getDefinitionSite(runWithSource);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
function runWithSource(aPacket) {
|
function runWithSource(packet) {
|
||||||
let source = gThreadClient.source(aPacket.source);
|
let source = gThreadClient.source(packet.source);
|
||||||
source.setBreakpoint({
|
source.setBreakpoint({
|
||||||
line: 2
|
line: 2
|
||||||
}, function (aResponse) {
|
}, function (response) {
|
||||||
do_check_true(!aResponse.error, "Should be able to set breakpoint.");
|
do_check_true(!response.error, "Should be able to set breakpoint.");
|
||||||
gThreadClient.resume(test_black_box_breakpoint);
|
gThreadClient.resume(test_black_box_breakpoint);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/* eslint-disable */
|
||||||
Components.utils.evalInSandbox(
|
Components.utils.evalInSandbox(
|
||||||
"" + function doStuff(k) { // line 1
|
"" + function doStuff(k) { // line 1
|
||||||
let arg = 15; // line 2 - Break here
|
let arg = 15; // line 2 - Break here
|
||||||
|
|
@ -74,18 +77,22 @@ function test_black_box()
|
||||||
SOURCE_URL,
|
SOURCE_URL,
|
||||||
1
|
1
|
||||||
);
|
);
|
||||||
|
/* eslint-enable */
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_black_box_breakpoint() {
|
function test_black_box_breakpoint() {
|
||||||
gThreadClient.getSources(function ({error, sources}) {
|
gThreadClient.getSources(function ({error, sources}) {
|
||||||
do_check_true(!error, "Should not get an error: " + error);
|
do_check_true(!error, "Should not get an error: " + error);
|
||||||
let sourceClient = gThreadClient.source(sources.filter(s => s.url == BLACK_BOXED_URL)[0]);
|
let sourceClient = gThreadClient.source(
|
||||||
|
sources.filter(s => s.url == BLACK_BOXED_URL)[0]
|
||||||
|
);
|
||||||
sourceClient.blackBox(function ({error}) {
|
sourceClient.blackBox(function ({error}) {
|
||||||
do_check_true(!error, "Should not get an error: " + error);
|
do_check_true(!error, "Should not get an error: " + error);
|
||||||
|
|
||||||
gClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
gClient.addOneTimeListener("paused", function (event, packet) {
|
||||||
do_check_eq(aPacket.why.type, "debuggerStatement",
|
do_check_eq(
|
||||||
"We should pass over the breakpoint since the source is black boxed.");
|
packet.why.type, "debuggerStatement",
|
||||||
|
"We should pass over the breakpoint since the source is black boxed.");
|
||||||
gThreadClient.resume(test_unblack_box_breakpoint.bind(null, sourceClient));
|
gThreadClient.resume(test_unblack_box_breakpoint.bind(null, sourceClient));
|
||||||
});
|
});
|
||||||
gDebuggee.runTest();
|
gDebuggee.runTest();
|
||||||
|
|
@ -93,14 +100,15 @@ function test_black_box_breakpoint() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_unblack_box_breakpoint(aSourceClient) {
|
function test_unblack_box_breakpoint(sourceClient) {
|
||||||
aSourceClient.unblackBox(function ({error}) {
|
sourceClient.unblackBox(function ({error}) {
|
||||||
do_check_true(!error, "Should not get an error: " + error);
|
do_check_true(!error, "Should not get an error: " + error);
|
||||||
gClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
gClient.addOneTimeListener("paused", function (event, packet) {
|
||||||
do_check_eq(aPacket.why.type, "breakpoint",
|
do_check_eq(packet.why.type, "breakpoint",
|
||||||
"We should hit the breakpoint again");
|
"We should hit the breakpoint again");
|
||||||
|
|
||||||
// We will hit the debugger statement on resume, so do this nastiness to skip over it.
|
// We will hit the debugger statement on resume, so do this
|
||||||
|
// nastiness to skip over it.
|
||||||
gClient.addOneTimeListener(
|
gClient.addOneTimeListener(
|
||||||
"paused",
|
"paused",
|
||||||
gThreadClient.resume.bind(
|
gThreadClient.resume.bind(
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
/* eslint-disable no-shadow, max-nested-callbacks */
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test that we don't stop at debugger statements inside black boxed sources.
|
* Test that we don't stop at debugger statements inside black boxed sources.
|
||||||
|
|
@ -10,16 +13,16 @@ var gClient;
|
||||||
var gThreadClient;
|
var gThreadClient;
|
||||||
var gBpClient;
|
var gBpClient;
|
||||||
|
|
||||||
function run_test()
|
function run_test() {
|
||||||
{
|
|
||||||
initTestDebuggerServer();
|
initTestDebuggerServer();
|
||||||
gDebuggee = addTestGlobal("test-black-box");
|
gDebuggee = addTestGlobal("test-black-box");
|
||||||
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
||||||
gClient.connect().then(function () {
|
gClient.connect().then(function () {
|
||||||
attachTestTabAndResume(gClient, "test-black-box", function (aResponse, aTabClient, aThreadClient) {
|
attachTestTabAndResume(gClient, "test-black-box",
|
||||||
gThreadClient = aThreadClient;
|
function (response, tabClient, threadClient) {
|
||||||
test_black_box();
|
gThreadClient = threadClient;
|
||||||
});
|
test_black_box();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
}
|
}
|
||||||
|
|
@ -27,10 +30,9 @@ function run_test()
|
||||||
const BLACK_BOXED_URL = "http://example.com/blackboxme.js";
|
const BLACK_BOXED_URL = "http://example.com/blackboxme.js";
|
||||||
const SOURCE_URL = "http://example.com/source.js";
|
const SOURCE_URL = "http://example.com/source.js";
|
||||||
|
|
||||||
function test_black_box()
|
function test_black_box() {
|
||||||
{
|
gClient.addOneTimeListener("paused", function (event, packet) {
|
||||||
gClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
let source = gThreadClient.source(packet.frame.where.source);
|
||||||
let source = gThreadClient.source(aPacket.frame.where.source);
|
|
||||||
source.setBreakpoint({
|
source.setBreakpoint({
|
||||||
line: 4
|
line: 4
|
||||||
}, function ({error}, bpClient) {
|
}, function ({error}, bpClient) {
|
||||||
|
|
@ -40,6 +42,7 @@ function test_black_box()
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/* eslint-disable */
|
||||||
Components.utils.evalInSandbox(
|
Components.utils.evalInSandbox(
|
||||||
"" + function doStuff(k) { // line 1
|
"" + function doStuff(k) { // line 1
|
||||||
debugger; // line 2 - Break here
|
debugger; // line 2 - Break here
|
||||||
|
|
@ -65,18 +68,21 @@ function test_black_box()
|
||||||
SOURCE_URL,
|
SOURCE_URL,
|
||||||
1
|
1
|
||||||
);
|
);
|
||||||
|
/* eslint-enable */
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_black_box_dbg_statement() {
|
function test_black_box_dbg_statement() {
|
||||||
gThreadClient.getSources(function ({error, sources}) {
|
gThreadClient.getSources(function ({error, sources}) {
|
||||||
do_check_true(!error, "Should not get an error: " + error);
|
do_check_true(!error, "Should not get an error: " + error);
|
||||||
let sourceClient = gThreadClient.source(sources.filter(s => s.url == BLACK_BOXED_URL)[0]);
|
let sourceClient = gThreadClient.source(
|
||||||
|
sources.filter(s => s.url == BLACK_BOXED_URL)[0]
|
||||||
|
);
|
||||||
|
|
||||||
sourceClient.blackBox(function ({error}) {
|
sourceClient.blackBox(function ({error}) {
|
||||||
do_check_true(!error, "Should not get an error: " + error);
|
do_check_true(!error, "Should not get an error: " + error);
|
||||||
|
|
||||||
gClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
gClient.addOneTimeListener("paused", function (event, packet) {
|
||||||
do_check_eq(aPacket.why.type, "breakpoint",
|
do_check_eq(packet.why.type, "breakpoint",
|
||||||
"We should pass over the debugger statement.");
|
"We should pass over the debugger statement.");
|
||||||
gBpClient.remove(function ({error}) {
|
gBpClient.remove(function ({error}) {
|
||||||
do_check_true(!error, "Should not get an error: " + error);
|
do_check_true(!error, "Should not get an error: " + error);
|
||||||
|
|
@ -88,12 +94,12 @@ function test_black_box_dbg_statement() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_unblack_box_dbg_statement(aSourceClient) {
|
function test_unblack_box_dbg_statement(sourceClient) {
|
||||||
aSourceClient.unblackBox(function ({error}) {
|
sourceClient.unblackBox(function ({error}) {
|
||||||
do_check_true(!error, "Should not get an error: " + error);
|
do_check_true(!error, "Should not get an error: " + error);
|
||||||
|
|
||||||
gClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
gClient.addOneTimeListener("paused", function (event, packet) {
|
||||||
do_check_eq(aPacket.why.type, "debuggerStatement",
|
do_check_eq(packet.why.type, "debuggerStatement",
|
||||||
"We should stop at the debugger statement again");
|
"We should stop at the debugger statement again");
|
||||||
finishClient(gClient);
|
finishClient(gClient);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
/* eslint-disable no-shadow */
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test behavior of blackboxing sources we are currently paused in.
|
* Test behavior of blackboxing sources we are currently paused in.
|
||||||
|
|
@ -9,16 +12,16 @@ var gDebuggee;
|
||||||
var gClient;
|
var gClient;
|
||||||
var gThreadClient;
|
var gThreadClient;
|
||||||
|
|
||||||
function run_test()
|
function run_test() {
|
||||||
{
|
|
||||||
initTestDebuggerServer();
|
initTestDebuggerServer();
|
||||||
gDebuggee = addTestGlobal("test-black-box");
|
gDebuggee = addTestGlobal("test-black-box");
|
||||||
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
||||||
gClient.connect().then(function () {
|
gClient.connect().then(function () {
|
||||||
attachTestTabAndResume(gClient, "test-black-box", function (aResponse, aTabClient, aThreadClient) {
|
attachTestTabAndResume(gClient, "test-black-box",
|
||||||
gThreadClient = aThreadClient;
|
function (response, tabClient, threadClient) {
|
||||||
test_black_box();
|
gThreadClient = threadClient;
|
||||||
});
|
test_black_box();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
}
|
}
|
||||||
|
|
@ -26,27 +29,27 @@ function run_test()
|
||||||
const BLACK_BOXED_URL = "http://example.com/blackboxme.js";
|
const BLACK_BOXED_URL = "http://example.com/blackboxme.js";
|
||||||
const SOURCE_URL = "http://example.com/source.js";
|
const SOURCE_URL = "http://example.com/source.js";
|
||||||
|
|
||||||
function test_black_box()
|
function test_black_box() {
|
||||||
{
|
gClient.addOneTimeListener("paused", function (event, packet) {
|
||||||
gClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
gThreadClient.eval(packet.frame.actor, "doStuff", function (response) {
|
||||||
gThreadClient.eval(aPacket.frame.actor, "doStuff", function (aResponse) {
|
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||||
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
let obj = gThreadClient.pauseGrip(packet.why.frameFinished.return);
|
||||||
let obj = gThreadClient.pauseGrip(aPacket.why.frameFinished.return);
|
|
||||||
obj.getDefinitionSite(runWithSource);
|
obj.getDefinitionSite(runWithSource);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
function runWithSource(aPacket) {
|
function runWithSource(packet) {
|
||||||
let source = gThreadClient.source(aPacket.source);
|
let source = gThreadClient.source(packet.source);
|
||||||
source.setBreakpoint({
|
source.setBreakpoint({
|
||||||
line: 2
|
line: 2
|
||||||
}, function (aResponse) {
|
}, function (response) {
|
||||||
do_check_true(!aResponse.error, "Should be able to set breakpoint.");
|
do_check_true(!response.error, "Should be able to set breakpoint.");
|
||||||
test_black_box_paused();
|
test_black_box_paused();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/* eslint-disable */
|
||||||
Components.utils.evalInSandbox(
|
Components.utils.evalInSandbox(
|
||||||
"" + function doStuff(k) { // line 1
|
"" + function doStuff(k) { // line 1
|
||||||
debugger; // line 2
|
debugger; // line 2
|
||||||
|
|
@ -72,16 +75,20 @@ function test_black_box()
|
||||||
SOURCE_URL,
|
SOURCE_URL,
|
||||||
1
|
1
|
||||||
);
|
);
|
||||||
|
/* eslint-enable */
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_black_box_paused() {
|
function test_black_box_paused() {
|
||||||
gThreadClient.getSources(function ({error, sources}) {
|
gThreadClient.getSources(function ({error, sources}) {
|
||||||
do_check_true(!error, "Should not get an error: " + error);
|
do_check_true(!error, "Should not get an error: " + error);
|
||||||
let sourceClient = gThreadClient.source(sources.filter(s => s.url == BLACK_BOXED_URL)[0]);
|
let sourceClient = gThreadClient.source(
|
||||||
|
sources.filter(s => s.url == BLACK_BOXED_URL)[0]
|
||||||
|
);
|
||||||
|
|
||||||
sourceClient.blackBox(function ({error, pausedInSource}) {
|
sourceClient.blackBox(function ({error, pausedInSource}) {
|
||||||
do_check_true(!error, "Should not get an error: " + error);
|
do_check_true(!error, "Should not get an error: " + error);
|
||||||
do_check_true(pausedInSource, "We should be notified that we are currently paused in this source");
|
do_check_true(pausedInSource,
|
||||||
|
"We should be notified that we are currently paused in this source");
|
||||||
finishClient(gClient);
|
finishClient(gClient);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
/* eslint-disable no-shadow */
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test exceptions inside black boxed sources.
|
* Test exceptions inside black boxed sources.
|
||||||
|
|
@ -9,21 +12,22 @@ var gDebuggee;
|
||||||
var gClient;
|
var gClient;
|
||||||
var gThreadClient;
|
var gThreadClient;
|
||||||
|
|
||||||
function run_test()
|
function run_test() {
|
||||||
{
|
|
||||||
initTestDebuggerServer();
|
initTestDebuggerServer();
|
||||||
gDebuggee = addTestGlobal("test-black-box");
|
gDebuggee = addTestGlobal("test-black-box");
|
||||||
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
||||||
gClient.connect().then(function () {
|
gClient.connect().then(function () {
|
||||||
attachTestTabAndResume(gClient, "test-black-box", function (aResponse, aTabClient, aThreadClient) {
|
attachTestTabAndResume(
|
||||||
gThreadClient = aThreadClient;
|
gClient, "test-black-box",
|
||||||
// XXX: We have to do an executeSoon so that the error isn't caught and
|
function (response, tabClient, threadClient) {
|
||||||
// reported by DebuggerClient.requester (because we are using the local
|
gThreadClient = threadClient;
|
||||||
// transport and share a stack) which causes the test to fail.
|
// XXX: We have to do an executeSoon so that the error isn't caught and
|
||||||
Services.tm.mainThread.dispatch({
|
// reported by DebuggerClient.requester (because we are using the local
|
||||||
run: test_black_box
|
// transport and share a stack) which causes the test to fail.
|
||||||
}, Ci.nsIThread.DISPATCH_NORMAL);
|
Services.tm.mainThread.dispatch({
|
||||||
});
|
run: test_black_box
|
||||||
|
}, Ci.nsIThread.DISPATCH_NORMAL);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
}
|
}
|
||||||
|
|
@ -31,10 +35,10 @@ function run_test()
|
||||||
const BLACK_BOXED_URL = "http://example.com/blackboxme.js";
|
const BLACK_BOXED_URL = "http://example.com/blackboxme.js";
|
||||||
const SOURCE_URL = "http://example.com/source.js";
|
const SOURCE_URL = "http://example.com/source.js";
|
||||||
|
|
||||||
function test_black_box()
|
function test_black_box() {
|
||||||
{
|
|
||||||
gClient.addOneTimeListener("paused", test_black_box_exception);
|
gClient.addOneTimeListener("paused", test_black_box_exception);
|
||||||
|
|
||||||
|
/* eslint-disable */
|
||||||
Components.utils.evalInSandbox(
|
Components.utils.evalInSandbox(
|
||||||
"" + function doStuff(k) { // line 1
|
"" + function doStuff(k) { // line 1
|
||||||
throw new Error("wu tang clan ain't nuthin' ta fuck wit"); // line 2
|
throw new Error("wu tang clan ain't nuthin' ta fuck wit"); // line 2
|
||||||
|
|
@ -61,19 +65,22 @@ function test_black_box()
|
||||||
SOURCE_URL,
|
SOURCE_URL,
|
||||||
1
|
1
|
||||||
);
|
);
|
||||||
|
/* eslint-enable */
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_black_box_exception() {
|
function test_black_box_exception() {
|
||||||
gThreadClient.getSources(function ({error, sources}) {
|
gThreadClient.getSources(function ({error, sources}) {
|
||||||
do_check_true(!error, "Should not get an error: " + error);
|
do_check_true(!error, "Should not get an error: " + error);
|
||||||
let sourceClient = gThreadClient.source(sources.filter(s => s.url == BLACK_BOXED_URL)[0]);
|
let sourceClient = gThreadClient.source(
|
||||||
|
sources.filter(s => s.url == BLACK_BOXED_URL)[0]
|
||||||
|
);
|
||||||
|
|
||||||
sourceClient.blackBox(function ({error}) {
|
sourceClient.blackBox(function ({error}) {
|
||||||
do_check_true(!error, "Should not get an error: " + error);
|
do_check_true(!error, "Should not get an error: " + error);
|
||||||
gThreadClient.pauseOnExceptions(true);
|
gThreadClient.pauseOnExceptions(true);
|
||||||
|
|
||||||
gClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
gClient.addOneTimeListener("paused", function (event, packet) {
|
||||||
do_check_eq(aPacket.frame.where.source.url, SOURCE_URL,
|
do_check_eq(packet.frame.where.source.url, SOURCE_URL,
|
||||||
"We shouldn't pause while in the black boxed source.");
|
"We shouldn't pause while in the black boxed source.");
|
||||||
finishClient(gClient);
|
finishClient(gClient);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
/* eslint-disable no-shadow */
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test that we can black box source mapped sources.
|
* Test that we can black box source mapped sources.
|
||||||
|
|
@ -11,31 +14,33 @@ var gThreadClient;
|
||||||
|
|
||||||
const {SourceNode} = require("source-map");
|
const {SourceNode} = require("source-map");
|
||||||
|
|
||||||
function run_test()
|
function run_test() {
|
||||||
{
|
|
||||||
initTestDebuggerServer();
|
initTestDebuggerServer();
|
||||||
gDebuggee = addTestGlobal("test-black-box");
|
gDebuggee = addTestGlobal("test-black-box");
|
||||||
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
||||||
gClient.connect().then(function () {
|
gClient.connect().then(function () {
|
||||||
attachTestTabAndResume(gClient, "test-black-box", function (aResponse, aTabClient, aThreadClient) {
|
attachTestTabAndResume(
|
||||||
gThreadClient = aThreadClient;
|
gClient, "test-black-box",
|
||||||
|
function (response, tabClient, threadClient) {
|
||||||
|
gThreadClient = threadClient;
|
||||||
|
|
||||||
promise.resolve(setup_code())
|
promise.resolve(setup_code())
|
||||||
.then(black_box_code)
|
.then(black_box_code)
|
||||||
.then(run_code)
|
.then(run_code)
|
||||||
.then(test_correct_location)
|
.then(test_correct_location)
|
||||||
.then(null, function (error) {
|
.then(null, function (error) {
|
||||||
do_check_true(false, "Should not get an error, got " + error);
|
do_check_true(false, "Should not get an error, got " + error);
|
||||||
})
|
})
|
||||||
.then(function () {
|
.then(function () {
|
||||||
finishClient(gClient);
|
finishClient(gClient);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
}
|
}
|
||||||
|
|
||||||
function setup_code() {
|
function setup_code() {
|
||||||
|
/* eslint-disable */
|
||||||
let { code, map } = (new SourceNode(null, null, null, [
|
let { code, map } = (new SourceNode(null, null, null, [
|
||||||
new SourceNode(1, 0, "a.js", "" + function a() {
|
new SourceNode(1, 0, "a.js", "" + function a() {
|
||||||
return b();
|
return b();
|
||||||
|
|
@ -54,6 +59,7 @@ function setup_code() {
|
||||||
file: "abc.js",
|
file: "abc.js",
|
||||||
sourceRoot: "http://example.com/"
|
sourceRoot: "http://example.com/"
|
||||||
});
|
});
|
||||||
|
/* eslint-enable */
|
||||||
|
|
||||||
code += "//# sourceMappingURL=data:text/json," + map.toString();
|
code += "//# sourceMappingURL=data:text/json," + map.toString();
|
||||||
|
|
||||||
|
|
@ -85,8 +91,8 @@ function black_box_code() {
|
||||||
function run_code() {
|
function run_code() {
|
||||||
const d = promise.defer();
|
const d = promise.defer();
|
||||||
|
|
||||||
gClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
gClient.addOneTimeListener("paused", function (event, packet) {
|
||||||
d.resolve(aPacket);
|
d.resolve(packet);
|
||||||
gThreadClient.resume();
|
gThreadClient.resume();
|
||||||
});
|
});
|
||||||
gDebuggee.a();
|
gDebuggee.a();
|
||||||
|
|
@ -94,9 +100,10 @@ function run_code() {
|
||||||
return d.promise;
|
return d.promise;
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_correct_location(aPacket) {
|
function test_correct_location(packet) {
|
||||||
do_check_eq(aPacket.why.type, "debuggerStatement",
|
do_check_eq(packet.why.type, "debuggerStatement",
|
||||||
"Should hit a debugger statement.");
|
"Should hit a debugger statement.");
|
||||||
do_check_eq(aPacket.frame.where.source.url, "http://example.com/c.js",
|
do_check_eq(packet.frame.where.source.url, "http://example.com/c.js",
|
||||||
"Should have skipped over the debugger statement in the black boxed source");
|
"Should have skipped over the debugger statement in the" +
|
||||||
|
" black boxed source");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test that sources whose URL ends with ".min.js" automatically get black
|
* Test that sources whose URL ends with ".min.js" automatically get black
|
||||||
* boxed.
|
* boxed.
|
||||||
|
|
@ -10,16 +12,16 @@ var gDebuggee;
|
||||||
var gClient;
|
var gClient;
|
||||||
var gThreadClient;
|
var gThreadClient;
|
||||||
|
|
||||||
function run_test()
|
function run_test() {
|
||||||
{
|
|
||||||
initTestDebuggerServer();
|
initTestDebuggerServer();
|
||||||
gDebuggee = addTestGlobal("test-black-box");
|
gDebuggee = addTestGlobal("test-black-box");
|
||||||
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
||||||
gClient.connect().then(function () {
|
gClient.connect().then(function () {
|
||||||
attachTestTabAndResume(gClient, "test-black-box", function (aResponse, aTabClient, aThreadClient) {
|
attachTestTabAndResume(gClient, "test-black-box",
|
||||||
gThreadClient = aThreadClient;
|
function (response, tabClient, threadClient) {
|
||||||
testBlackBox();
|
gThreadClient = threadClient;
|
||||||
});
|
testBlackBox();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
/* eslint-disable no-shadow, max-nested-callbacks */
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check basic breakpoint functionality.
|
* Check basic breakpoint functionality.
|
||||||
|
|
@ -9,55 +12,52 @@ var gClient;
|
||||||
var gThreadClient;
|
var gThreadClient;
|
||||||
var gCallback;
|
var gCallback;
|
||||||
|
|
||||||
function run_test()
|
function run_test() {
|
||||||
{
|
|
||||||
run_test_with_server(DebuggerServer, function () {
|
run_test_with_server(DebuggerServer, function () {
|
||||||
run_test_with_server(WorkerDebuggerServer, do_test_finished);
|
run_test_with_server(WorkerDebuggerServer, do_test_finished);
|
||||||
});
|
});
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
}
|
}
|
||||||
|
|
||||||
function run_test_with_server(aServer, aCallback)
|
function run_test_with_server(server, callback) {
|
||||||
{
|
gCallback = callback;
|
||||||
gCallback = aCallback;
|
initTestDebuggerServer(server);
|
||||||
initTestDebuggerServer(aServer);
|
gDebuggee = addTestGlobal("test-stack", server);
|
||||||
gDebuggee = addTestGlobal("test-stack", aServer);
|
gClient = new DebuggerClient(server.connectPipe());
|
||||||
gClient = new DebuggerClient(aServer.connectPipe());
|
|
||||||
gClient.connect().then(function () {
|
gClient.connect().then(function () {
|
||||||
attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) {
|
attachTestTabAndResume(gClient, "test-stack",
|
||||||
gThreadClient = aThreadClient;
|
function (response, tabClient, threadClient) {
|
||||||
test_simple_breakpoint();
|
gThreadClient = threadClient;
|
||||||
});
|
test_simple_breakpoint();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_simple_breakpoint()
|
function test_simple_breakpoint() {
|
||||||
{
|
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||||
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
let source = gThreadClient.source(packet.frame.where.source);
|
||||||
let source = gThreadClient.source(aPacket.frame.where.source);
|
|
||||||
let location = {
|
let location = {
|
||||||
line: gDebuggee.line0 + 3
|
line: gDebuggee.line0 + 3
|
||||||
};
|
};
|
||||||
|
|
||||||
source.setBreakpoint(location, function (aResponse, bpClient) {
|
source.setBreakpoint(location, function (response, bpClient) {
|
||||||
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||||
// Check the return value.
|
// Check the return value.
|
||||||
do_check_eq(aPacket.type, "paused");
|
do_check_eq(packet.type, "paused");
|
||||||
do_check_eq(aPacket.frame.where.source.actor, source.actor);
|
do_check_eq(packet.frame.where.source.actor, source.actor);
|
||||||
do_check_eq(aPacket.frame.where.line, location.line);
|
do_check_eq(packet.frame.where.line, location.line);
|
||||||
do_check_eq(aPacket.why.type, "breakpoint");
|
do_check_eq(packet.why.type, "breakpoint");
|
||||||
do_check_eq(aPacket.why.actors[0], bpClient.actor);
|
do_check_eq(packet.why.actors[0], bpClient.actor);
|
||||||
// Check that the breakpoint worked.
|
// Check that the breakpoint worked.
|
||||||
do_check_eq(gDebuggee.a, 1);
|
do_check_eq(gDebuggee.a, 1);
|
||||||
do_check_eq(gDebuggee.b, undefined);
|
do_check_eq(gDebuggee.b, undefined);
|
||||||
|
|
||||||
// Remove the breakpoint.
|
// Remove the breakpoint.
|
||||||
bpClient.remove(function (aResponse) {
|
bpClient.remove(function (response) {
|
||||||
gThreadClient.resume(function () {
|
gThreadClient.resume(function () {
|
||||||
gClient.close().then(gCallback);
|
gClient.close().then(gCallback);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Continue until the breakpoint is hit.
|
// Continue until the breakpoint is hit.
|
||||||
|
|
@ -65,6 +65,7 @@ function test_simple_breakpoint()
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/* eslint-disable */
|
||||||
Cu.evalInSandbox(
|
Cu.evalInSandbox(
|
||||||
"var line0 = Error().lineNumber;\n" +
|
"var line0 = Error().lineNumber;\n" +
|
||||||
"debugger;\n" + // line0 + 1
|
"debugger;\n" + // line0 + 1
|
||||||
|
|
@ -72,4 +73,5 @@ function test_simple_breakpoint()
|
||||||
"var b = 2;\n", // line0 + 3
|
"var b = 2;\n", // line0 + 3
|
||||||
gDebuggee
|
gDebuggee
|
||||||
);
|
);
|
||||||
|
/* eslint-enable */
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
/* eslint-disable no-shadow */
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check that setting breakpoints when the debuggee is running works.
|
* Check that setting breakpoints when the debuggee is running works.
|
||||||
|
|
@ -10,46 +13,44 @@ var gClient;
|
||||||
var gThreadClient;
|
var gThreadClient;
|
||||||
var gCallback;
|
var gCallback;
|
||||||
|
|
||||||
function run_test()
|
function run_test() {
|
||||||
{
|
|
||||||
run_test_with_server(DebuggerServer, function () {
|
run_test_with_server(DebuggerServer, function () {
|
||||||
run_test_with_server(WorkerDebuggerServer, do_test_finished);
|
run_test_with_server(WorkerDebuggerServer, do_test_finished);
|
||||||
});
|
});
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
}
|
}
|
||||||
|
|
||||||
function run_test_with_server(aServer, aCallback)
|
function run_test_with_server(server, callback) {
|
||||||
{
|
gCallback = callback;
|
||||||
gCallback = aCallback;
|
initTestDebuggerServer(server);
|
||||||
initTestDebuggerServer(aServer);
|
gDebuggee = addTestGlobal("test-stack", server);
|
||||||
gDebuggee = addTestGlobal("test-stack", aServer);
|
gClient = new DebuggerClient(server.connectPipe());
|
||||||
gClient = new DebuggerClient(aServer.connectPipe());
|
|
||||||
gClient.connect().then(function () {
|
gClient.connect().then(function () {
|
||||||
attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) {
|
attachTestTabAndResume(gClient, "test-stack",
|
||||||
gThreadClient = aThreadClient;
|
function (response, tabClient, threadClient) {
|
||||||
test_breakpoint_running();
|
gThreadClient = threadClient;
|
||||||
});
|
test_breakpoint_running();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_breakpoint_running()
|
function test_breakpoint_running() {
|
||||||
{
|
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||||
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
|
||||||
let location = { line: gDebuggee.line0 + 3 };
|
let location = { line: gDebuggee.line0 + 3 };
|
||||||
|
|
||||||
gThreadClient.resume();
|
gThreadClient.resume();
|
||||||
|
|
||||||
// Setting the breakpoint later should interrupt the debuggee.
|
// Setting the breakpoint later should interrupt the debuggee.
|
||||||
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||||
do_check_eq(aPacket.type, "paused");
|
do_check_eq(packet.type, "paused");
|
||||||
do_check_eq(aPacket.why.type, "interrupted");
|
do_check_eq(packet.why.type, "interrupted");
|
||||||
});
|
});
|
||||||
|
|
||||||
let source = gThreadClient.source(aPacket.frame.where.source);
|
let source = gThreadClient.source(packet.frame.where.source);
|
||||||
source.setBreakpoint(location, function (aResponse) {
|
source.setBreakpoint(location, function (response) {
|
||||||
// Eval scripts don't stick around long enough for the breakpoint to be set,
|
// Eval scripts don't stick around long enough for the breakpoint to be set,
|
||||||
// so just make sure we got the expected response from the actor.
|
// so just make sure we got the expected response from the actor.
|
||||||
do_check_neq(aResponse.error, "noScript");
|
do_check_neq(response.error, "noScript");
|
||||||
|
|
||||||
do_execute_soon(function () {
|
do_execute_soon(function () {
|
||||||
gClient.close().then(gCallback);
|
gClient.close().then(gCallback);
|
||||||
|
|
@ -57,6 +58,7 @@ function test_breakpoint_running()
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/* eslint-disable */
|
||||||
Cu.evalInSandbox(
|
Cu.evalInSandbox(
|
||||||
"var line0 = Error().lineNumber;\n" +
|
"var line0 = Error().lineNumber;\n" +
|
||||||
"debugger;\n" +
|
"debugger;\n" +
|
||||||
|
|
@ -64,4 +66,5 @@ function test_breakpoint_running()
|
||||||
"var b = 2;\n", // line0 + 3
|
"var b = 2;\n", // line0 + 3
|
||||||
gDebuggee
|
gDebuggee
|
||||||
);
|
);
|
||||||
|
/* eslint-enable */
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
/* eslint-disable no-shadow, max-nested-callbacks */
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check that setting a breakpoint on a line without code will skip
|
* Check that setting a breakpoint on a line without code will skip
|
||||||
|
|
@ -12,68 +15,66 @@ var gClient;
|
||||||
var gThreadClient;
|
var gThreadClient;
|
||||||
var gCallback;
|
var gCallback;
|
||||||
|
|
||||||
function run_test()
|
function run_test() {
|
||||||
{
|
|
||||||
run_test_with_server(DebuggerServer, function () {
|
run_test_with_server(DebuggerServer, function () {
|
||||||
run_test_with_server(WorkerDebuggerServer, do_test_finished);
|
run_test_with_server(WorkerDebuggerServer, do_test_finished);
|
||||||
});
|
});
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
}
|
}
|
||||||
|
|
||||||
function run_test_with_server(aServer, aCallback)
|
function run_test_with_server(server, callback) {
|
||||||
{
|
gCallback = callback;
|
||||||
gCallback = aCallback;
|
initTestDebuggerServer(server);
|
||||||
initTestDebuggerServer(aServer);
|
gDebuggee = addTestGlobal("test-stack", server);
|
||||||
gDebuggee = addTestGlobal("test-stack", aServer);
|
gClient = new DebuggerClient(server.connectPipe());
|
||||||
gClient = new DebuggerClient(aServer.connectPipe());
|
|
||||||
gClient.connect().then(function () {
|
gClient.connect().then(function () {
|
||||||
attachTestTabAndResume(gClient,
|
attachTestTabAndResume(gClient,
|
||||||
"test-stack",
|
"test-stack",
|
||||||
function (aResponse, aTabClient, aThreadClient) {
|
function (response, tabClient, threadClient) {
|
||||||
gThreadClient = aThreadClient;
|
gThreadClient = threadClient;
|
||||||
test_skip_breakpoint();
|
test_skip_breakpoint();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var test_no_skip_breakpoint = Task.async(function*(source, location) {
|
var test_no_skip_breakpoint = Task.async(function* (source, location) {
|
||||||
let [aResponse, bpClient] = yield source.setBreakpoint(
|
let [response, bpClient] = yield source.setBreakpoint(
|
||||||
Object.assign({}, location, { noSliding: true })
|
Object.assign({}, location, { noSliding: true })
|
||||||
);
|
);
|
||||||
|
|
||||||
do_check_true(!aResponse.actualLocation);
|
do_check_true(!response.actualLocation);
|
||||||
do_check_eq(bpClient.location.line, gDebuggee.line0 + 3);
|
do_check_eq(bpClient.location.line, gDebuggee.line0 + 3);
|
||||||
yield bpClient.remove();
|
yield bpClient.remove();
|
||||||
});
|
});
|
||||||
|
|
||||||
var test_skip_breakpoint = function() {
|
var test_skip_breakpoint = function () {
|
||||||
gThreadClient.addOneTimeListener("paused", Task.async(function *(aEvent, aPacket) {
|
gThreadClient.addOneTimeListener("paused", Task.async(function* (event, packet) {
|
||||||
let location = { line: gDebuggee.line0 + 3 };
|
let location = { line: gDebuggee.line0 + 3 };
|
||||||
let source = gThreadClient.source(aPacket.frame.where.source);
|
let source = gThreadClient.source(packet.frame.where.source);
|
||||||
|
|
||||||
// First, make sure that we can disable sliding with the
|
// First, make sure that we can disable sliding with the
|
||||||
// `noSliding` option.
|
// `noSliding` option.
|
||||||
yield test_no_skip_breakpoint(source, location);
|
yield test_no_skip_breakpoint(source, location);
|
||||||
|
|
||||||
// Now make sure that the breakpoint properly slides forward one line.
|
// Now make sure that the breakpoint properly slides forward one line.
|
||||||
const [aResponse, bpClient] = yield source.setBreakpoint(location);
|
const [response, bpClient] = yield source.setBreakpoint(location);
|
||||||
do_check_true(!!aResponse.actualLocation);
|
do_check_true(!!response.actualLocation);
|
||||||
do_check_eq(aResponse.actualLocation.source.actor, source.actor);
|
do_check_eq(response.actualLocation.source.actor, source.actor);
|
||||||
do_check_eq(aResponse.actualLocation.line, location.line + 1);
|
do_check_eq(response.actualLocation.line, location.line + 1);
|
||||||
|
|
||||||
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||||
// Check the return value.
|
// Check the return value.
|
||||||
do_check_eq(aPacket.type, "paused");
|
do_check_eq(packet.type, "paused");
|
||||||
do_check_eq(aPacket.frame.where.source.actor, source.actor);
|
do_check_eq(packet.frame.where.source.actor, source.actor);
|
||||||
do_check_eq(aPacket.frame.where.line, location.line + 1);
|
do_check_eq(packet.frame.where.line, location.line + 1);
|
||||||
do_check_eq(aPacket.why.type, "breakpoint");
|
do_check_eq(packet.why.type, "breakpoint");
|
||||||
do_check_eq(aPacket.why.actors[0], bpClient.actor);
|
do_check_eq(packet.why.actors[0], bpClient.actor);
|
||||||
// Check that the breakpoint worked.
|
// Check that the breakpoint worked.
|
||||||
do_check_eq(gDebuggee.a, 1);
|
do_check_eq(gDebuggee.a, 1);
|
||||||
do_check_eq(gDebuggee.b, undefined);
|
do_check_eq(gDebuggee.b, undefined);
|
||||||
|
|
||||||
// Remove the breakpoint.
|
// Remove the breakpoint.
|
||||||
bpClient.remove(function (aResponse) {
|
bpClient.remove(function (response) {
|
||||||
gThreadClient.resume(function () {
|
gThreadClient.resume(function () {
|
||||||
gClient.close().then(gCallback);
|
gClient.close().then(gCallback);
|
||||||
});
|
});
|
||||||
|
|
@ -85,6 +86,7 @@ var test_skip_breakpoint = function() {
|
||||||
|
|
||||||
// Use `evalInSandbox` to make the debugger treat it as normal
|
// Use `evalInSandbox` to make the debugger treat it as normal
|
||||||
// globally-scoped code, where breakpoint sliding rules apply.
|
// globally-scoped code, where breakpoint sliding rules apply.
|
||||||
|
/* eslint-disable */
|
||||||
Cu.evalInSandbox(
|
Cu.evalInSandbox(
|
||||||
"var line0 = Error().lineNumber;\n" +
|
"var line0 = Error().lineNumber;\n" +
|
||||||
"debugger;\n" + // line0 + 1
|
"debugger;\n" + // line0 + 1
|
||||||
|
|
@ -93,4 +95,5 @@ var test_skip_breakpoint = function() {
|
||||||
"var b = 2;", // line0 + 4
|
"var b = 2;", // line0 + 4
|
||||||
gDebuggee
|
gDebuggee
|
||||||
);
|
);
|
||||||
}
|
/* eslint-enable */
|
||||||
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
/* eslint-disable no-shadow, max-nested-callbacks */
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check that setting a breakpoint in a line in a child script works.
|
* Check that setting a breakpoint in a line in a child script works.
|
||||||
|
|
@ -10,51 +13,49 @@ var gClient;
|
||||||
var gThreadClient;
|
var gThreadClient;
|
||||||
var gCallback;
|
var gCallback;
|
||||||
|
|
||||||
function run_test()
|
function run_test() {
|
||||||
{
|
|
||||||
run_test_with_server(DebuggerServer, function () {
|
run_test_with_server(DebuggerServer, function () {
|
||||||
run_test_with_server(WorkerDebuggerServer, do_test_finished);
|
run_test_with_server(WorkerDebuggerServer, do_test_finished);
|
||||||
});
|
});
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
}
|
}
|
||||||
|
|
||||||
function run_test_with_server(aServer, aCallback)
|
function run_test_with_server(server, callback) {
|
||||||
{
|
gCallback = callback;
|
||||||
gCallback = aCallback;
|
initTestDebuggerServer(server);
|
||||||
initTestDebuggerServer(aServer);
|
gDebuggee = addTestGlobal("test-stack", server);
|
||||||
gDebuggee = addTestGlobal("test-stack", aServer);
|
gClient = new DebuggerClient(server.connectPipe());
|
||||||
gClient = new DebuggerClient(aServer.connectPipe());
|
|
||||||
gClient.connect().then(function () {
|
gClient.connect().then(function () {
|
||||||
attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) {
|
attachTestTabAndResume(gClient, "test-stack",
|
||||||
gThreadClient = aThreadClient;
|
function (response, tabClient, threadClient) {
|
||||||
test_child_breakpoint();
|
gThreadClient = threadClient;
|
||||||
});
|
test_child_breakpoint();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_child_breakpoint()
|
function test_child_breakpoint() {
|
||||||
{
|
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||||
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
let source = gThreadClient.source(packet.frame.where.source);
|
||||||
let source = gThreadClient.source(aPacket.frame.where.source);
|
|
||||||
let location = { line: gDebuggee.line0 + 3 };
|
let location = { line: gDebuggee.line0 + 3 };
|
||||||
|
|
||||||
source.setBreakpoint(location, function (aResponse, bpClient) {
|
source.setBreakpoint(location, function (response, bpClient) {
|
||||||
// actualLocation is not returned when breakpoints don't skip forward.
|
// actualLocation is not returned when breakpoints don't skip forward.
|
||||||
do_check_eq(aResponse.actualLocation, undefined);
|
do_check_eq(response.actualLocation, undefined);
|
||||||
|
|
||||||
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||||
// Check the return value.
|
// Check the return value.
|
||||||
do_check_eq(aPacket.type, "paused");
|
do_check_eq(packet.type, "paused");
|
||||||
do_check_eq(aPacket.frame.where.source.actor, source.actor);
|
do_check_eq(packet.frame.where.source.actor, source.actor);
|
||||||
do_check_eq(aPacket.frame.where.line, location.line);
|
do_check_eq(packet.frame.where.line, location.line);
|
||||||
do_check_eq(aPacket.why.type, "breakpoint");
|
do_check_eq(packet.why.type, "breakpoint");
|
||||||
do_check_eq(aPacket.why.actors[0], bpClient.actor);
|
do_check_eq(packet.why.actors[0], bpClient.actor);
|
||||||
// Check that the breakpoint worked.
|
// Check that the breakpoint worked.
|
||||||
do_check_eq(gDebuggee.a, 1);
|
do_check_eq(gDebuggee.a, 1);
|
||||||
do_check_eq(gDebuggee.b, undefined);
|
do_check_eq(gDebuggee.b, undefined);
|
||||||
|
|
||||||
// Remove the breakpoint.
|
// Remove the breakpoint.
|
||||||
bpClient.remove(function (aResponse) {
|
bpClient.remove(function (response) {
|
||||||
gThreadClient.resume(function () {
|
gThreadClient.resume(function () {
|
||||||
gClient.close().then(gCallback);
|
gClient.close().then(gCallback);
|
||||||
});
|
});
|
||||||
|
|
@ -64,9 +65,9 @@ function test_child_breakpoint()
|
||||||
// Continue until the breakpoint is hit.
|
// Continue until the breakpoint is hit.
|
||||||
gThreadClient.resume();
|
gThreadClient.resume();
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/* eslint-disable */
|
||||||
Cu.evalInSandbox(
|
Cu.evalInSandbox(
|
||||||
"var line0 = Error().lineNumber;\n" +
|
"var line0 = Error().lineNumber;\n" +
|
||||||
"function foo() {\n" + // line0 + 1
|
"function foo() {\n" + // line0 + 1
|
||||||
|
|
@ -77,4 +78,5 @@ function test_child_breakpoint()
|
||||||
"foo();\n", // line0 + 6
|
"foo();\n", // line0 + 6
|
||||||
gDebuggee
|
gDebuggee
|
||||||
);
|
);
|
||||||
|
/* eslint-enable */
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
/* eslint-disable no-shadow, max-nested-callbacks */
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check that setting a breakpoint in a line without code in a child script
|
* Check that setting a breakpoint in a line without code in a child script
|
||||||
|
|
@ -11,52 +14,50 @@ var gClient;
|
||||||
var gThreadClient;
|
var gThreadClient;
|
||||||
var gCallback;
|
var gCallback;
|
||||||
|
|
||||||
function run_test()
|
function run_test() {
|
||||||
{
|
|
||||||
run_test_with_server(DebuggerServer, function () {
|
run_test_with_server(DebuggerServer, function () {
|
||||||
run_test_with_server(WorkerDebuggerServer, do_test_finished);
|
run_test_with_server(WorkerDebuggerServer, do_test_finished);
|
||||||
});
|
});
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
}
|
}
|
||||||
|
|
||||||
function run_test_with_server(aServer, aCallback)
|
function run_test_with_server(server, callback) {
|
||||||
{
|
gCallback = callback;
|
||||||
gCallback = aCallback;
|
initTestDebuggerServer(server);
|
||||||
initTestDebuggerServer(aServer);
|
gDebuggee = addTestGlobal("test-stack", server);
|
||||||
gDebuggee = addTestGlobal("test-stack", aServer);
|
gClient = new DebuggerClient(server.connectPipe());
|
||||||
gClient = new DebuggerClient(aServer.connectPipe());
|
|
||||||
gClient.connect().then(function () {
|
gClient.connect().then(function () {
|
||||||
attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) {
|
attachTestTabAndResume(gClient, "test-stack",
|
||||||
gThreadClient = aThreadClient;
|
function (response, tabClient, threadClient) {
|
||||||
test_child_skip_breakpoint();
|
gThreadClient = threadClient;
|
||||||
});
|
test_child_skip_breakpoint();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_child_skip_breakpoint()
|
function test_child_skip_breakpoint() {
|
||||||
{
|
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||||
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
let source = gThreadClient.source(packet.frame.where.source);
|
||||||
let source = gThreadClient.source(aPacket.frame.where.source);
|
|
||||||
let location = { line: gDebuggee.line0 + 3 };
|
let location = { line: gDebuggee.line0 + 3 };
|
||||||
|
|
||||||
source.setBreakpoint(location, function (aResponse, bpClient) {
|
source.setBreakpoint(location, function (response, bpClient) {
|
||||||
// Check that the breakpoint has properly skipped forward one line.
|
// Check that the breakpoint has properly skipped forward one line.
|
||||||
do_check_eq(aResponse.actualLocation.source.actor, source.actor);
|
do_check_eq(response.actualLocation.source.actor, source.actor);
|
||||||
do_check_eq(aResponse.actualLocation.line, location.line + 1);
|
do_check_eq(response.actualLocation.line, location.line + 1);
|
||||||
|
|
||||||
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||||
// Check the return value.
|
// Check the return value.
|
||||||
do_check_eq(aPacket.type, "paused");
|
do_check_eq(packet.type, "paused");
|
||||||
do_check_eq(aPacket.frame.where.source.actor, source.actor);
|
do_check_eq(packet.frame.where.source.actor, source.actor);
|
||||||
do_check_eq(aPacket.frame.where.line, location.line + 1);
|
do_check_eq(packet.frame.where.line, location.line + 1);
|
||||||
do_check_eq(aPacket.why.type, "breakpoint");
|
do_check_eq(packet.why.type, "breakpoint");
|
||||||
do_check_eq(aPacket.why.actors[0], bpClient.actor);
|
do_check_eq(packet.why.actors[0], bpClient.actor);
|
||||||
// Check that the breakpoint worked.
|
// Check that the breakpoint worked.
|
||||||
do_check_eq(gDebuggee.a, 1);
|
do_check_eq(gDebuggee.a, 1);
|
||||||
do_check_eq(gDebuggee.b, undefined);
|
do_check_eq(gDebuggee.b, undefined);
|
||||||
|
|
||||||
// Remove the breakpoint.
|
// Remove the breakpoint.
|
||||||
bpClient.remove(function (aResponse) {
|
bpClient.remove(function (response) {
|
||||||
gThreadClient.resume(function () {
|
gThreadClient.resume(function () {
|
||||||
gClient.close().then(gCallback);
|
gClient.close().then(gCallback);
|
||||||
});
|
});
|
||||||
|
|
@ -68,6 +69,7 @@ function test_child_skip_breakpoint()
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/* eslint-disable */
|
||||||
Cu.evalInSandbox(
|
Cu.evalInSandbox(
|
||||||
"var line0 = Error().lineNumber;\n" +
|
"var line0 = Error().lineNumber;\n" +
|
||||||
"function foo() {\n" + // line0 + 1
|
"function foo() {\n" + // line0 + 1
|
||||||
|
|
@ -79,4 +81,5 @@ function test_child_skip_breakpoint()
|
||||||
"foo();\n", // line0 + 7
|
"foo();\n", // line0 + 7
|
||||||
gDebuggee
|
gDebuggee
|
||||||
);
|
);
|
||||||
|
/* eslint-enable */
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
/* eslint-disable no-shadow, max-nested-callbacks */
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check that setting a breakpoint in a line without code in a deeply-nested
|
* Check that setting a breakpoint in a line without code in a deeply-nested
|
||||||
|
|
@ -11,52 +14,50 @@ var gClient;
|
||||||
var gThreadClient;
|
var gThreadClient;
|
||||||
var gCallback;
|
var gCallback;
|
||||||
|
|
||||||
function run_test()
|
function run_test() {
|
||||||
{
|
|
||||||
run_test_with_server(DebuggerServer, function () {
|
run_test_with_server(DebuggerServer, function () {
|
||||||
run_test_with_server(WorkerDebuggerServer, do_test_finished);
|
run_test_with_server(WorkerDebuggerServer, do_test_finished);
|
||||||
});
|
});
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
}
|
}
|
||||||
|
|
||||||
function run_test_with_server(aServer, aCallback)
|
function run_test_with_server(server, callback) {
|
||||||
{
|
gCallback = callback;
|
||||||
gCallback = aCallback;
|
initTestDebuggerServer(server);
|
||||||
initTestDebuggerServer(aServer);
|
gDebuggee = addTestGlobal("test-stack", server);
|
||||||
gDebuggee = addTestGlobal("test-stack", aServer);
|
gClient = new DebuggerClient(server.connectPipe());
|
||||||
gClient = new DebuggerClient(aServer.connectPipe());
|
|
||||||
gClient.connect().then(function () {
|
gClient.connect().then(function () {
|
||||||
attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) {
|
attachTestTabAndResume(gClient, "test-stack",
|
||||||
gThreadClient = aThreadClient;
|
function (response, tabClient, threadClient) {
|
||||||
test_nested_breakpoint();
|
gThreadClient = threadClient;
|
||||||
});
|
test_nested_breakpoint();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_nested_breakpoint()
|
function test_nested_breakpoint() {
|
||||||
{
|
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||||
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
let source = gThreadClient.source(packet.frame.where.source);
|
||||||
let source = gThreadClient.source(aPacket.frame.where.source);
|
|
||||||
let location = { line: gDebuggee.line0 + 5 };
|
let location = { line: gDebuggee.line0 + 5 };
|
||||||
|
|
||||||
source.setBreakpoint(location, function (aResponse, bpClient) {
|
source.setBreakpoint(location, function (response, bpClient) {
|
||||||
// Check that the breakpoint has properly skipped forward one line.
|
// Check that the breakpoint has properly skipped forward one line.
|
||||||
do_check_eq(aResponse.actualLocation.source.actor, source.actor);
|
do_check_eq(response.actualLocation.source.actor, source.actor);
|
||||||
do_check_eq(aResponse.actualLocation.line, location.line + 1);
|
do_check_eq(response.actualLocation.line, location.line + 1);
|
||||||
|
|
||||||
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||||
// Check the return value.
|
// Check the return value.
|
||||||
do_check_eq(aPacket.type, "paused");
|
do_check_eq(packet.type, "paused");
|
||||||
do_check_eq(aPacket.frame.where.source.actor, source.actor);
|
do_check_eq(packet.frame.where.source.actor, source.actor);
|
||||||
do_check_eq(aPacket.frame.where.line, location.line + 1);
|
do_check_eq(packet.frame.where.line, location.line + 1);
|
||||||
do_check_eq(aPacket.why.type, "breakpoint");
|
do_check_eq(packet.why.type, "breakpoint");
|
||||||
do_check_eq(aPacket.why.actors[0], bpClient.actor);
|
do_check_eq(packet.why.actors[0], bpClient.actor);
|
||||||
// Check that the breakpoint worked.
|
// Check that the breakpoint worked.
|
||||||
do_check_eq(gDebuggee.a, 1);
|
do_check_eq(gDebuggee.a, 1);
|
||||||
do_check_eq(gDebuggee.b, undefined);
|
do_check_eq(gDebuggee.b, undefined);
|
||||||
|
|
||||||
// Remove the breakpoint.
|
// Remove the breakpoint.
|
||||||
bpClient.remove(function (aResponse) {
|
bpClient.remove(function (response) {
|
||||||
gThreadClient.resume(function () {
|
gThreadClient.resume(function () {
|
||||||
gClient.close().then(gCallback);
|
gClient.close().then(gCallback);
|
||||||
});
|
});
|
||||||
|
|
@ -66,9 +67,9 @@ function test_nested_breakpoint()
|
||||||
// Continue until the breakpoint is hit.
|
// Continue until the breakpoint is hit.
|
||||||
gThreadClient.resume();
|
gThreadClient.resume();
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/* eslint-disable */
|
||||||
Cu.evalInSandbox(
|
Cu.evalInSandbox(
|
||||||
"var line0 = Error().lineNumber;\n" +
|
"var line0 = Error().lineNumber;\n" +
|
||||||
"function foo() {\n" + // line0 + 1
|
"function foo() {\n" + // line0 + 1
|
||||||
|
|
@ -86,4 +87,5 @@ function test_nested_breakpoint()
|
||||||
"foo();\n", // line0 + 13
|
"foo();\n", // line0 + 13
|
||||||
gDebuggee
|
gDebuggee
|
||||||
);
|
);
|
||||||
|
/* eslint-enable */
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
/* eslint-disable no-shadow, max-nested-callbacks */
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check that setting a breakpoint in a line without code in the second child
|
* Check that setting a breakpoint in a line without code in the second child
|
||||||
|
|
@ -11,52 +14,50 @@ var gClient;
|
||||||
var gThreadClient;
|
var gThreadClient;
|
||||||
var gCallback;
|
var gCallback;
|
||||||
|
|
||||||
function run_test()
|
function run_test() {
|
||||||
{
|
|
||||||
run_test_with_server(DebuggerServer, function () {
|
run_test_with_server(DebuggerServer, function () {
|
||||||
run_test_with_server(WorkerDebuggerServer, do_test_finished);
|
run_test_with_server(WorkerDebuggerServer, do_test_finished);
|
||||||
});
|
});
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
}
|
}
|
||||||
|
|
||||||
function run_test_with_server(aServer, aCallback)
|
function run_test_with_server(server, callback) {
|
||||||
{
|
gCallback = callback;
|
||||||
gCallback = aCallback;
|
initTestDebuggerServer(server);
|
||||||
initTestDebuggerServer(aServer);
|
gDebuggee = addTestGlobal("test-stack", server);
|
||||||
gDebuggee = addTestGlobal("test-stack", aServer);
|
gClient = new DebuggerClient(server.connectPipe());
|
||||||
gClient = new DebuggerClient(aServer.connectPipe());
|
|
||||||
gClient.connect().then(function () {
|
gClient.connect().then(function () {
|
||||||
attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) {
|
attachTestTabAndResume(gClient, "test-stack",
|
||||||
gThreadClient = aThreadClient;
|
function (response, tabClient, threadClient) {
|
||||||
test_second_child_skip_breakpoint();
|
gThreadClient = threadClient;
|
||||||
});
|
test_second_child_skip_breakpoint();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_second_child_skip_breakpoint()
|
function test_second_child_skip_breakpoint() {
|
||||||
{
|
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||||
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
let source = gThreadClient.source(packet.frame.where.source);
|
||||||
let source = gThreadClient.source(aPacket.frame.where.source);
|
|
||||||
let location = { line: gDebuggee.line0 + 6 };
|
let location = { line: gDebuggee.line0 + 6 };
|
||||||
|
|
||||||
source.setBreakpoint(location, function (aResponse, bpClient) {
|
source.setBreakpoint(location, function (response, bpClient) {
|
||||||
// Check that the breakpoint has properly skipped forward one line.
|
// Check that the breakpoint has properly skipped forward one line.
|
||||||
do_check_eq(aResponse.actualLocation.source.actor, source.actor);
|
do_check_eq(response.actualLocation.source.actor, source.actor);
|
||||||
do_check_eq(aResponse.actualLocation.line, location.line + 1);
|
do_check_eq(response.actualLocation.line, location.line + 1);
|
||||||
|
|
||||||
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||||
// Check the return value.
|
// Check the return value.
|
||||||
do_check_eq(aPacket.type, "paused");
|
do_check_eq(packet.type, "paused");
|
||||||
do_check_eq(aPacket.frame.where.source.actor, source.actor);
|
do_check_eq(packet.frame.where.source.actor, source.actor);
|
||||||
do_check_eq(aPacket.frame.where.line, location.line + 1);
|
do_check_eq(packet.frame.where.line, location.line + 1);
|
||||||
do_check_eq(aPacket.why.type, "breakpoint");
|
do_check_eq(packet.why.type, "breakpoint");
|
||||||
do_check_eq(aPacket.why.actors[0], bpClient.actor);
|
do_check_eq(packet.why.actors[0], bpClient.actor);
|
||||||
// Check that the breakpoint worked.
|
// Check that the breakpoint worked.
|
||||||
do_check_eq(gDebuggee.a, 1);
|
do_check_eq(gDebuggee.a, 1);
|
||||||
do_check_eq(gDebuggee.b, undefined);
|
do_check_eq(gDebuggee.b, undefined);
|
||||||
|
|
||||||
// Remove the breakpoint.
|
// Remove the breakpoint.
|
||||||
bpClient.remove(function (aResponse) {
|
bpClient.remove(function (response) {
|
||||||
gThreadClient.resume(function () {
|
gThreadClient.resume(function () {
|
||||||
gClient.close().then(gCallback);
|
gClient.close().then(gCallback);
|
||||||
});
|
});
|
||||||
|
|
@ -68,6 +69,7 @@ function test_second_child_skip_breakpoint()
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/* eslint-disable */
|
||||||
Cu.evalInSandbox(
|
Cu.evalInSandbox(
|
||||||
"var line0 = Error().lineNumber;\n" +
|
"var line0 = Error().lineNumber;\n" +
|
||||||
"function foo() {\n" + // line0 + 1
|
"function foo() {\n" + // line0 + 1
|
||||||
|
|
@ -82,4 +84,5 @@ function test_second_child_skip_breakpoint()
|
||||||
"foo();\n", // line0 + 10
|
"foo();\n", // line0 + 10
|
||||||
gDebuggee
|
gDebuggee
|
||||||
);
|
);
|
||||||
|
/* eslint-enable */
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
/* eslint-disable no-shadow, max-nested-callbacks */
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check that setting a breakpoint in a line without code in a child script
|
* Check that setting a breakpoint in a line without code in a child script
|
||||||
|
|
@ -11,60 +14,58 @@ var gClient;
|
||||||
var gThreadClient;
|
var gThreadClient;
|
||||||
var gCallback;
|
var gCallback;
|
||||||
|
|
||||||
function run_test()
|
function run_test() {
|
||||||
{
|
|
||||||
run_test_with_server(DebuggerServer, function () {
|
run_test_with_server(DebuggerServer, function () {
|
||||||
run_test_with_server(WorkerDebuggerServer, do_test_finished);
|
run_test_with_server(WorkerDebuggerServer, do_test_finished);
|
||||||
});
|
});
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
}
|
}
|
||||||
|
|
||||||
function run_test_with_server(aServer, aCallback)
|
function run_test_with_server(server, callback) {
|
||||||
{
|
gCallback = callback;
|
||||||
gCallback = aCallback;
|
initTestDebuggerServer(server);
|
||||||
initTestDebuggerServer(aServer);
|
gDebuggee = addTestGlobal("test-stack", server);
|
||||||
gDebuggee = addTestGlobal("test-stack", aServer);
|
gClient = new DebuggerClient(server.connectPipe());
|
||||||
gClient = new DebuggerClient(aServer.connectPipe());
|
|
||||||
gClient.connect().then(function () {
|
gClient.connect().then(function () {
|
||||||
attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) {
|
attachTestTabAndResume(gClient, "test-stack",
|
||||||
gThreadClient = aThreadClient;
|
function (response, tabClient, threadClient) {
|
||||||
test_child_skip_breakpoint();
|
gThreadClient = threadClient;
|
||||||
});
|
test_child_skip_breakpoint();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_child_skip_breakpoint()
|
function test_child_skip_breakpoint() {
|
||||||
{
|
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||||
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
gThreadClient.eval(packet.frame.actor, "foo", function (response) {
|
||||||
gThreadClient.eval(aPacket.frame.actor, "foo", function (aResponse) {
|
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||||
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
let obj = gThreadClient.pauseGrip(packet.why.frameFinished.return);
|
||||||
let obj = gThreadClient.pauseGrip(aPacket.why.frameFinished.return);
|
|
||||||
obj.getDefinitionSite(runWithBreakpoint);
|
obj.getDefinitionSite(runWithBreakpoint);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
function runWithBreakpoint(aPacket) {
|
function runWithBreakpoint(packet) {
|
||||||
let source = gThreadClient.source(aPacket.source);
|
let source = gThreadClient.source(packet.source);
|
||||||
let location = { line: gDebuggee.line0 + 3 };
|
let location = { line: gDebuggee.line0 + 3 };
|
||||||
|
|
||||||
source.setBreakpoint(location, function (aResponse, bpClient) {
|
source.setBreakpoint(location, function (response, bpClient) {
|
||||||
// Check that the breakpoint has properly skipped forward one line.
|
// Check that the breakpoint has properly skipped forward one line.
|
||||||
do_check_eq(aResponse.actualLocation.source.actor, source.actor);
|
do_check_eq(response.actualLocation.source.actor, source.actor);
|
||||||
do_check_eq(aResponse.actualLocation.line, location.line + 1);
|
do_check_eq(response.actualLocation.line, location.line + 1);
|
||||||
|
|
||||||
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||||
// Check the return value.
|
// Check the return value.
|
||||||
do_check_eq(aPacket.type, "paused");
|
do_check_eq(packet.type, "paused");
|
||||||
do_check_eq(aPacket.frame.where.source.actor, source.actor);
|
do_check_eq(packet.frame.where.source.actor, source.actor);
|
||||||
do_check_eq(aPacket.frame.where.line, location.line + 1);
|
do_check_eq(packet.frame.where.line, location.line + 1);
|
||||||
do_check_eq(aPacket.why.type, "breakpoint");
|
do_check_eq(packet.why.type, "breakpoint");
|
||||||
do_check_eq(aPacket.why.actors[0], bpClient.actor);
|
do_check_eq(packet.why.actors[0], bpClient.actor);
|
||||||
// Check that the breakpoint worked.
|
// Check that the breakpoint worked.
|
||||||
do_check_eq(gDebuggee.a, 1);
|
do_check_eq(gDebuggee.a, 1);
|
||||||
do_check_eq(gDebuggee.b, undefined);
|
do_check_eq(gDebuggee.b, undefined);
|
||||||
|
|
||||||
// Remove the breakpoint.
|
// Remove the breakpoint.
|
||||||
bpClient.remove(function (aResponse) {
|
bpClient.remove(function (response) {
|
||||||
gThreadClient.resume(function () {
|
gThreadClient.resume(function () {
|
||||||
gClient.close().then(gCallback);
|
gClient.close().then(gCallback);
|
||||||
});
|
});
|
||||||
|
|
@ -77,6 +78,7 @@ function test_child_skip_breakpoint()
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/* eslint-disable */
|
||||||
Cu.evalInSandbox("var line0 = Error().lineNumber;\n" +
|
Cu.evalInSandbox("var line0 = Error().lineNumber;\n" +
|
||||||
"function foo() {\n" + // line0 + 1
|
"function foo() {\n" + // line0 + 1
|
||||||
" this.a = 1;\n" + // line0 + 2
|
" this.a = 1;\n" + // line0 + 2
|
||||||
|
|
@ -93,4 +95,5 @@ function test_child_skip_breakpoint()
|
||||||
gDebuggee,
|
gDebuggee,
|
||||||
"1.7",
|
"1.7",
|
||||||
"script2.js");
|
"script2.js");
|
||||||
|
/* eslint-enable */
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
/* eslint-disable no-shadow, max-nested-callbacks */
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check that removing a breakpoint works.
|
* Check that removing a breakpoint works.
|
||||||
|
|
@ -10,51 +13,49 @@ var gClient;
|
||||||
var gThreadClient;
|
var gThreadClient;
|
||||||
var gCallback;
|
var gCallback;
|
||||||
|
|
||||||
function run_test()
|
function run_test() {
|
||||||
{
|
|
||||||
run_test_with_server(DebuggerServer, function () {
|
run_test_with_server(DebuggerServer, function () {
|
||||||
run_test_with_server(WorkerDebuggerServer, do_test_finished);
|
run_test_with_server(WorkerDebuggerServer, do_test_finished);
|
||||||
});
|
});
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
}
|
}
|
||||||
|
|
||||||
function run_test_with_server(aServer, aCallback)
|
function run_test_with_server(server, callback) {
|
||||||
{
|
gCallback = callback;
|
||||||
gCallback = aCallback;
|
initTestDebuggerServer(server);
|
||||||
initTestDebuggerServer(aServer);
|
gDebuggee = addTestGlobal("test-stack", server);
|
||||||
gDebuggee = addTestGlobal("test-stack", aServer);
|
gClient = new DebuggerClient(server.connectPipe());
|
||||||
gClient = new DebuggerClient(aServer.connectPipe());
|
|
||||||
gClient.connect().then(function () {
|
gClient.connect().then(function () {
|
||||||
attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) {
|
attachTestTabAndResume(gClient, "test-stack",
|
||||||
gThreadClient = aThreadClient;
|
function (response, tabClient, threadClient) {
|
||||||
test_remove_breakpoint();
|
gThreadClient = threadClient;
|
||||||
});
|
test_remove_breakpoint();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_remove_breakpoint()
|
function test_remove_breakpoint() {
|
||||||
{
|
|
||||||
let done = false;
|
let done = false;
|
||||||
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||||
let source = gThreadClient.source(aPacket.frame.where.source);
|
let source = gThreadClient.source(packet.frame.where.source);
|
||||||
let location = { line: gDebuggee.line0 + 2 };
|
let location = { line: gDebuggee.line0 + 2 };
|
||||||
|
|
||||||
source.setBreakpoint(location, function (aResponse, bpClient) {
|
source.setBreakpoint(location, function (response, bpClient) {
|
||||||
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||||
// Check the return value.
|
// Check the return value.
|
||||||
do_check_eq(aPacket.type, "paused");
|
do_check_eq(packet.type, "paused");
|
||||||
do_check_eq(aPacket.frame.where.source.actor, source.actor);
|
do_check_eq(packet.frame.where.source.actor, source.actor);
|
||||||
do_check_eq(aPacket.frame.where.line, location.line);
|
do_check_eq(packet.frame.where.line, location.line);
|
||||||
do_check_eq(aPacket.why.type, "breakpoint");
|
do_check_eq(packet.why.type, "breakpoint");
|
||||||
do_check_eq(aPacket.why.actors[0], bpClient.actor);
|
do_check_eq(packet.why.actors[0], bpClient.actor);
|
||||||
// Check that the breakpoint worked.
|
// Check that the breakpoint worked.
|
||||||
do_check_eq(gDebuggee.a, undefined);
|
do_check_eq(gDebuggee.a, undefined);
|
||||||
|
|
||||||
// Remove the breakpoint.
|
// Remove the breakpoint.
|
||||||
bpClient.remove(function (aResponse) {
|
bpClient.remove(function (response) {
|
||||||
done = true;
|
done = true;
|
||||||
gThreadClient.addOneTimeListener("paused",
|
gThreadClient.addOneTimeListener("paused",
|
||||||
function (aEvent, aPacket) {
|
function (event, packet) {
|
||||||
// The breakpoint should not be hit again.
|
// The breakpoint should not be hit again.
|
||||||
gThreadClient.resume(function () {
|
gThreadClient.resume(function () {
|
||||||
do_check_true(false);
|
do_check_true(false);
|
||||||
|
|
@ -62,15 +63,13 @@ function test_remove_breakpoint()
|
||||||
});
|
});
|
||||||
gThreadClient.resume();
|
gThreadClient.resume();
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
// Continue until the breakpoint is hit.
|
// Continue until the breakpoint is hit.
|
||||||
gThreadClient.resume();
|
gThreadClient.resume();
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/* eslint-disable */
|
||||||
Cu.evalInSandbox("var line0 = Error().lineNumber;\n" +
|
Cu.evalInSandbox("var line0 = Error().lineNumber;\n" +
|
||||||
"function foo(stop) {\n" + // line0 + 1
|
"function foo(stop) {\n" + // line0 + 1
|
||||||
" this.a = 1;\n" + // line0 + 2
|
" this.a = 1;\n" + // line0 + 2
|
||||||
|
|
@ -81,6 +80,7 @@ function test_remove_breakpoint()
|
||||||
"debugger;\n" + // line1 + 7
|
"debugger;\n" + // line1 + 7
|
||||||
"foo();\n", // line1 + 8
|
"foo();\n", // line1 + 8
|
||||||
gDebuggee);
|
gDebuggee);
|
||||||
|
/* eslint-enable */
|
||||||
if (!done) {
|
if (!done) {
|
||||||
do_check_true(false);
|
do_check_true(false);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
/* eslint-disable no-shadow, max-nested-callbacks */
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check that setting a breakpoint in a line with multiple entry points
|
* Check that setting a breakpoint in a line with multiple entry points
|
||||||
|
|
@ -11,56 +14,54 @@ var gClient;
|
||||||
var gThreadClient;
|
var gThreadClient;
|
||||||
var gCallback;
|
var gCallback;
|
||||||
|
|
||||||
function run_test()
|
function run_test() {
|
||||||
{
|
|
||||||
run_test_with_server(DebuggerServer, function () {
|
run_test_with_server(DebuggerServer, function () {
|
||||||
run_test_with_server(WorkerDebuggerServer, do_test_finished);
|
run_test_with_server(WorkerDebuggerServer, do_test_finished);
|
||||||
});
|
});
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
}
|
}
|
||||||
|
|
||||||
function run_test_with_server(aServer, aCallback)
|
function run_test_with_server(server, callback) {
|
||||||
{
|
gCallback = callback;
|
||||||
gCallback = aCallback;
|
initTestDebuggerServer(server);
|
||||||
initTestDebuggerServer(aServer);
|
gDebuggee = addTestGlobal("test-stack", server);
|
||||||
gDebuggee = addTestGlobal("test-stack", aServer);
|
gClient = new DebuggerClient(server.connectPipe());
|
||||||
gClient = new DebuggerClient(aServer.connectPipe());
|
|
||||||
gClient.connect().then(function () {
|
gClient.connect().then(function () {
|
||||||
attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) {
|
attachTestTabAndResume(gClient, "test-stack",
|
||||||
gThreadClient = aThreadClient;
|
function (response, tabClient, threadClient) {
|
||||||
test_child_breakpoint();
|
gThreadClient = threadClient;
|
||||||
});
|
test_child_breakpoint();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_child_breakpoint()
|
function test_child_breakpoint() {
|
||||||
{
|
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||||
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
let source = gThreadClient.source(packet.frame.where.source);
|
||||||
let source = gThreadClient.source(aPacket.frame.where.source);
|
|
||||||
let location = { line: gDebuggee.line0 + 3 };
|
let location = { line: gDebuggee.line0 + 3 };
|
||||||
|
|
||||||
source.setBreakpoint(location, function (aResponse, bpClient) {
|
source.setBreakpoint(location, function (response, bpClient) {
|
||||||
// actualLocation is not returned when breakpoints don't skip forward.
|
// actualLocation is not returned when breakpoints don't skip forward.
|
||||||
do_check_eq(aResponse.actualLocation, undefined);
|
do_check_eq(response.actualLocation, undefined);
|
||||||
|
|
||||||
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||||
// Check the return value.
|
// Check the return value.
|
||||||
do_check_eq(aPacket.type, "paused");
|
do_check_eq(packet.type, "paused");
|
||||||
do_check_eq(aPacket.why.type, "breakpoint");
|
do_check_eq(packet.why.type, "breakpoint");
|
||||||
do_check_eq(aPacket.why.actors[0], bpClient.actor);
|
do_check_eq(packet.why.actors[0], bpClient.actor);
|
||||||
// Check that the breakpoint worked.
|
// Check that the breakpoint worked.
|
||||||
do_check_eq(gDebuggee.i, 0);
|
do_check_eq(gDebuggee.i, 0);
|
||||||
|
|
||||||
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||||
// Check the return value.
|
// Check the return value.
|
||||||
do_check_eq(aPacket.type, "paused");
|
do_check_eq(packet.type, "paused");
|
||||||
do_check_eq(aPacket.why.type, "breakpoint");
|
do_check_eq(packet.why.type, "breakpoint");
|
||||||
do_check_eq(aPacket.why.actors[0], bpClient.actor);
|
do_check_eq(packet.why.actors[0], bpClient.actor);
|
||||||
// Check that the breakpoint worked.
|
// Check that the breakpoint worked.
|
||||||
do_check_eq(gDebuggee.i, 1);
|
do_check_eq(gDebuggee.i, 1);
|
||||||
|
|
||||||
// Remove the breakpoint.
|
// Remove the breakpoint.
|
||||||
bpClient.remove(function (aResponse) {
|
bpClient.remove(function (response) {
|
||||||
gThreadClient.resume(function () {
|
gThreadClient.resume(function () {
|
||||||
gClient.close().then(gCallback);
|
gClient.close().then(gCallback);
|
||||||
});
|
});
|
||||||
|
|
@ -69,16 +70,13 @@ function test_child_breakpoint()
|
||||||
|
|
||||||
// Continue until the breakpoint is hit again.
|
// Continue until the breakpoint is hit again.
|
||||||
gThreadClient.resume();
|
gThreadClient.resume();
|
||||||
|
|
||||||
});
|
});
|
||||||
// Continue until the breakpoint is hit.
|
// Continue until the breakpoint is hit.
|
||||||
gThreadClient.resume();
|
gThreadClient.resume();
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/* eslint-disable */
|
||||||
Cu.evalInSandbox("var line0 = Error().lineNumber;\n" +
|
Cu.evalInSandbox("var line0 = Error().lineNumber;\n" +
|
||||||
"debugger;\n" + // line0 + 1
|
"debugger;\n" + // line0 + 1
|
||||||
"var a, i = 0;\n" + // line0 + 2
|
"var a, i = 0;\n" + // line0 + 2
|
||||||
|
|
@ -86,4 +84,5 @@ function test_child_breakpoint()
|
||||||
" a = i;\n" + // line0 + 4
|
" a = i;\n" + // line0 + 4
|
||||||
"}\n", // line0 + 5
|
"}\n", // line0 + 5
|
||||||
gDebuggee);
|
gDebuggee);
|
||||||
|
/* eslint-enable */
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
/* eslint-disable no-shadow, max-nested-callbacks */
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Make sure that setting a breakpoint in a line with bytecodes in multiple
|
* Make sure that setting a breakpoint in a line with bytecodes in multiple
|
||||||
|
|
@ -11,57 +14,55 @@ var gClient;
|
||||||
var gThreadClient;
|
var gThreadClient;
|
||||||
var gCallback;
|
var gCallback;
|
||||||
|
|
||||||
function run_test()
|
function run_test() {
|
||||||
{
|
|
||||||
run_test_with_server(DebuggerServer, function () {
|
run_test_with_server(DebuggerServer, function () {
|
||||||
run_test_with_server(WorkerDebuggerServer, do_test_finished);
|
run_test_with_server(WorkerDebuggerServer, do_test_finished);
|
||||||
});
|
});
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
}
|
}
|
||||||
|
|
||||||
function run_test_with_server(aServer, aCallback)
|
function run_test_with_server(server, callback) {
|
||||||
{
|
gCallback = callback;
|
||||||
gCallback = aCallback;
|
initTestDebuggerServer(server);
|
||||||
initTestDebuggerServer(aServer);
|
gDebuggee = addTestGlobal("test-stack", server);
|
||||||
gDebuggee = addTestGlobal("test-stack", aServer);
|
gClient = new DebuggerClient(server.connectPipe());
|
||||||
gClient = new DebuggerClient(aServer.connectPipe());
|
|
||||||
gClient.connect().then(function () {
|
gClient.connect().then(function () {
|
||||||
attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) {
|
attachTestTabAndResume(gClient, "test-stack",
|
||||||
gThreadClient = aThreadClient;
|
function (response, tabClient, threadClient) {
|
||||||
test_child_breakpoint();
|
gThreadClient = threadClient;
|
||||||
});
|
test_child_breakpoint();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_child_breakpoint()
|
function test_child_breakpoint() {
|
||||||
{
|
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||||
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
let source = gThreadClient.source(packet.frame.where.source);
|
||||||
let source = gThreadClient.source(aPacket.frame.where.source);
|
|
||||||
let location = { line: gDebuggee.line0 + 2 };
|
let location = { line: gDebuggee.line0 + 2 };
|
||||||
|
|
||||||
source.setBreakpoint(location, function (aResponse, bpClient) {
|
source.setBreakpoint(location, function (response, bpClient) {
|
||||||
// actualLocation is not returned when breakpoints don't skip forward.
|
// actualLocation is not returned when breakpoints don't skip forward.
|
||||||
do_check_eq(aResponse.actualLocation, undefined);
|
do_check_eq(response.actualLocation, undefined);
|
||||||
|
|
||||||
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||||
// Check the return value.
|
// Check the return value.
|
||||||
do_check_eq(aPacket.type, "paused");
|
do_check_eq(packet.type, "paused");
|
||||||
do_check_eq(aPacket.why.type, "breakpoint");
|
do_check_eq(packet.why.type, "breakpoint");
|
||||||
do_check_eq(aPacket.why.actors[0], bpClient.actor);
|
do_check_eq(packet.why.actors[0], bpClient.actor);
|
||||||
// Check that the breakpoint worked.
|
// Check that the breakpoint worked.
|
||||||
do_check_eq(gDebuggee.a, undefined);
|
do_check_eq(gDebuggee.a, undefined);
|
||||||
|
|
||||||
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||||
// Check the return value.
|
// Check the return value.
|
||||||
do_check_eq(aPacket.type, "paused");
|
do_check_eq(packet.type, "paused");
|
||||||
do_check_eq(aPacket.why.type, "breakpoint");
|
do_check_eq(packet.why.type, "breakpoint");
|
||||||
do_check_eq(aPacket.why.actors[0], bpClient.actor);
|
do_check_eq(packet.why.actors[0], bpClient.actor);
|
||||||
// Check that the breakpoint worked.
|
// Check that the breakpoint worked.
|
||||||
do_check_eq(gDebuggee.a.b, 1);
|
do_check_eq(gDebuggee.a.b, 1);
|
||||||
do_check_eq(gDebuggee.res, undefined);
|
do_check_eq(gDebuggee.res, undefined);
|
||||||
|
|
||||||
// Remove the breakpoint.
|
// Remove the breakpoint.
|
||||||
bpClient.remove(function (aResponse) {
|
bpClient.remove(function (response) {
|
||||||
gThreadClient.resume(function () {
|
gThreadClient.resume(function () {
|
||||||
gClient.close().then(gCallback);
|
gClient.close().then(gCallback);
|
||||||
});
|
});
|
||||||
|
|
@ -70,19 +71,17 @@ function test_child_breakpoint()
|
||||||
|
|
||||||
// Continue until the breakpoint is hit again.
|
// Continue until the breakpoint is hit again.
|
||||||
gThreadClient.resume();
|
gThreadClient.resume();
|
||||||
|
|
||||||
});
|
});
|
||||||
// Continue until the breakpoint is hit.
|
// Continue until the breakpoint is hit.
|
||||||
gThreadClient.resume();
|
gThreadClient.resume();
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/* eslint-disable */
|
||||||
Cu.evalInSandbox("var line0 = Error().lineNumber;\n" +
|
Cu.evalInSandbox("var line0 = Error().lineNumber;\n" +
|
||||||
"debugger;\n" + // line0 + 1
|
"debugger;\n" + // line0 + 1
|
||||||
"var a = { b: 1, f: function() { return 2; } };\n" + // line0+2
|
"var a = { b: 1, f: function() { return 2; } };\n" + // line0+2
|
||||||
"var res = a.f();\n", // line0 + 3
|
"var res = a.f();\n", // line0 + 3
|
||||||
gDebuggee);
|
gDebuggee);
|
||||||
|
/* eslint-enable */
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
/* eslint-disable no-shadow, max-nested-callbacks */
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Make sure that setting a breakpoint twice in a line without bytecodes works
|
* Make sure that setting a breakpoint twice in a line without bytecodes works
|
||||||
|
|
@ -14,47 +17,45 @@ var gBpActor;
|
||||||
var gCount;
|
var gCount;
|
||||||
var gCallback;
|
var gCallback;
|
||||||
|
|
||||||
function run_test()
|
function run_test() {
|
||||||
{
|
|
||||||
run_test_with_server(DebuggerServer, function () {
|
run_test_with_server(DebuggerServer, function () {
|
||||||
run_test_with_server(WorkerDebuggerServer, do_test_finished);
|
run_test_with_server(WorkerDebuggerServer, do_test_finished);
|
||||||
});
|
});
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
}
|
}
|
||||||
|
|
||||||
function run_test_with_server(aServer, aCallback)
|
function run_test_with_server(server, callback) {
|
||||||
{
|
gCallback = callback;
|
||||||
gCallback = aCallback;
|
|
||||||
gCount = 1;
|
gCount = 1;
|
||||||
initTestDebuggerServer(aServer);
|
initTestDebuggerServer(server);
|
||||||
gDebuggee = addTestGlobal("test-stack", aServer);
|
gDebuggee = addTestGlobal("test-stack", server);
|
||||||
gClient = new DebuggerClient(aServer.connectPipe());
|
gClient = new DebuggerClient(server.connectPipe());
|
||||||
gClient.connect().then(function () {
|
gClient.connect().then(function () {
|
||||||
attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) {
|
attachTestTabAndResume(gClient, "test-stack",
|
||||||
gThreadClient = aThreadClient;
|
function (response, tabClient, threadClient) {
|
||||||
test_child_skip_breakpoint();
|
gThreadClient = threadClient;
|
||||||
});
|
test_child_skip_breakpoint();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_child_skip_breakpoint()
|
function test_child_skip_breakpoint() {
|
||||||
{
|
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||||
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
let source = gThreadClient.source(packet.frame.where.source);
|
||||||
let source = gThreadClient.source(aPacket.frame.where.source);
|
|
||||||
let location = { line: gDebuggee.line0 + 3};
|
let location = { line: gDebuggee.line0 + 3};
|
||||||
|
|
||||||
source.setBreakpoint(location, function (aResponse, bpClient) {
|
source.setBreakpoint(location, function (response, bpClient) {
|
||||||
// Check that the breakpoint has properly skipped forward one line.
|
// Check that the breakpoint has properly skipped forward one line.
|
||||||
do_check_eq(aResponse.actualLocation.source.actor, source.actor);
|
do_check_eq(response.actualLocation.source.actor, source.actor);
|
||||||
do_check_eq(aResponse.actualLocation.line, location.line + 1);
|
do_check_eq(response.actualLocation.line, location.line + 1);
|
||||||
gBpActor = aResponse.actor;
|
gBpActor = response.actor;
|
||||||
|
|
||||||
// Set more breakpoints at the same location.
|
// Set more breakpoints at the same location.
|
||||||
set_breakpoints(source, location);
|
set_breakpoints(source, location);
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/* eslint-disable */
|
||||||
Cu.evalInSandbox("var line0 = Error().lineNumber;\n" +
|
Cu.evalInSandbox("var line0 = Error().lineNumber;\n" +
|
||||||
"function foo() {\n" + // line0 + 1
|
"function foo() {\n" + // line0 + 1
|
||||||
" this.a = 1;\n" + // line0 + 2
|
" this.a = 1;\n" + // line0 + 2
|
||||||
|
|
@ -64,17 +65,18 @@ function test_child_skip_breakpoint()
|
||||||
"debugger;\n" + // line0 + 6
|
"debugger;\n" + // line0 + 6
|
||||||
"foo();\n", // line0 + 7
|
"foo();\n", // line0 + 7
|
||||||
gDebuggee);
|
gDebuggee);
|
||||||
|
/* eslint-enable */
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set many breakpoints at the same location.
|
// Set many breakpoints at the same location.
|
||||||
function set_breakpoints(source, location) {
|
function set_breakpoints(source, location) {
|
||||||
do_check_neq(gCount, NUM_BREAKPOINTS);
|
do_check_neq(gCount, NUM_BREAKPOINTS);
|
||||||
source.setBreakpoint(location, function (aResponse, bpClient) {
|
source.setBreakpoint(location, function (response, bpClient) {
|
||||||
// Check that the breakpoint has properly skipped forward one line.
|
// Check that the breakpoint has properly skipped forward one line.
|
||||||
do_check_eq(aResponse.actualLocation.source.actor, source.actor);
|
do_check_eq(response.actualLocation.source.actor, source.actor);
|
||||||
do_check_eq(aResponse.actualLocation.line, location.line + 1);
|
do_check_eq(response.actualLocation.line, location.line + 1);
|
||||||
// Check that the same breakpoint actor was returned.
|
// Check that the same breakpoint actor was returned.
|
||||||
do_check_eq(aResponse.actor, gBpActor);
|
do_check_eq(response.actor, gBpActor);
|
||||||
|
|
||||||
if (++gCount < NUM_BREAKPOINTS) {
|
if (++gCount < NUM_BREAKPOINTS) {
|
||||||
set_breakpoints(source, location);
|
set_breakpoints(source, location);
|
||||||
|
|
@ -83,18 +85,18 @@ function set_breakpoints(source, location) {
|
||||||
|
|
||||||
// After setting all the breakpoints, check that only one has effectively
|
// After setting all the breakpoints, check that only one has effectively
|
||||||
// remained.
|
// remained.
|
||||||
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||||
// Check the return value.
|
// Check the return value.
|
||||||
do_check_eq(aPacket.type, "paused");
|
do_check_eq(packet.type, "paused");
|
||||||
do_check_eq(aPacket.frame.where.source.actor, source.actor);
|
do_check_eq(packet.frame.where.source.actor, source.actor);
|
||||||
do_check_eq(aPacket.frame.where.line, location.line + 1);
|
do_check_eq(packet.frame.where.line, location.line + 1);
|
||||||
do_check_eq(aPacket.why.type, "breakpoint");
|
do_check_eq(packet.why.type, "breakpoint");
|
||||||
do_check_eq(aPacket.why.actors[0], bpClient.actor);
|
do_check_eq(packet.why.actors[0], bpClient.actor);
|
||||||
// Check that the breakpoint worked.
|
// Check that the breakpoint worked.
|
||||||
do_check_eq(gDebuggee.a, 1);
|
do_check_eq(gDebuggee.a, 1);
|
||||||
do_check_eq(gDebuggee.b, undefined);
|
do_check_eq(gDebuggee.b, undefined);
|
||||||
|
|
||||||
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||||
// We don't expect any more pauses after the breakpoint was hit once.
|
// We don't expect any more pauses after the breakpoint was hit once.
|
||||||
do_check_true(false);
|
do_check_true(false);
|
||||||
});
|
});
|
||||||
|
|
@ -104,10 +106,8 @@ function set_breakpoints(source, location) {
|
||||||
gClient.close().then(gCallback);
|
gClient.close().then(gCallback);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
// Continue until the breakpoint is hit.
|
// Continue until the breakpoint is hit.
|
||||||
gThreadClient.resume();
|
gThreadClient.resume();
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
/* eslint-disable no-shadow */
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check that execution doesn't pause twice while stepping, when encountering
|
* Check that execution doesn't pause twice while stepping, when encountering
|
||||||
|
|
@ -11,80 +14,78 @@ var gClient;
|
||||||
var gThreadClient;
|
var gThreadClient;
|
||||||
var gCallback;
|
var gCallback;
|
||||||
|
|
||||||
function run_test()
|
function run_test() {
|
||||||
{
|
|
||||||
run_test_with_server(DebuggerServer, function () {
|
run_test_with_server(DebuggerServer, function () {
|
||||||
run_test_with_server(WorkerDebuggerServer, do_test_finished);
|
run_test_with_server(WorkerDebuggerServer, do_test_finished);
|
||||||
});
|
});
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
}
|
}
|
||||||
|
|
||||||
function run_test_with_server(aServer, aCallback)
|
function run_test_with_server(server, callback) {
|
||||||
{
|
gCallback = callback;
|
||||||
gCallback = aCallback;
|
initTestDebuggerServer(server);
|
||||||
initTestDebuggerServer(aServer);
|
gDebuggee = addTestGlobal("test-stack", server);
|
||||||
gDebuggee = addTestGlobal("test-stack", aServer);
|
gClient = new DebuggerClient(server.connectPipe());
|
||||||
gClient = new DebuggerClient(aServer.connectPipe());
|
|
||||||
gClient.connect().then(function () {
|
gClient.connect().then(function () {
|
||||||
attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) {
|
attachTestTabAndResume(gClient, "test-stack",
|
||||||
gThreadClient = aThreadClient;
|
function (response, tabClient, threadClient) {
|
||||||
test_simple_breakpoint();
|
gThreadClient = threadClient;
|
||||||
});
|
test_simple_breakpoint();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_simple_breakpoint()
|
function test_simple_breakpoint() {
|
||||||
{
|
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||||
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
let source = gThreadClient.source(packet.frame.where.source);
|
||||||
let source = gThreadClient.source(aPacket.frame.where.source);
|
|
||||||
let location = { line: gDebuggee.line0 + 2 };
|
let location = { line: gDebuggee.line0 + 2 };
|
||||||
|
|
||||||
source.setBreakpoint(location, Task.async(function* (aResponse, bpClient) {
|
source.setBreakpoint(location, Task.async(function* (response, bpClient) {
|
||||||
const testCallbacks = [
|
const testCallbacks = [
|
||||||
function (aPacket) {
|
function (packet) {
|
||||||
// Check that the stepping worked.
|
// Check that the stepping worked.
|
||||||
do_check_eq(aPacket.frame.where.line, gDebuggee.line0 + 5);
|
do_check_eq(packet.frame.where.line, gDebuggee.line0 + 5);
|
||||||
do_check_eq(aPacket.why.type, "resumeLimit");
|
do_check_eq(packet.why.type, "resumeLimit");
|
||||||
},
|
},
|
||||||
function (aPacket) {
|
function (packet) {
|
||||||
// Entered the foo function call frame.
|
// Entered the foo function call frame.
|
||||||
do_check_eq(aPacket.frame.where.line, location.line);
|
do_check_eq(packet.frame.where.line, location.line);
|
||||||
do_check_neq(aPacket.why.type, "breakpoint");
|
do_check_neq(packet.why.type, "breakpoint");
|
||||||
do_check_eq(aPacket.why.type, "resumeLimit");
|
do_check_eq(packet.why.type, "resumeLimit");
|
||||||
},
|
},
|
||||||
function (aPacket) {
|
function (packet) {
|
||||||
// At the end of the foo function call frame.
|
// At the end of the foo function call frame.
|
||||||
do_check_eq(aPacket.frame.where.line, gDebuggee.line0 + 3);
|
do_check_eq(packet.frame.where.line, gDebuggee.line0 + 3);
|
||||||
do_check_neq(aPacket.why.type, "breakpoint");
|
do_check_neq(packet.why.type, "breakpoint");
|
||||||
do_check_eq(aPacket.why.type, "resumeLimit");
|
do_check_eq(packet.why.type, "resumeLimit");
|
||||||
},
|
},
|
||||||
function (aPacket) {
|
function (packet) {
|
||||||
// Check that the breakpoint wasn't the reason for this pause, but
|
// Check that the breakpoint wasn't the reason for this pause, but
|
||||||
// that the frame is about to be popped while stepping.
|
// that the frame is about to be popped while stepping.
|
||||||
do_check_eq(aPacket.frame.where.line, gDebuggee.line0 + 3);
|
do_check_eq(packet.frame.where.line, gDebuggee.line0 + 3);
|
||||||
do_check_neq(aPacket.why.type, "breakpoint");
|
do_check_neq(packet.why.type, "breakpoint");
|
||||||
do_check_eq(aPacket.why.type, "resumeLimit");
|
do_check_eq(packet.why.type, "resumeLimit");
|
||||||
do_check_eq(aPacket.why.frameFinished.return.type, "undefined");
|
do_check_eq(packet.why.frameFinished.return.type, "undefined");
|
||||||
},
|
},
|
||||||
function (aPacket) {
|
function (packet) {
|
||||||
// The foo function call frame was just popped from the stack.
|
// The foo function call frame was just popped from the stack.
|
||||||
do_check_eq(gDebuggee.a, 1);
|
do_check_eq(gDebuggee.a, 1);
|
||||||
do_check_eq(gDebuggee.b, undefined);
|
do_check_eq(gDebuggee.b, undefined);
|
||||||
do_check_eq(aPacket.frame.where.line, gDebuggee.line0 + 5);
|
do_check_eq(packet.frame.where.line, gDebuggee.line0 + 5);
|
||||||
do_check_eq(aPacket.why.type, "resumeLimit");
|
do_check_eq(packet.why.type, "resumeLimit");
|
||||||
do_check_eq(aPacket.poppedFrames.length, 1);
|
do_check_eq(packet.poppedFrames.length, 1);
|
||||||
},
|
},
|
||||||
function (aPacket) {
|
function (packet) {
|
||||||
// Check that the debugger statement wasn't the reason for this pause.
|
// Check that the debugger statement wasn't the reason for this pause.
|
||||||
do_check_eq(aPacket.frame.where.line, gDebuggee.line0 + 6);
|
do_check_eq(packet.frame.where.line, gDebuggee.line0 + 6);
|
||||||
do_check_neq(aPacket.why.type, "debuggerStatement");
|
do_check_neq(packet.why.type, "debuggerStatement");
|
||||||
do_check_eq(aPacket.why.type, "resumeLimit");
|
do_check_eq(packet.why.type, "resumeLimit");
|
||||||
},
|
},
|
||||||
function (aPacket) {
|
function (packet) {
|
||||||
// Check that the debugger statement wasn't the reason for this pause.
|
// Check that the debugger statement wasn't the reason for this pause.
|
||||||
do_check_eq(aPacket.frame.where.line, gDebuggee.line0 + 7);
|
do_check_eq(packet.frame.where.line, gDebuggee.line0 + 7);
|
||||||
do_check_neq(aPacket.why.type, "debuggerStatement");
|
do_check_neq(packet.why.type, "debuggerStatement");
|
||||||
do_check_eq(aPacket.why.type, "resumeLimit");
|
do_check_eq(packet.why.type, "resumeLimit");
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
@ -103,6 +104,7 @@ function test_simple_breakpoint()
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/* eslint-disable */
|
||||||
Cu.evalInSandbox("var line0 = Error().lineNumber;\n" +
|
Cu.evalInSandbox("var line0 = Error().lineNumber;\n" +
|
||||||
"function foo() {\n" + // line0 + 1
|
"function foo() {\n" + // line0 + 1
|
||||||
" this.a = 1;\n" + // line0 + 2 <-- Breakpoint is set here.
|
" this.a = 1;\n" + // line0 + 2 <-- Breakpoint is set here.
|
||||||
|
|
@ -112,4 +114,5 @@ function test_simple_breakpoint()
|
||||||
"debugger;\n" + // line0 + 6
|
"debugger;\n" + // line0 + 6
|
||||||
"var b = 2;\n", // line0 + 7
|
"var b = 2;\n", // line0 + 7
|
||||||
gDebuggee);
|
gDebuggee);
|
||||||
|
/* eslint-enable */
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
/* eslint-disable no-shadow */
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check that a breakpoint or a debugger statement cause execution to pause even
|
* Check that a breakpoint or a debugger statement cause execution to pause even
|
||||||
|
|
@ -11,78 +14,76 @@ var gClient;
|
||||||
var gThreadClient;
|
var gThreadClient;
|
||||||
var gCallback;
|
var gCallback;
|
||||||
|
|
||||||
function run_test()
|
function run_test() {
|
||||||
{
|
|
||||||
run_test_with_server(DebuggerServer, function () {
|
run_test_with_server(DebuggerServer, function () {
|
||||||
run_test_with_server(WorkerDebuggerServer, do_test_finished);
|
run_test_with_server(WorkerDebuggerServer, do_test_finished);
|
||||||
});
|
});
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
}
|
}
|
||||||
|
|
||||||
function run_test_with_server(aServer, aCallback)
|
function run_test_with_server(server, callback) {
|
||||||
{
|
gCallback = callback;
|
||||||
gCallback = aCallback;
|
initTestDebuggerServer(server);
|
||||||
initTestDebuggerServer(aServer);
|
gDebuggee = addTestGlobal("test-stack", server);
|
||||||
gDebuggee = addTestGlobal("test-stack", aServer);
|
gClient = new DebuggerClient(server.connectPipe());
|
||||||
gClient = new DebuggerClient(aServer.connectPipe());
|
|
||||||
gClient.connect().then(function () {
|
gClient.connect().then(function () {
|
||||||
attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) {
|
attachTestTabAndResume(gClient, "test-stack",
|
||||||
gThreadClient = aThreadClient;
|
function (response, tabClient, threadClient) {
|
||||||
test_simple_breakpoint();
|
gThreadClient = threadClient;
|
||||||
});
|
test_simple_breakpoint();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_simple_breakpoint()
|
function test_simple_breakpoint() {
|
||||||
{
|
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||||
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
let source = gThreadClient.source(packet.frame.where.source);
|
||||||
let source = gThreadClient.source(aPacket.frame.where.source);
|
|
||||||
let location = { line: gDebuggee.line0 + 2 };
|
let location = { line: gDebuggee.line0 + 2 };
|
||||||
|
|
||||||
source.setBreakpoint(location, Task.async(function* (aResponse, bpClient) {
|
source.setBreakpoint(location, Task.async(function* (response, bpClient) {
|
||||||
const testCallbacks = [
|
const testCallbacks = [
|
||||||
function (aPacket) {
|
function (packet) {
|
||||||
// Check that the stepping worked.
|
// Check that the stepping worked.
|
||||||
do_check_eq(aPacket.frame.where.line, gDebuggee.line0 + 5);
|
do_check_eq(packet.frame.where.line, gDebuggee.line0 + 5);
|
||||||
do_check_eq(aPacket.why.type, "resumeLimit");
|
do_check_eq(packet.why.type, "resumeLimit");
|
||||||
},
|
},
|
||||||
function (aPacket) {
|
function (packet) {
|
||||||
// Reached the breakpoint.
|
// Reached the breakpoint.
|
||||||
do_check_eq(aPacket.frame.where.line, location.line);
|
do_check_eq(packet.frame.where.line, location.line);
|
||||||
do_check_eq(aPacket.why.type, "breakpoint");
|
do_check_eq(packet.why.type, "breakpoint");
|
||||||
do_check_neq(aPacket.why.type, "resumeLimit");
|
do_check_neq(packet.why.type, "resumeLimit");
|
||||||
},
|
},
|
||||||
function (aPacket) {
|
function (packet) {
|
||||||
// Stepped to the closing brace of the function.
|
// Stepped to the closing brace of the function.
|
||||||
do_check_eq(aPacket.frame.where.line, gDebuggee.line0 + 3);
|
do_check_eq(packet.frame.where.line, gDebuggee.line0 + 3);
|
||||||
do_check_eq(aPacket.why.type, "resumeLimit");
|
do_check_eq(packet.why.type, "resumeLimit");
|
||||||
},
|
},
|
||||||
function (aPacket) {
|
function (packet) {
|
||||||
// The frame is about to be popped while stepping.
|
// The frame is about to be popped while stepping.
|
||||||
do_check_eq(aPacket.frame.where.line, gDebuggee.line0 + 3);
|
do_check_eq(packet.frame.where.line, gDebuggee.line0 + 3);
|
||||||
do_check_neq(aPacket.why.type, "breakpoint");
|
do_check_neq(packet.why.type, "breakpoint");
|
||||||
do_check_eq(aPacket.why.type, "resumeLimit");
|
do_check_eq(packet.why.type, "resumeLimit");
|
||||||
do_check_eq(aPacket.why.frameFinished.return.type, "undefined");
|
do_check_eq(packet.why.frameFinished.return.type, "undefined");
|
||||||
},
|
},
|
||||||
function (aPacket) {
|
function (packet) {
|
||||||
// The foo function call frame was just popped from the stack.
|
// The foo function call frame was just popped from the stack.
|
||||||
do_check_eq(gDebuggee.a, 1);
|
do_check_eq(gDebuggee.a, 1);
|
||||||
do_check_eq(gDebuggee.b, undefined);
|
do_check_eq(gDebuggee.b, undefined);
|
||||||
do_check_eq(aPacket.frame.where.line, gDebuggee.line0 + 5);
|
do_check_eq(packet.frame.where.line, gDebuggee.line0 + 5);
|
||||||
do_check_eq(aPacket.why.type, "resumeLimit");
|
do_check_eq(packet.why.type, "resumeLimit");
|
||||||
do_check_eq(aPacket.poppedFrames.length, 1);
|
do_check_eq(packet.poppedFrames.length, 1);
|
||||||
},
|
},
|
||||||
function (aPacket) {
|
function (packet) {
|
||||||
// Check that the debugger statement wasn't the reason for this pause.
|
// Check that the debugger statement wasn't the reason for this pause.
|
||||||
do_check_eq(aPacket.frame.where.line, gDebuggee.line0 + 6);
|
do_check_eq(packet.frame.where.line, gDebuggee.line0 + 6);
|
||||||
do_check_neq(aPacket.why.type, "debuggerStatement");
|
do_check_neq(packet.why.type, "debuggerStatement");
|
||||||
do_check_eq(aPacket.why.type, "resumeLimit");
|
do_check_eq(packet.why.type, "resumeLimit");
|
||||||
},
|
},
|
||||||
function (aPacket) {
|
function (packet) {
|
||||||
// Check that the debugger statement wasn't the reason for this pause.
|
// Check that the debugger statement wasn't the reason for this pause.
|
||||||
do_check_eq(aPacket.frame.where.line, gDebuggee.line0 + 7);
|
do_check_eq(packet.frame.where.line, gDebuggee.line0 + 7);
|
||||||
do_check_neq(aPacket.why.type, "debuggerStatement");
|
do_check_neq(packet.why.type, "debuggerStatement");
|
||||||
do_check_eq(aPacket.why.type, "resumeLimit");
|
do_check_eq(packet.why.type, "resumeLimit");
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
@ -101,6 +102,7 @@ function test_simple_breakpoint()
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/* eslint-disable */
|
||||||
Cu.evalInSandbox("var line0 = Error().lineNumber;\n" +
|
Cu.evalInSandbox("var line0 = Error().lineNumber;\n" +
|
||||||
"function foo() {\n" + // line0 + 1
|
"function foo() {\n" + // line0 + 1
|
||||||
" this.a = 1;\n" + // line0 + 2 <-- Breakpoint is set here.
|
" this.a = 1;\n" + // line0 + 2 <-- Breakpoint is set here.
|
||||||
|
|
@ -110,4 +112,5 @@ function test_simple_breakpoint()
|
||||||
"debugger;\n" + // line0 + 6
|
"debugger;\n" + // line0 + 6
|
||||||
"var b = 2;\n", // line0 + 7
|
"var b = 2;\n", // line0 + 7
|
||||||
gDebuggee);
|
gDebuggee);
|
||||||
|
/* eslint-enable */
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check that adding a breakpoint in the same place returns the same actor.
|
* Check that adding a breakpoint in the same place returns the same actor.
|
||||||
*/
|
*/
|
||||||
|
|
@ -9,16 +11,16 @@ var gDebuggee;
|
||||||
var gClient;
|
var gClient;
|
||||||
var gThreadClient;
|
var gThreadClient;
|
||||||
|
|
||||||
function run_test()
|
function run_test() {
|
||||||
{
|
|
||||||
initTestDebuggerServer();
|
initTestDebuggerServer();
|
||||||
gDebuggee = addTestGlobal("test-stack");
|
gDebuggee = addTestGlobal("test-stack");
|
||||||
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
||||||
gClient.connect().then(function () {
|
gClient.connect().then(function () {
|
||||||
attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) {
|
attachTestTabAndResume(gClient, "test-stack",
|
||||||
gThreadClient = aThreadClient;
|
function (response, tabClient, threadClient) {
|
||||||
testSameBreakpoint();
|
gThreadClient = threadClient;
|
||||||
});
|
testSameBreakpoint();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
}
|
}
|
||||||
|
|
@ -34,10 +36,11 @@ const testSameBreakpoint = Task.async(function* () {
|
||||||
line: 2
|
line: 2
|
||||||
};
|
};
|
||||||
|
|
||||||
let [firstResponse, firstBpClient] = yield setBreakpoint(source, wholeLineLocation);
|
let [, firstBpClient] = yield setBreakpoint(source, wholeLineLocation);
|
||||||
let [secondResponse, secondBpClient] = yield setBreakpoint(source, wholeLineLocation);
|
let [, secondBpClient] = yield setBreakpoint(source, wholeLineLocation);
|
||||||
|
|
||||||
do_check_eq(firstBpClient.actor, secondBpClient.actor, "Should get the same actor w/ whole line breakpoints");
|
do_check_eq(firstBpClient.actor, secondBpClient.actor,
|
||||||
|
"Should get the same actor w/ whole line breakpoints");
|
||||||
|
|
||||||
// Specific column
|
// Specific column
|
||||||
|
|
||||||
|
|
@ -46,15 +49,17 @@ const testSameBreakpoint = Task.async(function* () {
|
||||||
column: 6
|
column: 6
|
||||||
};
|
};
|
||||||
|
|
||||||
[firstResponse, firstBpClient] = yield setBreakpoint(source, columnLocation);
|
[, firstBpClient] = yield setBreakpoint(source, columnLocation);
|
||||||
[secondResponse, secondBpClient] = yield setBreakpoint(source, columnLocation);
|
[, secondBpClient] = yield setBreakpoint(source, columnLocation);
|
||||||
|
|
||||||
do_check_eq(secondBpClient.actor, secondBpClient.actor, "Should get the same actor column breakpoints");
|
do_check_eq(secondBpClient.actor, secondBpClient.actor,
|
||||||
|
"Should get the same actor column breakpoints");
|
||||||
|
|
||||||
finishClient(gClient);
|
finishClient(gClient);
|
||||||
});
|
});
|
||||||
|
|
||||||
function evalCode() {
|
function evalCode() {
|
||||||
|
/* eslint-disable */
|
||||||
Components.utils.evalInSandbox(
|
Components.utils.evalInSandbox(
|
||||||
"" + function doStuff(k) { // line 1
|
"" + function doStuff(k) { // line 1
|
||||||
let arg = 15; // line 2 - Step in here
|
let arg = 15; // line 2 - Step in here
|
||||||
|
|
@ -66,4 +71,5 @@ function evalCode() {
|
||||||
SOURCE_URL,
|
SOURCE_URL,
|
||||||
1
|
1
|
||||||
);
|
);
|
||||||
|
/* eslint-enable */
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
/* eslint-disable no-shadow, max-nested-callbacks */
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check that we can set breakpoints in columns, not just lines.
|
* Check that we can set breakpoints in columns, not just lines.
|
||||||
|
|
@ -10,57 +13,54 @@ var gClient;
|
||||||
var gThreadClient;
|
var gThreadClient;
|
||||||
var gCallback;
|
var gCallback;
|
||||||
|
|
||||||
function run_test()
|
function run_test() {
|
||||||
{
|
|
||||||
run_test_with_server(DebuggerServer, function () {
|
run_test_with_server(DebuggerServer, function () {
|
||||||
run_test_with_server(WorkerDebuggerServer, do_test_finished);
|
run_test_with_server(WorkerDebuggerServer, do_test_finished);
|
||||||
});
|
});
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
}
|
}
|
||||||
|
|
||||||
function run_test_with_server(aServer, aCallback)
|
function run_test_with_server(server, callback) {
|
||||||
{
|
gCallback = callback;
|
||||||
gCallback = aCallback;
|
initTestDebuggerServer(server);
|
||||||
initTestDebuggerServer(aServer);
|
gDebuggee = addTestGlobal("test-breakpoints", server);
|
||||||
gDebuggee = addTestGlobal("test-breakpoints", aServer);
|
gClient = new DebuggerClient(server.connectPipe());
|
||||||
gClient = new DebuggerClient(aServer.connectPipe());
|
|
||||||
gClient.connect().then(function () {
|
gClient.connect().then(function () {
|
||||||
attachTestTabAndResume(gClient,
|
attachTestTabAndResume(gClient,
|
||||||
"test-breakpoints",
|
"test-breakpoints",
|
||||||
function (aResponse, aTabClient, aThreadClient) {
|
function (response, tabClient, threadClient) {
|
||||||
gThreadClient = aThreadClient;
|
gThreadClient = threadClient;
|
||||||
test_column_breakpoint();
|
test_column_breakpoint();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_column_breakpoint()
|
function test_column_breakpoint() {
|
||||||
{
|
|
||||||
// Debugger statement
|
// Debugger statement
|
||||||
gClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
gClient.addOneTimeListener("paused", function (event, packet) {
|
||||||
let source = gThreadClient.source(aPacket.frame.where.source);
|
let source = gThreadClient.source(packet.frame.where.source);
|
||||||
let location = {
|
let location = {
|
||||||
line: gDebuggee.line0 + 1,
|
line: gDebuggee.line0 + 1,
|
||||||
column: 55
|
column: 55
|
||||||
};
|
};
|
||||||
let timesBreakpointHit = 0;
|
let timesBreakpointHit = 0;
|
||||||
|
|
||||||
source.setBreakpoint(location, function (aResponse, bpClient) {
|
source.setBreakpoint(location, function (response, bpClient) {
|
||||||
gThreadClient.addListener("paused", function onPaused(aEvent, aPacket) {
|
gThreadClient.addListener("paused", function onPaused(event, packet) {
|
||||||
do_check_eq(aPacket.type, "paused");
|
do_check_eq(packet.type, "paused");
|
||||||
do_check_eq(aPacket.why.type, "breakpoint");
|
do_check_eq(packet.why.type, "breakpoint");
|
||||||
do_check_eq(aPacket.why.actors[0], bpClient.actor);
|
do_check_eq(packet.why.actors[0], bpClient.actor);
|
||||||
do_check_eq(aPacket.frame.where.source.actor, source.actor);
|
do_check_eq(packet.frame.where.source.actor, source.actor);
|
||||||
do_check_eq(aPacket.frame.where.line, location.line);
|
do_check_eq(packet.frame.where.line, location.line);
|
||||||
do_check_eq(aPacket.frame.where.column, location.column);
|
do_check_eq(packet.frame.where.column, location.column);
|
||||||
|
|
||||||
do_check_eq(gDebuggee.acc, timesBreakpointHit);
|
do_check_eq(gDebuggee.acc, timesBreakpointHit);
|
||||||
do_check_eq(aPacket.frame.environment.bindings.variables.i.value,
|
do_check_eq(packet.frame.environment.bindings.variables.i.value,
|
||||||
timesBreakpointHit);
|
timesBreakpointHit);
|
||||||
|
|
||||||
if (++timesBreakpointHit === 3) {
|
if (++timesBreakpointHit === 3) {
|
||||||
gThreadClient.removeListener("paused", onPaused);
|
gThreadClient.removeListener("paused", onPaused);
|
||||||
bpClient.remove(function (aResponse) {
|
bpClient.remove(function (response) {
|
||||||
gThreadClient.resume(() => gClient.close().then(gCallback));
|
gThreadClient.resume(() => gClient.close().then(gCallback));
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -71,13 +71,13 @@ function test_column_breakpoint()
|
||||||
// Continue until the breakpoint is hit.
|
// Continue until the breakpoint is hit.
|
||||||
gThreadClient.resume();
|
gThreadClient.resume();
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/* eslint-disable */
|
||||||
Components.utils.evalInSandbox(
|
Components.utils.evalInSandbox(
|
||||||
"var line0 = Error().lineNumber;\n" +
|
"var line0 = Error().lineNumber;\n" +
|
||||||
"(function () { debugger; this.acc = 0; for (var i = 0; i < 3; i++) this.acc++; }());",
|
"(function () { debugger; this.acc = 0; for (var i = 0; i < 3; i++) this.acc++; }());",
|
||||||
gDebuggee
|
gDebuggee
|
||||||
);
|
);
|
||||||
|
/* eslint-enable */
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
/* eslint-disable no-shadow */
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test that when we add 2 breakpoints to the same line at different columns and
|
* Test that when we add 2 breakpoints to the same line at different columns and
|
||||||
|
|
@ -11,23 +14,22 @@ var gClient;
|
||||||
var gThreadClient;
|
var gThreadClient;
|
||||||
var gCallback;
|
var gCallback;
|
||||||
|
|
||||||
function run_test()
|
function run_test() {
|
||||||
{
|
|
||||||
run_test_with_server(DebuggerServer, do_test_finished);
|
run_test_with_server(DebuggerServer, do_test_finished);
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
}
|
}
|
||||||
|
|
||||||
function run_test_with_server(aServer, aCallback)
|
function run_test_with_server(server, callback) {
|
||||||
{
|
gCallback = callback;
|
||||||
gCallback = aCallback;
|
initTestDebuggerServer(server);
|
||||||
initTestDebuggerServer(aServer);
|
gDebuggee = addTestGlobal("test-breakpoints", server);
|
||||||
gDebuggee = addTestGlobal("test-breakpoints", aServer);
|
gClient = new DebuggerClient(server.connectPipe());
|
||||||
gClient = new DebuggerClient(aServer.connectPipe());
|
|
||||||
gClient.connect().then(function () {
|
gClient.connect().then(function () {
|
||||||
attachTestTabAndResume(gClient, "test-breakpoints", function (aResponse, aTabClient, aThreadClient) {
|
attachTestTabAndResume(gClient, "test-breakpoints",
|
||||||
gThreadClient = aThreadClient;
|
function (response, tabClient, threadClient) {
|
||||||
test_breakpoints_columns();
|
gThreadClient = threadClient;
|
||||||
});
|
test_breakpoints_columns();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -56,44 +58,44 @@ function test_breakpoints_columns() {
|
||||||
Components.utils.evalInSandbox(code, gDebuggee, "1.8", "http://example.com/", 1);
|
Components.utils.evalInSandbox(code, gDebuggee, "1.8", "http://example.com/", 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
function set_breakpoints(aEvent, aPacket) {
|
function set_breakpoints(event, packet) {
|
||||||
let first, second;
|
let first, second;
|
||||||
let source = gThreadClient.source(aPacket.frame.where.source);
|
let source = gThreadClient.source(packet.frame.where.source);
|
||||||
|
|
||||||
source.setBreakpoint(firstLocation, function ({ error, actualLocation },
|
source.setBreakpoint(firstLocation, function ({ error, actualLocation },
|
||||||
aBreakpointClient) {
|
breakpointClient) {
|
||||||
do_check_true(!error, "Should not get an error setting the breakpoint");
|
do_check_true(!error, "Should not get an error setting the breakpoint");
|
||||||
do_check_true(!actualLocation, "Should not get an actualLocation");
|
do_check_true(!actualLocation, "Should not get an actualLocation");
|
||||||
first = aBreakpointClient;
|
first = breakpointClient;
|
||||||
|
|
||||||
source.setBreakpoint(secondLocation, function ({ error, actualLocation },
|
source.setBreakpoint(secondLocation, function ({ error, actualLocation },
|
||||||
aBreakpointClient) {
|
breakpointClient) {
|
||||||
do_check_true(!error, "Should not get an error setting the breakpoint");
|
do_check_true(!error, "Should not get an error setting the breakpoint");
|
||||||
do_check_true(!actualLocation, "Should not get an actualLocation");
|
do_check_true(!actualLocation, "Should not get an actualLocation");
|
||||||
second = aBreakpointClient;
|
second = breakpointClient;
|
||||||
|
|
||||||
test_different_actors(first, second);
|
test_different_actors(first, second);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_different_actors(aFirst, aSecond) {
|
function test_different_actors(first, second) {
|
||||||
do_check_neq(aFirst.actor, aSecond.actor,
|
do_check_neq(first.actor, second.actor,
|
||||||
"Each breakpoint should have a different actor");
|
"Each breakpoint should have a different actor");
|
||||||
test_remove_one(aFirst, aSecond);
|
test_remove_one(first, second);
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_remove_one(aFirst, aSecond) {
|
function test_remove_one(first, second) {
|
||||||
aFirst.remove(function ({error}) {
|
first.remove(function ({error}) {
|
||||||
do_check_true(!error, "Should not get an error removing a breakpoint");
|
do_check_true(!error, "Should not get an error removing a breakpoint");
|
||||||
|
|
||||||
let hitSecond;
|
let hitSecond;
|
||||||
gClient.addListener("paused", function _onPaused(aEvent, {why, frame}) {
|
gClient.addListener("paused", function _onPaused(event, {why, frame}) {
|
||||||
if (why.type == "breakpoint") {
|
if (why.type == "breakpoint") {
|
||||||
hitSecond = true;
|
hitSecond = true;
|
||||||
do_check_eq(why.actors.length, 1,
|
do_check_eq(why.actors.length, 1,
|
||||||
"Should only be paused because of one breakpoint actor");
|
"Should only be paused because of one breakpoint actor");
|
||||||
do_check_eq(why.actors[0], aSecond.actor,
|
do_check_eq(why.actors[0], second.actor,
|
||||||
"Should be paused because of the correct breakpoint actor");
|
"Should be paused because of the correct breakpoint actor");
|
||||||
do_check_eq(frame.where.line, secondLocation.line,
|
do_check_eq(frame.where.line, secondLocation.line,
|
||||||
"Should be at the right line");
|
"Should be at the right line");
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check that we only break on offsets that are entry points for the line we are
|
* Check that we only break on offsets that are entry points for the line we are
|
||||||
* breaking on. Bug 907278.
|
* breaking on. Bug 907278.
|
||||||
|
|
@ -11,26 +13,24 @@ var gClient;
|
||||||
var gThreadClient;
|
var gThreadClient;
|
||||||
var gCallback;
|
var gCallback;
|
||||||
|
|
||||||
function run_test()
|
function run_test() {
|
||||||
{
|
|
||||||
run_test_with_server(DebuggerServer, function () {
|
run_test_with_server(DebuggerServer, function () {
|
||||||
run_test_with_server(WorkerDebuggerServer, do_test_finished);
|
run_test_with_server(WorkerDebuggerServer, do_test_finished);
|
||||||
});
|
});
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
}
|
}
|
||||||
|
|
||||||
function run_test_with_server(aServer, aCallback)
|
function run_test_with_server(server, callback) {
|
||||||
{
|
gCallback = callback;
|
||||||
gCallback = aCallback;
|
initTestDebuggerServer(server);
|
||||||
initTestDebuggerServer(aServer);
|
gDebuggee = addTestGlobal("test-breakpoints", server);
|
||||||
gDebuggee = addTestGlobal("test-breakpoints", aServer);
|
|
||||||
gDebuggee.console = { log: x => void x };
|
gDebuggee.console = { log: x => void x };
|
||||||
gClient = new DebuggerClient(aServer.connectPipe());
|
gClient = new DebuggerClient(server.connectPipe());
|
||||||
gClient.connect().then(function () {
|
gClient.connect().then(function () {
|
||||||
attachTestTabAndResume(gClient,
|
attachTestTabAndResume(gClient,
|
||||||
"test-breakpoints",
|
"test-breakpoints",
|
||||||
function (aResponse, aTabClient, aThreadClient) {
|
function (response, tabClient, threadClient) {
|
||||||
gThreadClient = aThreadClient;
|
gThreadClient = threadClient;
|
||||||
setUpCode();
|
setUpCode();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
@ -51,8 +51,8 @@ function setUpCode() {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function setBreakpoint(aEvent, aPacket) {
|
function setBreakpoint(event, packet) {
|
||||||
let source = gThreadClient.source(aPacket.frame.where.source);
|
let source = gThreadClient.source(packet.frame.where.source);
|
||||||
gClient.addOneTimeListener("resumed", runCode);
|
gClient.addOneTimeListener("resumed", runCode);
|
||||||
|
|
||||||
source.setBreakpoint({ line: 2 }, ({ error }) => {
|
source.setBreakpoint({ line: 2 }, ({ error }) => {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Make sure that setting a breakpoint in a not-yet-existing script doesn't throw
|
* Make sure that setting a breakpoint in a not-yet-existing script doesn't throw
|
||||||
* an error (see bug 897567). Also make sure that this breakpoint works.
|
* an error (see bug 897567). Also make sure that this breakpoint works.
|
||||||
|
|
@ -9,28 +11,24 @@
|
||||||
var gDebuggee;
|
var gDebuggee;
|
||||||
var gClient;
|
var gClient;
|
||||||
var gThreadClient;
|
var gThreadClient;
|
||||||
var gCallback;
|
|
||||||
|
|
||||||
function run_test()
|
function run_test() {
|
||||||
{
|
|
||||||
run_test_with_server(DebuggerServer, function () {
|
run_test_with_server(DebuggerServer, function () {
|
||||||
run_test_with_server(WorkerDebuggerServer, do_test_finished);
|
run_test_with_server(WorkerDebuggerServer, do_test_finished);
|
||||||
});
|
});
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
}
|
}
|
||||||
|
|
||||||
function run_test_with_server(aServer, aCallback)
|
function run_test_with_server(server, callback) {
|
||||||
{
|
initTestDebuggerServer(server);
|
||||||
gCallback = aCallback;
|
gDebuggee = addTestGlobal("test-breakpoints", server);
|
||||||
initTestDebuggerServer(aServer);
|
|
||||||
gDebuggee = addTestGlobal("test-breakpoints", aServer);
|
|
||||||
gDebuggee.console = { log: x => void x };
|
gDebuggee.console = { log: x => void x };
|
||||||
gClient = new DebuggerClient(aServer.connectPipe());
|
gClient = new DebuggerClient(server.connectPipe());
|
||||||
gClient.connect().then(function () {
|
gClient.connect().then(function () {
|
||||||
attachTestTabAndResume(gClient,
|
attachTestTabAndResume(gClient,
|
||||||
"test-breakpoints",
|
"test-breakpoints",
|
||||||
function (aResponse, aTabClient, aThreadClient) {
|
function (response, tabClient, threadClient) {
|
||||||
gThreadClient = aThreadClient;
|
gThreadClient = threadClient;
|
||||||
testBreakpoint();
|
testBreakpoint();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
@ -39,6 +37,7 @@ function run_test_with_server(aServer, aCallback)
|
||||||
const URL = "test.js";
|
const URL = "test.js";
|
||||||
|
|
||||||
function setUpCode() {
|
function setUpCode() {
|
||||||
|
/* eslint-disable */
|
||||||
Cu.evalInSandbox(
|
Cu.evalInSandbox(
|
||||||
"" + function test() { // 1
|
"" + function test() { // 1
|
||||||
var a = 1; // 2
|
var a = 1; // 2
|
||||||
|
|
@ -49,11 +48,12 @@ function setUpCode() {
|
||||||
"1.8",
|
"1.8",
|
||||||
URL
|
URL
|
||||||
);
|
);
|
||||||
|
/* eslint-enable */
|
||||||
}
|
}
|
||||||
|
|
||||||
const testBreakpoint = Task.async(function* () {
|
const testBreakpoint = Task.async(function* () {
|
||||||
let source = yield getSource(gThreadClient, URL);
|
let source = yield getSource(gThreadClient, URL);
|
||||||
let [response, bpClient] = yield setBreakpoint(source, {line: 2});
|
let [response, ] = yield setBreakpoint(source, {line: 2});
|
||||||
ok(!response.error);
|
ok(!response.error);
|
||||||
|
|
||||||
let actor = response.actor;
|
let actor = response.actor;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Verify that when two of the "same" source are loaded concurrently (like e10s
|
* Verify that when two of the "same" source are loaded concurrently (like e10s
|
||||||
* frame scripts), breakpoints get hit in scripts defined by all sources.
|
* frame scripts), breakpoints get hit in scripts defined by all sources.
|
||||||
|
|
@ -8,11 +10,8 @@
|
||||||
|
|
||||||
var gDebuggee;
|
var gDebuggee;
|
||||||
var gClient;
|
var gClient;
|
||||||
var gTraceClient;
|
|
||||||
var gThreadClient;
|
|
||||||
|
|
||||||
function run_test()
|
function run_test() {
|
||||||
{
|
|
||||||
initTestDebuggerServer();
|
initTestDebuggerServer();
|
||||||
gDebuggee = addTestGlobal("test-breakpoints");
|
gDebuggee = addTestGlobal("test-breakpoints");
|
||||||
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
||||||
|
|
@ -22,7 +21,8 @@ function run_test()
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
}
|
}
|
||||||
|
|
||||||
const testBreakpoint = Task.async(function* (threadResponse, tabClient, threadClient, tabResponse) {
|
const testBreakpoint = Task.async(function* (threadResponse, tabClient,
|
||||||
|
threadClient, tabResponse) {
|
||||||
evalSetupCode();
|
evalSetupCode();
|
||||||
|
|
||||||
// Load the test source once.
|
// Load the test source once.
|
||||||
|
|
@ -34,7 +34,7 @@ const testBreakpoint = Task.async(function* (threadResponse, tabClient, threadCl
|
||||||
// Set a breakpoint in the test source.
|
// Set a breakpoint in the test source.
|
||||||
|
|
||||||
const source = yield getSource(threadClient, "test.js");
|
const source = yield getSource(threadClient, "test.js");
|
||||||
const [response, bpClient] = yield setBreakpoint(source, {
|
const [response, ] = yield setBreakpoint(source, {
|
||||||
line: 3
|
line: 3
|
||||||
});
|
});
|
||||||
ok(!response.error, "Shouldn't get an error setting the BP.");
|
ok(!response.error, "Shouldn't get an error setting the BP.");
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bug 1122064 - make sure that scripts introduced via onNewScripts
|
* Bug 1122064 - make sure that scripts introduced via onNewScripts
|
||||||
* properly populate the `ScriptStore` with all there nested child
|
* properly populate the `ScriptStore` with all there nested child
|
||||||
|
|
@ -10,27 +12,23 @@
|
||||||
var gDebuggee;
|
var gDebuggee;
|
||||||
var gClient;
|
var gClient;
|
||||||
var gThreadClient;
|
var gThreadClient;
|
||||||
var gCallback;
|
|
||||||
|
|
||||||
function run_test()
|
function run_test() {
|
||||||
{
|
|
||||||
run_test_with_server(DebuggerServer, function () {
|
run_test_with_server(DebuggerServer, function () {
|
||||||
run_test_with_server(WorkerDebuggerServer, do_test_finished);
|
run_test_with_server(WorkerDebuggerServer, do_test_finished);
|
||||||
});
|
});
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
}
|
}
|
||||||
|
|
||||||
function run_test_with_server(aServer, aCallback)
|
function run_test_with_server(server, callback) {
|
||||||
{
|
initTestDebuggerServer(server);
|
||||||
gCallback = aCallback;
|
gDebuggee = addTestGlobal("test-breakpoints", server);
|
||||||
initTestDebuggerServer(aServer);
|
gClient = new DebuggerClient(server.connectPipe());
|
||||||
gDebuggee = addTestGlobal("test-breakpoints", aServer);
|
|
||||||
gClient = new DebuggerClient(aServer.connectPipe());
|
|
||||||
gClient.connect().then(function () {
|
gClient.connect().then(function () {
|
||||||
attachTestTabAndResume(gClient,
|
attachTestTabAndResume(gClient,
|
||||||
"test-breakpoints",
|
"test-breakpoints",
|
||||||
function (aResponse, aTabClient, aThreadClient) {
|
function (response, tabClient, threadClient) {
|
||||||
gThreadClient = aThreadClient;
|
gThreadClient = threadClient;
|
||||||
test();
|
test();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
@ -62,6 +60,7 @@ const test = Task.async(function* () {
|
||||||
finishClient(gClient);
|
finishClient(gClient);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/* eslint-disable */
|
||||||
function evalCode() {
|
function evalCode() {
|
||||||
// Start a new script
|
// Start a new script
|
||||||
Components.utils.evalInSandbox(
|
Components.utils.evalInSandbox(
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bug 1333219 - make that setBreakpoint fails when script is not found
|
* Bug 1333219 - make that setBreakpoint fails when script is not found
|
||||||
* at the specified line.
|
* at the specified line.
|
||||||
|
|
@ -9,27 +11,23 @@
|
||||||
var gDebuggee;
|
var gDebuggee;
|
||||||
var gClient;
|
var gClient;
|
||||||
var gThreadClient;
|
var gThreadClient;
|
||||||
var gCallback;
|
|
||||||
|
|
||||||
function run_test()
|
function run_test() {
|
||||||
{
|
|
||||||
run_test_with_server(DebuggerServer, function () {
|
run_test_with_server(DebuggerServer, function () {
|
||||||
run_test_with_server(WorkerDebuggerServer, do_test_finished);
|
run_test_with_server(WorkerDebuggerServer, do_test_finished);
|
||||||
});
|
});
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
}
|
}
|
||||||
|
|
||||||
function run_test_with_server(aServer, aCallback)
|
function run_test_with_server(server, callback) {
|
||||||
{
|
initTestDebuggerServer(server);
|
||||||
gCallback = aCallback;
|
gDebuggee = addTestGlobal("test-breakpoints", server);
|
||||||
initTestDebuggerServer(aServer);
|
gClient = new DebuggerClient(server.connectPipe());
|
||||||
gDebuggee = addTestGlobal("test-breakpoints", aServer);
|
|
||||||
gClient = new DebuggerClient(aServer.connectPipe());
|
|
||||||
gClient.connect().then(function () {
|
gClient.connect().then(function () {
|
||||||
attachTestTabAndResume(gClient,
|
attachTestTabAndResume(gClient,
|
||||||
"test-breakpoints",
|
"test-breakpoints",
|
||||||
function (aResponse, aTabClient, aThreadClient) {
|
function (response, tabClient, threadClient) {
|
||||||
gThreadClient = aThreadClient;
|
gThreadClient = threadClient;
|
||||||
test();
|
test();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
@ -46,7 +44,7 @@ const test = Task.async(function* () {
|
||||||
line: gDebuggee.line0 + 2
|
line: gDebuggee.line0 + 2
|
||||||
};
|
};
|
||||||
|
|
||||||
let [res, bpClient] = yield setBreakpoint(source, location);
|
let [res, ] = yield setBreakpoint(source, location);
|
||||||
ok(!res.error);
|
ok(!res.error);
|
||||||
|
|
||||||
let location2 = {
|
let location2 = {
|
||||||
|
|
|
||||||
|
|
@ -128,7 +128,9 @@ function test_find_actors() {
|
||||||
|
|
||||||
// Breakpoints by URL
|
// Breakpoints by URL
|
||||||
|
|
||||||
bpSet = new Set(bps.filter(bp => { return bp.originalSourceActor.actorID === "actor1"; }));
|
bpSet = new Set(bps.filter(bp => {
|
||||||
|
return bp.originalSourceActor.actorID === "actor1";
|
||||||
|
}));
|
||||||
for (let bp of bpStore.findActors({ originalSourceActor: { actorID: "actor1" } })) {
|
for (let bp of bpStore.findActors({ originalSourceActor: { actorID: "actor1" } })) {
|
||||||
bpSet.delete(bp);
|
bpSet.delete(bp);
|
||||||
}
|
}
|
||||||
|
|
@ -137,9 +139,12 @@ function test_find_actors() {
|
||||||
|
|
||||||
// Breakpoints by URL and line
|
// Breakpoints by URL and line
|
||||||
|
|
||||||
bpSet = new Set(bps.filter(bp => { return bp.originalSourceActor.actorID === "actor1" && bp.originalLine === 10; }));
|
bpSet = new Set(bps.filter(bp => {
|
||||||
|
return bp.originalSourceActor.actorID === "actor1" && bp.originalLine === 10;
|
||||||
|
}));
|
||||||
let first = true;
|
let first = true;
|
||||||
for (let bp of bpStore.findActors({ originalSourceActor: { actorID: "actor1" }, originalLine: 10 })) {
|
for (let bp of bpStore.findActors({ originalSourceActor: { actorID: "actor1" },
|
||||||
|
originalLine: 10 })) {
|
||||||
if (first) {
|
if (first) {
|
||||||
do_check_eq(bp.originalColumn, undefined,
|
do_check_eq(bp.originalColumn, undefined,
|
||||||
"Should always get the whole line breakpoint first");
|
"Should always get the whole line breakpoint first");
|
||||||
|
|
|
||||||
|
|
@ -1,27 +1,27 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
var gClient;
|
var gClient;
|
||||||
var gDebuggee;
|
var gDebuggee;
|
||||||
|
|
||||||
function run_test()
|
function run_test() {
|
||||||
{
|
|
||||||
initTestDebuggerServer();
|
initTestDebuggerServer();
|
||||||
gDebuggee = testGlobal("test-1");
|
gDebuggee = testGlobal("test-1");
|
||||||
DebuggerServer.addTestGlobal(gDebuggee);
|
DebuggerServer.addTestGlobal(gDebuggee);
|
||||||
|
|
||||||
let transport = DebuggerServer.connectPipe();
|
let transport = DebuggerServer.connectPipe();
|
||||||
gClient = new DebuggerClient(transport);
|
gClient = new DebuggerClient(transport);
|
||||||
gClient.connect().then(function (aType, aTraits) {
|
gClient.connect().then(function (type, traits) {
|
||||||
attachTestTab(gClient, "test-1", function (aReply, aTabClient) {
|
attachTestTab(gClient, "test-1", function (reply, tabClient) {
|
||||||
test_close(transport);
|
test_close(transport);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_close(aTransport)
|
function test_close(transport) {
|
||||||
{
|
|
||||||
// Check that, if we fake a transport shutdown
|
// Check that, if we fake a transport shutdown
|
||||||
// (like if a device is unplugged)
|
// (like if a device is unplugged)
|
||||||
// the client is automatically closed,
|
// the client is automatically closed,
|
||||||
|
|
@ -35,5 +35,5 @@ function test_close(aTransport)
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
gClient.addListener("closed", onClosed);
|
gClient.addListener("closed", onClosed);
|
||||||
aTransport.close();
|
transport.close();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
// Test the DebuggerClient.request API.
|
// Test the DebuggerClient.request API.
|
||||||
|
|
||||||
var gClient, gActorId;
|
var gClient, gActorId;
|
||||||
|
|
@ -24,8 +26,7 @@ TestActor.prototype.requestTypes = {
|
||||||
"error": TestActor.prototype.error
|
"error": TestActor.prototype.error
|
||||||
};
|
};
|
||||||
|
|
||||||
function run_test()
|
function run_test() {
|
||||||
{
|
|
||||||
DebuggerServer.addGlobalActor(TestActor);
|
DebuggerServer.addGlobalActor(TestActor);
|
||||||
|
|
||||||
DebuggerServer.init();
|
DebuggerServer.init();
|
||||||
|
|
@ -42,13 +43,12 @@ function run_test()
|
||||||
run_next_test();
|
run_next_test();
|
||||||
}
|
}
|
||||||
|
|
||||||
function init()
|
function init() {
|
||||||
{
|
|
||||||
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
||||||
gClient.connect()
|
gClient.connect()
|
||||||
.then(() => gClient.listTabs())
|
.then(() => gClient.listTabs())
|
||||||
.then(aResponse => {
|
.then(response => {
|
||||||
gActorId = aResponse.test;
|
gActorId = response.test;
|
||||||
run_next_test();
|
run_next_test();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -72,8 +72,7 @@ function checkStack(expectedName) {
|
||||||
ok(false, "Incomplete stack");
|
ok(false, "Incomplete stack");
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_client_request_callback()
|
function test_client_request_callback() {
|
||||||
{
|
|
||||||
// Test that DebuggerClient.request accepts a `onResponse` callback as 2nd argument
|
// Test that DebuggerClient.request accepts a `onResponse` callback as 2nd argument
|
||||||
gClient.request({
|
gClient.request({
|
||||||
to: gActorId,
|
to: gActorId,
|
||||||
|
|
@ -86,8 +85,7 @@ function test_client_request_callback()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_client_request_promise()
|
function test_client_request_promise() {
|
||||||
{
|
|
||||||
// Test that DebuggerClient.request returns a promise that resolves on response
|
// Test that DebuggerClient.request returns a promise that resolves on response
|
||||||
let request = gClient.request({
|
let request = gClient.request({
|
||||||
to: gActorId,
|
to: gActorId,
|
||||||
|
|
@ -102,8 +100,7 @@ function test_client_request_promise()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_client_request_promise_error()
|
function test_client_request_promise_error() {
|
||||||
{
|
|
||||||
// Test that DebuggerClient.request returns a promise that reject when server
|
// Test that DebuggerClient.request returns a promise that reject when server
|
||||||
// returns an explicit error message
|
// returns an explicit error message
|
||||||
let request = gClient.request({
|
let request = gClient.request({
|
||||||
|
|
@ -122,8 +119,7 @@ function test_client_request_promise_error()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_client_request_event_emitter()
|
function test_client_request_event_emitter() {
|
||||||
{
|
|
||||||
// Test that DebuggerClient.request returns also an EventEmitter object
|
// Test that DebuggerClient.request returns also an EventEmitter object
|
||||||
let request = gClient.request({
|
let request = gClient.request({
|
||||||
to: gActorId,
|
to: gActorId,
|
||||||
|
|
@ -156,7 +152,8 @@ function test_close_client_while_sending_requests() {
|
||||||
let expectReply = promise.defer();
|
let expectReply = promise.defer();
|
||||||
gClient.expectReply("root", function (response) {
|
gClient.expectReply("root", function (response) {
|
||||||
do_check_eq(response.error, "connectionClosed");
|
do_check_eq(response.error, "connectionClosed");
|
||||||
do_check_eq(response.message, "server side packet can't be received as the connection just closed.");
|
do_check_eq(response.message,
|
||||||
|
"server side packet can't be received as the connection just closed.");
|
||||||
expectReply.resolve();
|
expectReply.resolve();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -165,22 +162,23 @@ function test_close_client_while_sending_requests() {
|
||||||
ok(false, "First request unexpectedly succeed while closing the connection");
|
ok(false, "First request unexpectedly succeed while closing the connection");
|
||||||
}, response => {
|
}, response => {
|
||||||
do_check_eq(response.error, "connectionClosed");
|
do_check_eq(response.error, "connectionClosed");
|
||||||
do_check_eq(response.message, "'hello' active request packet to '" + gActorId + "' can't be sent as the connection just closed.");
|
do_check_eq(response.message, "'hello' active request packet to '" +
|
||||||
|
gActorId + "' can't be sent as the connection just closed.");
|
||||||
})
|
})
|
||||||
.then(() => pendingRequest)
|
.then(() => pendingRequest)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
ok(false, "Second request unexpectedly succeed while closing the connection");
|
ok(false, "Second request unexpectedly succeed while closing the connection");
|
||||||
}, response => {
|
}, response => {
|
||||||
do_check_eq(response.error, "connectionClosed");
|
do_check_eq(response.error, "connectionClosed");
|
||||||
do_check_eq(response.message, "'hello' pending request packet to '" + gActorId + "' can't be sent as the connection just closed.");
|
do_check_eq(response.message, "'hello' pending request packet to '" +
|
||||||
|
gActorId + "' can't be sent as the connection just closed.");
|
||||||
})
|
})
|
||||||
.then(() => expectReply.promise)
|
.then(() => expectReply.promise)
|
||||||
.then(run_next_test);
|
.then(run_next_test);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_client_request_after_close()
|
function test_client_request_after_close() {
|
||||||
{
|
|
||||||
// Test that DebuggerClient.request fails after we called client.close()
|
// Test that DebuggerClient.request fails after we called client.close()
|
||||||
// (with promise API)
|
// (with promise API)
|
||||||
let request = gClient.request({
|
let request = gClient.request({
|
||||||
|
|
@ -193,22 +191,23 @@ function test_client_request_after_close()
|
||||||
}, response => {
|
}, response => {
|
||||||
ok(true, "Request failed after client.close");
|
ok(true, "Request failed after client.close");
|
||||||
do_check_eq(response.error, "connectionClosed");
|
do_check_eq(response.error, "connectionClosed");
|
||||||
ok(response.message.match(/'hello' request packet to '.*' can't be sent as the connection is closed./));
|
ok(response.message.match(
|
||||||
|
/'hello' request packet to '.*' can't be sent as the connection is closed./));
|
||||||
run_next_test();
|
run_next_test();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_client_request_after_close_callback()
|
function test_client_request_after_close_callback() {
|
||||||
{
|
|
||||||
// Test that DebuggerClient.request fails after we called client.close()
|
// Test that DebuggerClient.request fails after we called client.close()
|
||||||
// (with callback API)
|
// (with callback API)
|
||||||
let request = gClient.request({
|
gClient.request({
|
||||||
to: gActorId,
|
to: gActorId,
|
||||||
type: "hello"
|
type: "hello"
|
||||||
}, response => {
|
}, response => {
|
||||||
ok(true, "Request failed after client.close");
|
ok(true, "Request failed after client.close");
|
||||||
do_check_eq(response.error, "connectionClosed");
|
do_check_eq(response.error, "connectionClosed");
|
||||||
ok(response.message.match(/'hello' request packet to '.*' can't be sent as the connection is closed./));
|
ok(response.message.match(
|
||||||
|
/'hello' request packet to '.*' can't be sent as the connection is closed./));
|
||||||
run_next_test();
|
run_next_test();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
/* eslint-disable no-shadow, max-nested-callbacks */
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check conditional breakpoint when condition evaluates to true.
|
* Check conditional breakpoint when condition evaluates to true.
|
||||||
|
|
@ -9,48 +12,45 @@ var gDebuggee;
|
||||||
var gClient;
|
var gClient;
|
||||||
var gThreadClient;
|
var gThreadClient;
|
||||||
|
|
||||||
function run_test()
|
function run_test() {
|
||||||
{
|
|
||||||
initTestDebuggerServer();
|
initTestDebuggerServer();
|
||||||
gDebuggee = addTestGlobal("test-conditional-breakpoint");
|
gDebuggee = addTestGlobal("test-conditional-breakpoint");
|
||||||
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
||||||
gClient.connect().then(function () {
|
gClient.connect().then(function () {
|
||||||
attachTestTabAndResume(gClient, "test-conditional-breakpoint", function (aResponse, aTabClient, aThreadClient) {
|
attachTestTabAndResume(gClient, "test-conditional-breakpoint",
|
||||||
gThreadClient = aThreadClient;
|
function (response, tabClient, threadClient) {
|
||||||
test_simple_breakpoint();
|
gThreadClient = threadClient;
|
||||||
});
|
test_simple_breakpoint();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_simple_breakpoint()
|
function test_simple_breakpoint() {
|
||||||
{
|
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||||
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
let source = gThreadClient.source(packet.frame.where.source);
|
||||||
let source = gThreadClient.source(aPacket.frame.where.source);
|
|
||||||
source.setBreakpoint({
|
source.setBreakpoint({
|
||||||
line: 3,
|
line: 3,
|
||||||
condition: "a === 1"
|
condition: "a === 1"
|
||||||
}, function (aResponse, bpClient) {
|
}, function (response, bpClient) {
|
||||||
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||||
// Check the return value.
|
// Check the return value.
|
||||||
do_check_eq(aPacket.why.type, "breakpoint");
|
do_check_eq(packet.why.type, "breakpoint");
|
||||||
do_check_eq(aPacket.frame.where.line, 3);
|
do_check_eq(packet.frame.where.line, 3);
|
||||||
|
|
||||||
// Remove the breakpoint.
|
// Remove the breakpoint.
|
||||||
bpClient.remove(function (aResponse) {
|
bpClient.remove(function (response) {
|
||||||
gThreadClient.resume(function () {
|
gThreadClient.resume(function () {
|
||||||
finishClient(gClient);
|
finishClient(gClient);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
// Continue until the breakpoint is hit.
|
// Continue until the breakpoint is hit.
|
||||||
gThreadClient.resume();
|
gThreadClient.resume();
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/* eslint-disable */
|
||||||
Components.utils.evalInSandbox("debugger;\n" + // 1
|
Components.utils.evalInSandbox("debugger;\n" + // 1
|
||||||
"var a = 1;\n" + // 2
|
"var a = 1;\n" + // 2
|
||||||
"var b = 2;\n", // 3
|
"var b = 2;\n", // 3
|
||||||
|
|
@ -58,4 +58,5 @@ function test_simple_breakpoint()
|
||||||
"1.8",
|
"1.8",
|
||||||
"test.js",
|
"test.js",
|
||||||
1);
|
1);
|
||||||
|
/* eslint-enable */
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
/* eslint-disable no-shadow, max-nested-callbacks */
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check conditional breakpoint when condition evaluates to false.
|
* Check conditional breakpoint when condition evaluates to false.
|
||||||
|
|
@ -9,46 +12,45 @@ var gDebuggee;
|
||||||
var gClient;
|
var gClient;
|
||||||
var gThreadClient;
|
var gThreadClient;
|
||||||
|
|
||||||
function run_test()
|
function run_test() {
|
||||||
{
|
|
||||||
initTestDebuggerServer();
|
initTestDebuggerServer();
|
||||||
gDebuggee = addTestGlobal("test-conditional-breakpoint");
|
gDebuggee = addTestGlobal("test-conditional-breakpoint");
|
||||||
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
||||||
gClient.connect().then(function () {
|
gClient.connect().then(function () {
|
||||||
attachTestTabAndResume(gClient, "test-conditional-breakpoint", function (aResponse, aTabClient, aThreadClient) {
|
attachTestTabAndResume(gClient, "test-conditional-breakpoint",
|
||||||
gThreadClient = aThreadClient;
|
function (response, tabClient, threadClient) {
|
||||||
test_simple_breakpoint();
|
gThreadClient = threadClient;
|
||||||
});
|
test_simple_breakpoint();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_simple_breakpoint()
|
function test_simple_breakpoint() {
|
||||||
{
|
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||||
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
let source = gThreadClient.source(packet.frame.where.source);
|
||||||
let source = gThreadClient.source(aPacket.frame.where.source);
|
|
||||||
source.setBreakpoint({
|
source.setBreakpoint({
|
||||||
line: 3,
|
line: 3,
|
||||||
condition: "a === 2"
|
condition: "a === 2"
|
||||||
}, function (aResponse, bpClient) {
|
}, function (response, bpClient) {
|
||||||
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||||
// Check the return value.
|
// Check the return value.
|
||||||
do_check_eq(aPacket.why.type, "debuggerStatement");
|
do_check_eq(packet.why.type, "debuggerStatement");
|
||||||
do_check_eq(aPacket.frame.where.line, 4);
|
do_check_eq(packet.frame.where.line, 4);
|
||||||
|
|
||||||
// Remove the breakpoint.
|
// Remove the breakpoint.
|
||||||
bpClient.remove(function (aResponse) {
|
bpClient.remove(function (response) {
|
||||||
gThreadClient.resume(function () {
|
gThreadClient.resume(function () {
|
||||||
finishClient(gClient);
|
finishClient(gClient);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
// Continue until the breakpoint is hit.
|
// Continue until the breakpoint is hit.
|
||||||
gThreadClient.resume();
|
gThreadClient.resume();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/* eslint-disable */
|
||||||
Components.utils.evalInSandbox("debugger;\n" + // 1
|
Components.utils.evalInSandbox("debugger;\n" + // 1
|
||||||
"var a = 1;\n" + // 2
|
"var a = 1;\n" + // 2
|
||||||
"var b = 2;\n" + // 3
|
"var b = 2;\n" + // 3
|
||||||
|
|
@ -57,4 +59,5 @@ function test_simple_breakpoint()
|
||||||
"1.8",
|
"1.8",
|
||||||
"test.js",
|
"test.js",
|
||||||
1);
|
1);
|
||||||
|
/* eslint-enable */
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
/* eslint-disable no-shadow, max-nested-callbacks */
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check conditional breakpoint when condition throws and make sure it pauses
|
* Check conditional breakpoint when condition throws and make sure it pauses
|
||||||
|
|
@ -9,48 +12,45 @@ var gDebuggee;
|
||||||
var gClient;
|
var gClient;
|
||||||
var gThreadClient;
|
var gThreadClient;
|
||||||
|
|
||||||
function run_test()
|
function run_test() {
|
||||||
{
|
|
||||||
initTestDebuggerServer();
|
initTestDebuggerServer();
|
||||||
gDebuggee = addTestGlobal("test-conditional-breakpoint");
|
gDebuggee = addTestGlobal("test-conditional-breakpoint");
|
||||||
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
||||||
gClient.connect().then(function () {
|
gClient.connect().then(function () {
|
||||||
attachTestTabAndResume(gClient, "test-conditional-breakpoint", function (aResponse, aTabClient, aThreadClient) {
|
attachTestTabAndResume(gClient, "test-conditional-breakpoint",
|
||||||
gThreadClient = aThreadClient;
|
function (response, tabClient, threadClient) {
|
||||||
test_simple_breakpoint();
|
gThreadClient = threadClient;
|
||||||
});
|
test_simple_breakpoint();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_simple_breakpoint()
|
function test_simple_breakpoint() {
|
||||||
{
|
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||||
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
let source = gThreadClient.source(packet.frame.where.source);
|
||||||
let source = gThreadClient.source(aPacket.frame.where.source);
|
|
||||||
source.setBreakpoint({
|
source.setBreakpoint({
|
||||||
line: 3,
|
line: 3,
|
||||||
condition: "throw new Error()"
|
condition: "throw new Error()"
|
||||||
}, function (aResponse, bpClient) {
|
}, function (response, bpClient) {
|
||||||
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||||
// Check the return value.
|
// Check the return value.
|
||||||
do_check_eq(aPacket.why.type, "breakpointConditionThrown");
|
do_check_eq(packet.why.type, "breakpointConditionThrown");
|
||||||
do_check_eq(aPacket.frame.where.line, 3);
|
do_check_eq(packet.frame.where.line, 3);
|
||||||
|
|
||||||
// Remove the breakpoint.
|
// Remove the breakpoint.
|
||||||
bpClient.remove(function (aResponse) {
|
bpClient.remove(function (response) {
|
||||||
gThreadClient.resume(function () {
|
gThreadClient.resume(function () {
|
||||||
finishClient(gClient);
|
finishClient(gClient);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
// Continue until the breakpoint is hit.
|
// Continue until the breakpoint is hit.
|
||||||
gThreadClient.resume();
|
gThreadClient.resume();
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/* eslint-disable */
|
||||||
Components.utils.evalInSandbox("debugger;\n" + // 1
|
Components.utils.evalInSandbox("debugger;\n" + // 1
|
||||||
"var a = 1;\n" + // 2
|
"var a = 1;\n" + // 2
|
||||||
"var b = 2;\n", // 3
|
"var b = 2;\n", // 3
|
||||||
|
|
@ -58,4 +58,5 @@ function test_simple_breakpoint()
|
||||||
"1.8",
|
"1.8",
|
||||||
"test.js",
|
"test.js",
|
||||||
1);
|
1);
|
||||||
|
/* eslint-enable */
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,29 +1,31 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
var gClient;
|
var gClient;
|
||||||
var gDebuggee;
|
var gDebuggee;
|
||||||
|
|
||||||
const xpcInspector = Cc["@mozilla.org/jsinspector;1"].getService(Ci.nsIJSInspector);
|
const xpcInspector = Cc["@mozilla.org/jsinspector;1"].getService(Ci.nsIJSInspector);
|
||||||
|
|
||||||
function run_test()
|
function run_test() {
|
||||||
{
|
|
||||||
initTestDebuggerServer();
|
initTestDebuggerServer();
|
||||||
gDebuggee = testGlobal("test-1");
|
gDebuggee = testGlobal("test-1");
|
||||||
DebuggerServer.addTestGlobal(gDebuggee);
|
DebuggerServer.addTestGlobal(gDebuggee);
|
||||||
|
|
||||||
let transport = DebuggerServer.connectPipe();
|
let transport = DebuggerServer.connectPipe();
|
||||||
gClient = new DebuggerClient(transport);
|
gClient = new DebuggerClient(transport);
|
||||||
gClient.addListener("connected", function (aEvent, aType, aTraits) {
|
gClient.addListener("connected", function (event, type, traits) {
|
||||||
gClient.listTabs((aResponse) => {
|
gClient.listTabs((response) => {
|
||||||
do_check_true("tabs" in aResponse);
|
do_check_true("tabs" in response);
|
||||||
for (let tab of aResponse.tabs) {
|
for (let tab of response.tabs) {
|
||||||
if (tab.title == "test-1") {
|
if (tab.title == "test-1") {
|
||||||
test_attach_tab(tab.actor);
|
test_attach_tab(tab.actor);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
do_check_true(false); // We should have found our tab in the list.
|
// We should have found our tab in the list.
|
||||||
|
do_check_true(false);
|
||||||
return undefined;
|
return undefined;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
@ -33,42 +35,39 @@ function run_test()
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attach to |aTabActor|, and check the response.
|
// Attach to |tabActor|, and check the response.
|
||||||
function test_attach_tab(aTabActor)
|
function test_attach_tab(tabActor) {
|
||||||
{
|
gClient.request({ to: tabActor, type: "attach" }, function (response) {
|
||||||
gClient.request({ to: aTabActor, type: "attach" }, function (aResponse) {
|
do_check_false("error" in response);
|
||||||
do_check_false("error" in aResponse);
|
do_check_eq(response.from, tabActor);
|
||||||
do_check_eq(aResponse.from, aTabActor);
|
do_check_eq(response.type, "tabAttached");
|
||||||
do_check_eq(aResponse.type, "tabAttached");
|
do_check_true(typeof response.threadActor === "string");
|
||||||
do_check_true(typeof aResponse.threadActor === "string");
|
|
||||||
|
|
||||||
test_attach_thread(aResponse.threadActor);
|
test_attach_thread(response.threadActor);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attach to |aThreadActor|, check the response, and resume it.
|
// Attach to |threadActor|, check the response, and resume it.
|
||||||
function test_attach_thread(aThreadActor)
|
function test_attach_thread(threadActor) {
|
||||||
{
|
gClient.request({ to: threadActor, type: "attach" }, function (response) {
|
||||||
gClient.request({ to: aThreadActor, type: "attach" }, function (aResponse) {
|
do_check_false("error" in response);
|
||||||
do_check_false("error" in aResponse);
|
do_check_eq(response.from, threadActor);
|
||||||
do_check_eq(aResponse.from, aThreadActor);
|
do_check_eq(response.type, "paused");
|
||||||
do_check_eq(aResponse.type, "paused");
|
do_check_true("why" in response);
|
||||||
do_check_true("why" in aResponse);
|
do_check_eq(response.why.type, "attached");
|
||||||
do_check_eq(aResponse.why.type, "attached");
|
|
||||||
|
|
||||||
test_resume_thread(aThreadActor);
|
test_resume_thread(threadActor);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Resume |aThreadActor|, and see that it stops at the 'debugger'
|
// Resume |threadActor|, and see that it stops at the 'debugger'
|
||||||
// statement.
|
// statement.
|
||||||
function test_resume_thread(aThreadActor)
|
function test_resume_thread(threadActor) {
|
||||||
{
|
|
||||||
// Allow the client to resume execution.
|
// Allow the client to resume execution.
|
||||||
gClient.request({ to: aThreadActor, type: "resume" }, function (aResponse) {
|
gClient.request({ to: threadActor, type: "resume" }, function (response) {
|
||||||
do_check_false("error" in aResponse);
|
do_check_false("error" in response);
|
||||||
do_check_eq(aResponse.from, aThreadActor);
|
do_check_eq(response.from, threadActor);
|
||||||
do_check_eq(aResponse.type, "resumed");
|
do_check_eq(response.type, "resumed");
|
||||||
|
|
||||||
do_check_eq(xpcInspector.eventLoopNestLevel, 0);
|
do_check_eq(xpcInspector.eventLoopNestLevel, 0);
|
||||||
|
|
||||||
|
|
@ -78,14 +77,14 @@ function test_resume_thread(aThreadActor)
|
||||||
do_check_true(gDebuggee.b);
|
do_check_true(gDebuggee.b);
|
||||||
});
|
});
|
||||||
|
|
||||||
gClient.addListener("paused", function (aName, aPacket) {
|
gClient.addListener("paused", function (name, packet) {
|
||||||
do_check_eq(aName, "paused");
|
do_check_eq(name, "paused");
|
||||||
do_check_false("error" in aPacket);
|
do_check_false("error" in packet);
|
||||||
do_check_eq(aPacket.from, aThreadActor);
|
do_check_eq(packet.from, threadActor);
|
||||||
do_check_eq(aPacket.type, "paused");
|
do_check_eq(packet.type, "paused");
|
||||||
do_check_true("actor" in aPacket);
|
do_check_true("actor" in packet);
|
||||||
do_check_true("why" in aPacket);
|
do_check_true("why" in packet);
|
||||||
do_check_eq(aPacket.why.type, "debuggerStatement");
|
do_check_eq(packet.why.type, "debuggerStatement");
|
||||||
|
|
||||||
// Reach around the protocol to check that the debuggee is in the state
|
// Reach around the protocol to check that the debuggee is in the state
|
||||||
// we expect.
|
// we expect.
|
||||||
|
|
@ -95,19 +94,18 @@ function test_resume_thread(aThreadActor)
|
||||||
do_check_eq(xpcInspector.eventLoopNestLevel, 1);
|
do_check_eq(xpcInspector.eventLoopNestLevel, 1);
|
||||||
|
|
||||||
// Let the debuggee continue execution.
|
// Let the debuggee continue execution.
|
||||||
gClient.request({ to: aThreadActor, type: "resume" }, cleanup);
|
gClient.request({ to: threadActor, type: "resume" }, cleanup);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function cleanup()
|
function cleanup() {
|
||||||
{
|
gClient.addListener("closed", function (event, result) {
|
||||||
gClient.addListener("closed", function (aEvent, aResult) {
|
|
||||||
do_test_finished();
|
do_test_finished();
|
||||||
});
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
let xpcInspector = Cc["@mozilla.org/jsinspector;1"].getService(Ci.nsIJSInspector);
|
let inspector = Cc["@mozilla.org/jsinspector;1"].getService(Ci.nsIJSInspector);
|
||||||
do_check_eq(xpcInspector.eventLoopNestLevel, 0);
|
do_check_eq(inspector.eventLoopNestLevel, 0);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
dump(e);
|
dump(e);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,44 +1,43 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
var gClient;
|
var gClient;
|
||||||
var gTabClient;
|
var gTabClient;
|
||||||
var gDebuggee;
|
var gDebuggee;
|
||||||
|
|
||||||
function run_test()
|
function run_test() {
|
||||||
{
|
|
||||||
initTestDebuggerServer();
|
initTestDebuggerServer();
|
||||||
gDebuggee = testGlobal("test-1");
|
gDebuggee = testGlobal("test-1");
|
||||||
DebuggerServer.addTestGlobal(gDebuggee);
|
DebuggerServer.addTestGlobal(gDebuggee);
|
||||||
|
|
||||||
let transport = DebuggerServer.connectPipe();
|
let transport = DebuggerServer.connectPipe();
|
||||||
gClient = new DebuggerClient(transport);
|
gClient = new DebuggerClient(transport);
|
||||||
gClient.connect().then(function ([aType, aTraits]) {
|
gClient.connect().then(function ([type, traits]) {
|
||||||
attachTestTab(gClient, "test-1", function (aReply, aTabClient) {
|
attachTestTab(gClient, "test-1", function (reply, tabClient) {
|
||||||
gTabClient = aTabClient;
|
gTabClient = tabClient;
|
||||||
test_threadAttach(aReply.threadActor);
|
test_threadAttach(reply.threadActor);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_threadAttach(aThreadActorID)
|
function test_threadAttach(threadActorID) {
|
||||||
{
|
do_print("Trying to attach to thread " + threadActorID);
|
||||||
do_print("Trying to attach to thread " + aThreadActorID);
|
gTabClient.attachThread({}, function (response, threadClient) {
|
||||||
gTabClient.attachThread({}, function (aResponse, aThreadClient) {
|
do_check_eq(threadClient.state, "paused");
|
||||||
do_check_eq(aThreadClient.state, "paused");
|
do_check_eq(threadClient.actor, threadActorID);
|
||||||
do_check_eq(aThreadClient.actor, aThreadActorID);
|
threadClient.resume(function () {
|
||||||
aThreadClient.resume(function () {
|
do_check_eq(threadClient.state, "attached");
|
||||||
do_check_eq(aThreadClient.state, "attached");
|
test_debugger_statement(threadClient);
|
||||||
test_debugger_statement(aThreadClient);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_debugger_statement(aThreadClient)
|
function test_debugger_statement(threadClient) {
|
||||||
{
|
threadClient.addListener("paused", function (event, packet) {
|
||||||
aThreadClient.addListener("paused", function (aEvent, aPacket) {
|
do_check_eq(threadClient.state, "paused");
|
||||||
do_check_eq(aThreadClient.state, "paused");
|
|
||||||
// Reach around the protocol to check that the debuggee is in the state
|
// Reach around the protocol to check that the debuggee is in the state
|
||||||
// we expect.
|
// we expect.
|
||||||
do_check_true(gDebuggee.a);
|
do_check_true(gDebuggee.a);
|
||||||
|
|
@ -47,7 +46,7 @@ function test_debugger_statement(aThreadClient)
|
||||||
let xpcInspector = Cc["@mozilla.org/jsinspector;1"].getService(Ci.nsIJSInspector);
|
let xpcInspector = Cc["@mozilla.org/jsinspector;1"].getService(Ci.nsIJSInspector);
|
||||||
do_check_eq(xpcInspector.eventLoopNestLevel, 1);
|
do_check_eq(xpcInspector.eventLoopNestLevel, 1);
|
||||||
|
|
||||||
aThreadClient.resume(cleanup);
|
threadClient.resume(cleanup);
|
||||||
});
|
});
|
||||||
|
|
||||||
Cu.evalInSandbox("var a = true; var b = false; debugger; var b = true;", gDebuggee);
|
Cu.evalInSandbox("var a = true; var b = false; debugger; var b = true;", gDebuggee);
|
||||||
|
|
@ -56,9 +55,8 @@ function test_debugger_statement(aThreadClient)
|
||||||
do_check_true(gDebuggee.b);
|
do_check_true(gDebuggee.b);
|
||||||
}
|
}
|
||||||
|
|
||||||
function cleanup()
|
function cleanup() {
|
||||||
{
|
gClient.addListener("closed", function (event) {
|
||||||
gClient.addListener("closed", function (aEvent) {
|
|
||||||
do_test_finished();
|
do_test_finished();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,9 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
|
||||||
function run_test()
|
"use strict";
|
||||||
{
|
|
||||||
|
function run_test() {
|
||||||
// Should get an exception if we try to interact with DebuggerServer
|
// Should get an exception if we try to interact with DebuggerServer
|
||||||
// before we initialize it...
|
// before we initialize it...
|
||||||
check_except(function () {
|
check_except(function () {
|
||||||
|
|
@ -28,28 +29,28 @@ function run_test()
|
||||||
// Make sure we got the test's root actor all set up.
|
// Make sure we got the test's root actor all set up.
|
||||||
let client1 = DebuggerServer.connectPipe();
|
let client1 = DebuggerServer.connectPipe();
|
||||||
client1.hooks = {
|
client1.hooks = {
|
||||||
onPacket: function (aPacket1) {
|
onPacket: function (packet1) {
|
||||||
do_check_eq(aPacket1.from, "root");
|
do_check_eq(packet1.from, "root");
|
||||||
do_check_eq(aPacket1.applicationType, "xpcshell-tests");
|
do_check_eq(packet1.applicationType, "xpcshell-tests");
|
||||||
|
|
||||||
// Spin up a second connection, make sure it has its own root
|
// Spin up a second connection, make sure it has its own root
|
||||||
// actor.
|
// actor.
|
||||||
let client2 = DebuggerServer.connectPipe();
|
let client2 = DebuggerServer.connectPipe();
|
||||||
client2.hooks = {
|
client2.hooks = {
|
||||||
onPacket: function (aPacket2) {
|
onPacket: function (packet2) {
|
||||||
do_check_eq(aPacket2.from, "root");
|
do_check_eq(packet2.from, "root");
|
||||||
do_check_neq(aPacket1.testConnectionPrefix,
|
do_check_neq(packet1.testConnectionPrefix,
|
||||||
aPacket2.testConnectionPrefix);
|
packet2.testConnectionPrefix);
|
||||||
client2.close();
|
client2.close();
|
||||||
},
|
},
|
||||||
onClosed: function (aResult) {
|
onClosed: function (result) {
|
||||||
client1.close();
|
client1.close();
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
client2.ready();
|
client2.ready();
|
||||||
},
|
},
|
||||||
|
|
||||||
onClosed: function (aResult) {
|
onClosed: function (result) {
|
||||||
do_test_finished();
|
do_test_finished();
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
/* eslint-disable no-shadow, max-nested-callbacks */
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check basic eval resume/re-pause
|
* Check basic eval resume/re-pause
|
||||||
|
|
@ -9,50 +12,48 @@ var gDebuggee;
|
||||||
var gClient;
|
var gClient;
|
||||||
var gThreadClient;
|
var gThreadClient;
|
||||||
|
|
||||||
function run_test()
|
function run_test() {
|
||||||
{
|
|
||||||
initTestDebuggerServer();
|
initTestDebuggerServer();
|
||||||
gDebuggee = addTestGlobal("test-stack");
|
gDebuggee = addTestGlobal("test-stack");
|
||||||
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
||||||
gClient.connect().then(function () {
|
gClient.connect().then(function () {
|
||||||
attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) {
|
attachTestTabAndResume(gClient, "test-stack",
|
||||||
gThreadClient = aThreadClient;
|
function (response, tabClient, threadClient) {
|
||||||
test_simple_eval();
|
gThreadClient = threadClient;
|
||||||
});
|
test_simple_eval();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_simple_eval()
|
function test_simple_eval() {
|
||||||
{
|
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||||
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
let arg1Actor = packet.frame.arguments[0].actor;
|
||||||
let arg1Actor = aPacket.frame.arguments[0].actor;
|
gThreadClient.eval(null, "({ obj: true })", function (response) {
|
||||||
gThreadClient.eval(null, "({ obj: true })", function (aResponse) {
|
do_check_eq(response.type, "resumed");
|
||||||
do_check_eq(aResponse.type, "resumed");
|
|
||||||
// Expect a pause notification immediately.
|
// Expect a pause notification immediately.
|
||||||
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||||
// Check the return value...
|
// Check the return value...
|
||||||
do_check_eq(aPacket.type, "paused");
|
do_check_eq(packet.type, "paused");
|
||||||
do_check_eq(aPacket.why.type, "clientEvaluated");
|
do_check_eq(packet.why.type, "clientEvaluated");
|
||||||
do_check_eq(aPacket.why.frameFinished.return.type, "object");
|
do_check_eq(packet.why.frameFinished.return.type, "object");
|
||||||
do_check_eq(aPacket.why.frameFinished.return.class, "Object");
|
do_check_eq(packet.why.frameFinished.return.class, "Object");
|
||||||
|
|
||||||
// Make sure the previous pause lifetime was correctly dropped.
|
// Make sure the previous pause lifetime was correctly dropped.
|
||||||
gClient.request({ to: arg1Actor, type: "bogusRequest" }, function (aResponse) {
|
gClient.request({ to: arg1Actor, type: "bogusRequest" }, function (response) {
|
||||||
do_check_eq(aResponse.error, "noSuchActor");
|
do_check_eq(response.error, "noSuchActor");
|
||||||
gThreadClient.resume(function () {
|
gThreadClient.resume(function () {
|
||||||
finishClient(gClient);
|
finishClient(gClient);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/* eslint-disable */
|
||||||
gDebuggee.eval("(" + function () {
|
gDebuggee.eval("(" + function () {
|
||||||
function stopMe(arg1) { debugger; }
|
function stopMe(arg1) { debugger; }
|
||||||
stopMe({obj: true});
|
stopMe({obj: true});
|
||||||
} + ")()");
|
} + ")()");
|
||||||
|
/* eslint-enable */
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
/* eslint-disable no-shadow, max-nested-callbacks */
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check eval resume/re-pause with a throw.
|
* Check eval resume/re-pause with a throw.
|
||||||
|
|
@ -9,31 +12,30 @@ var gDebuggee;
|
||||||
var gClient;
|
var gClient;
|
||||||
var gThreadClient;
|
var gThreadClient;
|
||||||
|
|
||||||
function run_test()
|
function run_test() {
|
||||||
{
|
|
||||||
initTestDebuggerServer();
|
initTestDebuggerServer();
|
||||||
gDebuggee = addTestGlobal("test-stack");
|
gDebuggee = addTestGlobal("test-stack");
|
||||||
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
||||||
gClient.connect().then(function () {
|
gClient.connect().then(function () {
|
||||||
attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) {
|
attachTestTabAndResume(gClient, "test-stack",
|
||||||
gThreadClient = aThreadClient;
|
function (response, tabClient, threadClient) {
|
||||||
test_throw_eval();
|
gThreadClient = threadClient;
|
||||||
});
|
test_throw_eval();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_throw_eval()
|
function test_throw_eval() {
|
||||||
{
|
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||||
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
gThreadClient.eval(null, "throw 'failure'", function (response) {
|
||||||
gThreadClient.eval(null, "throw 'failure'", function (aResponse) {
|
do_check_eq(response.type, "resumed");
|
||||||
do_check_eq(aResponse.type, "resumed");
|
|
||||||
// Expect a pause notification immediately.
|
// Expect a pause notification immediately.
|
||||||
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||||
// Check the return value...
|
// Check the return value...
|
||||||
do_check_eq(aPacket.type, "paused");
|
do_check_eq(packet.type, "paused");
|
||||||
do_check_eq(aPacket.why.type, "clientEvaluated");
|
do_check_eq(packet.why.type, "clientEvaluated");
|
||||||
do_check_eq(aPacket.why.frameFinished.throw, "failure");
|
do_check_eq(packet.why.frameFinished.throw, "failure");
|
||||||
gThreadClient.resume(function () {
|
gThreadClient.resume(function () {
|
||||||
finishClient(gClient);
|
finishClient(gClient);
|
||||||
});
|
});
|
||||||
|
|
@ -41,8 +43,10 @@ function test_throw_eval()
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/* eslint-disable */
|
||||||
gDebuggee.eval("(" + function () {
|
gDebuggee.eval("(" + function () {
|
||||||
function stopMe(arg1) { debugger; }
|
function stopMe(arg1) { debugger; }
|
||||||
stopMe({obj: true});
|
stopMe({obj: true});
|
||||||
} + ")()");
|
} + ")()");
|
||||||
|
/* eslint-enable */
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
/* eslint-disable no-shadow, max-nested-callbacks */
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check syntax errors in an eval.
|
* Check syntax errors in an eval.
|
||||||
|
|
@ -9,32 +12,31 @@ var gDebuggee;
|
||||||
var gClient;
|
var gClient;
|
||||||
var gThreadClient;
|
var gThreadClient;
|
||||||
|
|
||||||
function run_test()
|
function run_test() {
|
||||||
{
|
|
||||||
initTestDebuggerServer();
|
initTestDebuggerServer();
|
||||||
gDebuggee = addTestGlobal("test-stack");
|
gDebuggee = addTestGlobal("test-stack");
|
||||||
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
||||||
gClient.connect().then().then(function () {
|
gClient.connect().then().then(function () {
|
||||||
attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) {
|
attachTestTabAndResume(gClient, "test-stack",
|
||||||
gThreadClient = aThreadClient;
|
function (response, tabClient, threadClient) {
|
||||||
test_syntax_error_eval();
|
gThreadClient = threadClient;
|
||||||
});
|
test_syntax_error_eval();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_syntax_error_eval()
|
function test_syntax_error_eval() {
|
||||||
{
|
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||||
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
gThreadClient.eval(null, "%$@!@#", function (response) {
|
||||||
gThreadClient.eval(null, "%$@!@#", function (aResponse) {
|
do_check_eq(response.type, "resumed");
|
||||||
do_check_eq(aResponse.type, "resumed");
|
|
||||||
// Expect a pause notification immediately.
|
// Expect a pause notification immediately.
|
||||||
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||||
// Check the return value...
|
// Check the return value...
|
||||||
do_check_eq(aPacket.type, "paused");
|
do_check_eq(packet.type, "paused");
|
||||||
do_check_eq(aPacket.why.type, "clientEvaluated");
|
do_check_eq(packet.why.type, "clientEvaluated");
|
||||||
do_check_eq(aPacket.why.frameFinished.throw.type, "object");
|
do_check_eq(packet.why.frameFinished.throw.type, "object");
|
||||||
do_check_eq(aPacket.why.frameFinished.throw.class, "Error");
|
do_check_eq(packet.why.frameFinished.throw.class, "Error");
|
||||||
|
|
||||||
gThreadClient.resume(function () {
|
gThreadClient.resume(function () {
|
||||||
finishClient(gClient);
|
finishClient(gClient);
|
||||||
|
|
@ -43,8 +45,10 @@ function test_syntax_error_eval()
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/* eslint-disable */
|
||||||
gDebuggee.eval("(" + function () {
|
gDebuggee.eval("(" + function () {
|
||||||
function stopMe(arg1) { debugger; }
|
function stopMe(arg1) { debugger; }
|
||||||
stopMe({obj: true});
|
stopMe({obj: true});
|
||||||
} + ")()");
|
} + ")()");
|
||||||
|
/* eslint-enable */
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
/* eslint-disable no-shadow, max-nested-callbacks */
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check evals against different frames.
|
* Check evals against different frames.
|
||||||
|
|
@ -9,43 +12,41 @@ var gDebuggee;
|
||||||
var gClient;
|
var gClient;
|
||||||
var gThreadClient;
|
var gThreadClient;
|
||||||
|
|
||||||
function run_test()
|
function run_test() {
|
||||||
{
|
|
||||||
initTestDebuggerServer();
|
initTestDebuggerServer();
|
||||||
gDebuggee = addTestGlobal("test-stack");
|
gDebuggee = addTestGlobal("test-stack");
|
||||||
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
||||||
gClient.connect().then(function () {
|
gClient.connect().then(function () {
|
||||||
attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) {
|
attachTestTabAndResume(gClient, "test-stack",
|
||||||
gThreadClient = aThreadClient;
|
function (response, tabClient, threadClient) {
|
||||||
test_syntax_error_eval();
|
gThreadClient = threadClient;
|
||||||
});
|
test_different_frames_eval();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_syntax_error_eval()
|
function test_different_frames_eval() {
|
||||||
{
|
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||||
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
gThreadClient.getFrames(0, 2, function (response) {
|
||||||
|
let frame0 = response.frames[0];
|
||||||
gThreadClient.getFrames(0, 2, function (aResponse) {
|
let frame1 = response.frames[1];
|
||||||
let frame0 = aResponse.frames[0];
|
|
||||||
let frame1 = aResponse.frames[1];
|
|
||||||
|
|
||||||
// Eval against the top frame...
|
// Eval against the top frame...
|
||||||
gThreadClient.eval(frame0.actor, "arg", function (aResponse) {
|
gThreadClient.eval(frame0.actor, "arg", function (response) {
|
||||||
do_check_eq(aResponse.type, "resumed");
|
do_check_eq(response.type, "resumed");
|
||||||
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||||
// 'arg' should have been evaluated in frame0
|
// 'arg' should have been evaluated in frame0
|
||||||
do_check_eq(aPacket.type, "paused");
|
do_check_eq(packet.type, "paused");
|
||||||
do_check_eq(aPacket.why.type, "clientEvaluated");
|
do_check_eq(packet.why.type, "clientEvaluated");
|
||||||
do_check_eq(aPacket.why.frameFinished.return, "arg0");
|
do_check_eq(packet.why.frameFinished.return, "arg0");
|
||||||
|
|
||||||
// Now eval against the second frame.
|
// Now eval against the second frame.
|
||||||
gThreadClient.eval(frame1.actor, "arg", function (aResponse) {
|
gThreadClient.eval(frame1.actor, "arg", function (response) {
|
||||||
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||||
// 'arg' should have been evaluated in frame1
|
// 'arg' should have been evaluated in frame1
|
||||||
do_check_eq(aPacket.type, "paused");
|
do_check_eq(packet.type, "paused");
|
||||||
do_check_eq(aPacket.why.frameFinished.return, "arg1");
|
do_check_eq(packet.why.frameFinished.return, "arg1");
|
||||||
|
|
||||||
gThreadClient.resume(function () {
|
gThreadClient.resume(function () {
|
||||||
finishClient(gClient);
|
finishClient(gClient);
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
/* eslint-disable no-shadow, max-nested-callbacks */
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check pauses within evals.
|
* Check pauses within evals.
|
||||||
|
|
@ -9,34 +12,33 @@ var gDebuggee;
|
||||||
var gClient;
|
var gClient;
|
||||||
var gThreadClient;
|
var gThreadClient;
|
||||||
|
|
||||||
function run_test()
|
function run_test() {
|
||||||
{
|
|
||||||
initTestDebuggerServer();
|
initTestDebuggerServer();
|
||||||
gDebuggee = addTestGlobal("test-stack");
|
gDebuggee = addTestGlobal("test-stack");
|
||||||
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
||||||
gClient.connect().then(function () {
|
gClient.connect().then(function () {
|
||||||
attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) {
|
attachTestTabAndResume(gClient, "test-stack",
|
||||||
gThreadClient = aThreadClient;
|
function (response, tabClient, threadClient) {
|
||||||
test_syntax_error_eval();
|
gThreadClient = threadClient;
|
||||||
});
|
test_pauses_eval();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_syntax_error_eval()
|
function test_pauses_eval() {
|
||||||
{
|
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||||
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
gThreadClient.eval(null, "debugger", function (response) {
|
||||||
gThreadClient.eval(null, "debugger", function (aResponse) {
|
|
||||||
// Expect a resume then a debuggerStatement pause.
|
// Expect a resume then a debuggerStatement pause.
|
||||||
do_check_eq(aResponse.type, "resumed");
|
do_check_eq(response.type, "resumed");
|
||||||
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||||
do_check_eq(aPacket.why.type, "debuggerStatement");
|
do_check_eq(packet.why.type, "debuggerStatement");
|
||||||
// Resume from the debugger statement should immediately re-pause
|
// Resume from the debugger statement should immediately re-pause
|
||||||
// with a clientEvaluated reason.
|
// with a clientEvaluated reason.
|
||||||
gThreadClient.resume(function (aPacket) {
|
gThreadClient.resume(function (packet) {
|
||||||
do_check_eq(aPacket.type, "resumed");
|
do_check_eq(packet.type, "resumed");
|
||||||
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||||
do_check_eq(aPacket.why.type, "clientEvaluated");
|
do_check_eq(packet.why.type, "clientEvaluated");
|
||||||
gThreadClient.resume(function () {
|
gThreadClient.resume(function () {
|
||||||
finishClient(gClient);
|
finishClient(gClient);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,7 @@
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
function run_test()
|
function run_test() {
|
||||||
{
|
|
||||||
let {EventLoopLagFront} = require("devtools/shared/fronts/eventlooplag");
|
let {EventLoopLagFront} = require("devtools/shared/fronts/eventlooplag");
|
||||||
|
|
||||||
DebuggerServer.init();
|
DebuggerServer.init();
|
||||||
|
|
@ -18,7 +17,6 @@ function run_test()
|
||||||
let threshold = 20;
|
let threshold = 20;
|
||||||
let interval = 10;
|
let interval = 10;
|
||||||
|
|
||||||
|
|
||||||
let front;
|
let front;
|
||||||
let client = new DebuggerClient(DebuggerServer.connectPipe());
|
let client = new DebuggerClient(DebuggerServer.connectPipe());
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
/* Exercise prefix-based forwarding of packets to other transports. */
|
/* Exercise prefix-based forwarding of packets to other transports. */
|
||||||
|
|
||||||
const { RootActor } = require("devtools/server/actors/root");
|
const { RootActor } = require("devtools/server/actors/root");
|
||||||
|
|
@ -9,8 +11,7 @@ var gMainConnection, gMainTransport;
|
||||||
var gSubconnection1, gSubconnection2;
|
var gSubconnection1, gSubconnection2;
|
||||||
var gClient;
|
var gClient;
|
||||||
|
|
||||||
function run_test()
|
function run_test() {
|
||||||
{
|
|
||||||
DebuggerServer.init();
|
DebuggerServer.init();
|
||||||
|
|
||||||
add_test(createMainConnection);
|
add_test(createMainConnection);
|
||||||
|
|
@ -31,28 +32,26 @@ function run_test()
|
||||||
* (that is, packets sent on |transport| go to the new connection, and
|
* (that is, packets sent on |transport| go to the new connection, and
|
||||||
* |transport|'s hooks receive replies).
|
* |transport|'s hooks receive replies).
|
||||||
*
|
*
|
||||||
* |aPrefix| is optional; if present, it's the prefix (minus the '/') for
|
* |prefix| is optional; if present, it's the prefix (minus the '/') for
|
||||||
* actors in the new connection.
|
* actors in the new connection.
|
||||||
*/
|
*/
|
||||||
function newConnection(aPrefix)
|
function newConnection(prefix) {
|
||||||
{
|
let conn;
|
||||||
var conn;
|
DebuggerServer.createRootActor = function (connection) {
|
||||||
DebuggerServer.createRootActor = function (aConn) {
|
conn = connection;
|
||||||
conn = aConn;
|
return new RootActor(connection, {});
|
||||||
return new RootActor(aConn, {});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
var transport = DebuggerServer.connectPipe(aPrefix);
|
let transport = DebuggerServer.connectPipe(prefix);
|
||||||
|
|
||||||
return { conn: conn, transport: transport };
|
return { conn: conn, transport: transport };
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create the main connection for these tests. */
|
/* Create the main connection for these tests. */
|
||||||
function createMainConnection()
|
function createMainConnection() {
|
||||||
{
|
|
||||||
({ conn: gMainConnection, transport: gMainTransport } = newConnection());
|
({ conn: gMainConnection, transport: gMainTransport } = newConnection());
|
||||||
gClient = new DebuggerClient(gMainTransport);
|
gClient = new DebuggerClient(gMainTransport);
|
||||||
gClient.connect().then(([aType, aTraits]) => run_next_test());
|
gClient.connect().then(([type, traits]) => run_next_test());
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -63,13 +62,13 @@ function createMainConnection()
|
||||||
* - prefix2/root
|
* - prefix2/root
|
||||||
* - prefix2/actor
|
* - prefix2/actor
|
||||||
*
|
*
|
||||||
* Expect proper echos from those named in |aReachables|, and 'noSuchActor'
|
* Expect proper echos from those named in |reachables|, and 'noSuchActor'
|
||||||
* errors from the others. When we've gotten all our replies (errors or
|
* errors from the others. When we've gotten all our replies (errors or
|
||||||
* otherwise), call |aCompleted|.
|
* otherwise), call |completed|.
|
||||||
*
|
*
|
||||||
* To avoid deep stacks, we call aCompleted from the next tick.
|
* To avoid deep stacks, we call completed from the next tick.
|
||||||
*/
|
*/
|
||||||
function tryActors(aReachables, aCompleted) {
|
function tryActors(reachables, completed) {
|
||||||
let count = 0;
|
let count = 0;
|
||||||
|
|
||||||
let outerActor;
|
let outerActor;
|
||||||
|
|
@ -84,16 +83,22 @@ function tryActors(aReachables, aCompleted) {
|
||||||
|
|
||||||
count++;
|
count++;
|
||||||
|
|
||||||
gClient.request({ to: actor, type: "echo", value: "tango"}, // phone home
|
// phone home
|
||||||
(aResponse) => {
|
gClient.request(
|
||||||
if (aReachables.has(actor))
|
{ to: actor, type: "echo", value: "tango"},
|
||||||
do_check_matches({ from: actor, to: actor, type: "echo", value: "tango" }, aResponse);
|
(response) => {
|
||||||
else
|
if (reachables.has(actor)) {
|
||||||
do_check_matches({ from: actor, error: "noSuchActor", message: "No such actor for ID: " + actor }, aResponse);
|
do_check_matches({ from: actor, to: actor,
|
||||||
|
type: "echo", value: "tango" }, response);
|
||||||
|
} else {
|
||||||
|
do_check_matches({ from: actor, error: "noSuchActor",
|
||||||
|
message: "No such actor for ID: " + actor }, response);
|
||||||
|
}
|
||||||
|
|
||||||
if (--count == 0)
|
if (--count == 0) {
|
||||||
do_execute_soon(aCompleted, "tryActors callback " + aCompleted.name);
|
do_execute_soon(completed, "tryActors callback " + completed.name);
|
||||||
});
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -102,56 +107,50 @@ function tryActors(aReachables, aCompleted) {
|
||||||
* but sending messages to prefixed actor names, or anyone else, should get
|
* but sending messages to prefixed actor names, or anyone else, should get
|
||||||
* an error.
|
* an error.
|
||||||
*/
|
*/
|
||||||
function TestNoForwardingYet()
|
function TestNoForwardingYet() {
|
||||||
{
|
|
||||||
tryActors(new Set(["root"]), run_next_test);
|
tryActors(new Set(["root"]), run_next_test);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Create a new pipe connection which forwards its reply packets to
|
* Create a new pipe connection which forwards its reply packets to
|
||||||
* gMainConnection's client, and to which gMainConnection forwards packets
|
* gMainConnection's client, and to which gMainConnection forwards packets
|
||||||
* directed to actors whose names begin with |aPrefix + '/'|, and.
|
* directed to actors whose names begin with |prefix + '/'|, and.
|
||||||
*
|
*
|
||||||
* Return an object { conn, transport }, as for newConnection.
|
* Return an object { conn, transport }, as for newConnection.
|
||||||
*/
|
*/
|
||||||
function newSubconnection(aPrefix)
|
function newSubconnection(prefix) {
|
||||||
{
|
let { conn, transport } = newConnection(prefix);
|
||||||
let { conn, transport } = newConnection(aPrefix);
|
|
||||||
transport.hooks = {
|
transport.hooks = {
|
||||||
onPacket: (aPacket) => gMainConnection.send(aPacket),
|
onPacket: (packet) => gMainConnection.send(packet),
|
||||||
onClosed: () => {}
|
onClosed: () => {}
|
||||||
};
|
};
|
||||||
gMainConnection.setForwarding(aPrefix, transport);
|
gMainConnection.setForwarding(prefix, transport);
|
||||||
|
|
||||||
return { conn: conn, transport: transport };
|
return { conn: conn, transport: transport };
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create a second root actor, to which we can forward things. */
|
/* Create a second root actor, to which we can forward things. */
|
||||||
function createSubconnection1()
|
function createSubconnection1() {
|
||||||
{
|
|
||||||
let { conn, transport } = newSubconnection("prefix1");
|
let { conn, transport } = newSubconnection("prefix1");
|
||||||
gSubconnection1 = conn;
|
gSubconnection1 = conn;
|
||||||
transport.ready();
|
transport.ready();
|
||||||
gClient.expectReply("prefix1/root", (aReply) => run_next_test());
|
gClient.expectReply("prefix1/root", (reply) => run_next_test());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Establish forwarding, but don't put any actors in that server.
|
// Establish forwarding, but don't put any actors in that server.
|
||||||
function TestForwardPrefix1OnlyRoot()
|
function TestForwardPrefix1OnlyRoot() {
|
||||||
{
|
|
||||||
tryActors(new Set(["root", "prefix1/root"]), run_next_test);
|
tryActors(new Set(["root", "prefix1/root"]), run_next_test);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create a third root actor, to which we can forward things. */
|
/* Create a third root actor, to which we can forward things. */
|
||||||
function createSubconnection2()
|
function createSubconnection2() {
|
||||||
{
|
|
||||||
let { conn, transport } = newSubconnection("prefix2");
|
let { conn, transport } = newSubconnection("prefix2");
|
||||||
gSubconnection2 = conn;
|
gSubconnection2 = conn;
|
||||||
transport.ready();
|
transport.ready();
|
||||||
gClient.expectReply("prefix2/root", (aReply) => run_next_test());
|
gClient.expectReply("prefix2/root", (reply) => run_next_test());
|
||||||
}
|
}
|
||||||
|
|
||||||
function TestForwardPrefix12OnlyRoot()
|
function TestForwardPrefix12OnlyRoot() {
|
||||||
{
|
|
||||||
tryActors(new Set(["root", "prefix1/root", "prefix2/root"]), run_next_test);
|
tryActors(new Set(["root", "prefix1/root", "prefix2/root"]), run_next_test);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -161,36 +160,39 @@ function TestForwardPrefix12OnlyRoot()
|
||||||
// the reply-sending code attaches the replying actor's name to the packet,
|
// the reply-sending code attaches the replying actor's name to the packet,
|
||||||
// so simply matching the 'from' field in the reply ensures that we heard
|
// so simply matching the 'from' field in the reply ensures that we heard
|
||||||
// from the right actor.
|
// from the right actor.
|
||||||
function EchoActor(aConnection)
|
function EchoActor(connection) {
|
||||||
{
|
this.conn = connection;
|
||||||
this.conn = aConnection;
|
|
||||||
}
|
}
|
||||||
EchoActor.prototype.actorPrefix = "EchoActor";
|
EchoActor.prototype.actorPrefix = "EchoActor";
|
||||||
EchoActor.prototype.onEcho = function (aRequest) {
|
EchoActor.prototype.onEcho = function (request) {
|
||||||
/*
|
/*
|
||||||
* Request packets are frozen. Copy aRequest, so that
|
* Request packets are frozen. Copy request, so that
|
||||||
* DebuggerServerConnection.onPacket can attach a 'from' property.
|
* DebuggerServerConnection.onPacket can attach a 'from' property.
|
||||||
*/
|
*/
|
||||||
return JSON.parse(JSON.stringify(aRequest));
|
return JSON.parse(JSON.stringify(request));
|
||||||
};
|
};
|
||||||
EchoActor.prototype.requestTypes = {
|
EchoActor.prototype.requestTypes = {
|
||||||
"echo": EchoActor.prototype.onEcho
|
"echo": EchoActor.prototype.onEcho
|
||||||
};
|
};
|
||||||
|
|
||||||
function TestForwardPrefix12WithActor1()
|
function TestForwardPrefix12WithActor1() {
|
||||||
{
|
|
||||||
let actor = new EchoActor(gSubconnection1);
|
let actor = new EchoActor(gSubconnection1);
|
||||||
actor.actorID = "prefix1/actor";
|
actor.actorID = "prefix1/actor";
|
||||||
gSubconnection1.addActor(actor);
|
gSubconnection1.addActor(actor);
|
||||||
|
|
||||||
tryActors(new Set(["root", "prefix1/root", "prefix1/actor", "prefix2/root"]), run_next_test);
|
tryActors(
|
||||||
|
new Set(["root", "prefix1/root", "prefix1/actor", "prefix2/root"]),
|
||||||
|
run_next_test
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function TestForwardPrefix12WithActor12()
|
function TestForwardPrefix12WithActor12() {
|
||||||
{
|
|
||||||
let actor = new EchoActor(gSubconnection2);
|
let actor = new EchoActor(gSubconnection2);
|
||||||
actor.actorID = "prefix2/actor";
|
actor.actorID = "prefix2/actor";
|
||||||
gSubconnection2.addActor(actor);
|
gSubconnection2.addActor(actor);
|
||||||
|
|
||||||
tryActors(new Set(["root", "prefix1/root", "prefix1/actor", "prefix2/root", "prefix2/actor"]), run_next_test);
|
tryActors(
|
||||||
|
new Set(["root", "prefix1/root", "prefix1/actor", "prefix2/root", "prefix2/actor"]),
|
||||||
|
run_next_test
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Verify that we get a frame actor along with a debugger statement.
|
* Verify that we get a frame actor along with a debugger statement.
|
||||||
*/
|
*/
|
||||||
|
|
@ -9,26 +11,25 @@ var gDebuggee;
|
||||||
var gClient;
|
var gClient;
|
||||||
var gThreadClient;
|
var gThreadClient;
|
||||||
|
|
||||||
function run_test()
|
function run_test() {
|
||||||
{
|
|
||||||
initTestDebuggerServer();
|
initTestDebuggerServer();
|
||||||
gDebuggee = addTestGlobal("test-stack");
|
gDebuggee = addTestGlobal("test-stack");
|
||||||
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
||||||
gClient.connect().then(function () {
|
gClient.connect().then(function () {
|
||||||
attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) {
|
attachTestTabAndResume(gClient, "test-stack",
|
||||||
gThreadClient = aThreadClient;
|
function (response, tabClient, threadClient) {
|
||||||
test_pause_frame();
|
gThreadClient = threadClient;
|
||||||
});
|
test_pause_frame();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_pause_frame()
|
function test_pause_frame() {
|
||||||
{
|
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||||
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
do_check_true(!!packet.frame);
|
||||||
do_check_true(!!aPacket.frame);
|
do_check_true(!!packet.frame.actor);
|
||||||
do_check_true(!!aPacket.frame.actor);
|
do_check_eq(packet.frame.callee.name, "stopMe");
|
||||||
do_check_eq(aPacket.frame.callee.name, "stopMe");
|
|
||||||
gThreadClient.resume(function () {
|
gThreadClient.resume(function () {
|
||||||
finishClient(gClient);
|
finishClient(gClient);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
/* eslint-disable no-shadow */
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Verify that two pauses in a row will keep the same frame actor.
|
* Verify that two pauses in a row will keep the same frame actor.
|
||||||
|
|
@ -9,25 +12,24 @@ var gDebuggee;
|
||||||
var gClient;
|
var gClient;
|
||||||
var gThreadClient;
|
var gThreadClient;
|
||||||
|
|
||||||
function run_test()
|
function run_test() {
|
||||||
{
|
|
||||||
initTestDebuggerServer();
|
initTestDebuggerServer();
|
||||||
gDebuggee = addTestGlobal("test-stack");
|
gDebuggee = addTestGlobal("test-stack");
|
||||||
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
||||||
gClient.connect().then(function () {
|
gClient.connect().then(function () {
|
||||||
attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) {
|
attachTestTabAndResume(gClient, "test-stack",
|
||||||
gThreadClient = aThreadClient;
|
function (response, tabClient, threadClient) {
|
||||||
test_pause_frame();
|
gThreadClient = threadClient;
|
||||||
});
|
test_pause_frame();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_pause_frame()
|
function test_pause_frame() {
|
||||||
{
|
gThreadClient.addOneTimeListener("paused", function (event, packet1) {
|
||||||
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket1) {
|
gThreadClient.addOneTimeListener("paused", function (event, packet2) {
|
||||||
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket2) {
|
do_check_eq(packet1.frame.actor, packet2.frame.actor);
|
||||||
do_check_eq(aPacket1.frame.actor, aPacket2.frame.actor);
|
|
||||||
gThreadClient.resume(function () {
|
gThreadClient.resume(function () {
|
||||||
finishClient(gClient);
|
finishClient(gClient);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
/* eslint-disable no-shadow */
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Verify that a frame actor is properly expired when the frame goes away.
|
* Verify that a frame actor is properly expired when the frame goes away.
|
||||||
|
|
@ -9,27 +12,26 @@ var gDebuggee;
|
||||||
var gClient;
|
var gClient;
|
||||||
var gThreadClient;
|
var gThreadClient;
|
||||||
|
|
||||||
function run_test()
|
function run_test() {
|
||||||
{
|
|
||||||
initTestDebuggerServer();
|
initTestDebuggerServer();
|
||||||
gDebuggee = addTestGlobal("test-stack");
|
gDebuggee = addTestGlobal("test-stack");
|
||||||
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
||||||
gClient.connect().then(function () {
|
gClient.connect().then(function () {
|
||||||
attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) {
|
attachTestTabAndResume(gClient, "test-stack",
|
||||||
gThreadClient = aThreadClient;
|
function (response, tabClient, threadClient) {
|
||||||
test_pause_frame();
|
gThreadClient = threadClient;
|
||||||
});
|
test_pause_frame();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_pause_frame()
|
function test_pause_frame() {
|
||||||
{
|
gThreadClient.addOneTimeListener("paused", function (event, packet1) {
|
||||||
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket1) {
|
gThreadClient.addOneTimeListener("paused", function (event, packet2) {
|
||||||
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket2) {
|
let poppedFrames = packet2.poppedFrames;
|
||||||
let poppedFrames = aPacket2.poppedFrames;
|
|
||||||
do_check_eq(typeof (poppedFrames), typeof ([]));
|
do_check_eq(typeof (poppedFrames), typeof ([]));
|
||||||
do_check_true(poppedFrames.indexOf(aPacket1.frame.actor) >= 0);
|
do_check_true(poppedFrames.indexOf(packet1.frame.actor) >= 0);
|
||||||
gThreadClient.resume(function () {
|
gThreadClient.resume(function () {
|
||||||
finishClient(gClient);
|
finishClient(gClient);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Verify the "frames" request on the thread.
|
* Verify the "frames" request on the thread.
|
||||||
*/
|
*/
|
||||||
|
|
@ -9,16 +11,16 @@ var gDebuggee;
|
||||||
var gClient;
|
var gClient;
|
||||||
var gThreadClient;
|
var gThreadClient;
|
||||||
|
|
||||||
function run_test()
|
function run_test() {
|
||||||
{
|
|
||||||
initTestDebuggerServer();
|
initTestDebuggerServer();
|
||||||
gDebuggee = addTestGlobal("test-stack");
|
gDebuggee = addTestGlobal("test-stack");
|
||||||
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
||||||
gClient.connect().then(function () {
|
gClient.connect().then(function () {
|
||||||
attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) {
|
attachTestTabAndResume(gClient, "test-stack",
|
||||||
gThreadClient = aThreadClient;
|
function (response, tabClient, threadClient) {
|
||||||
test_pause_frame();
|
gThreadClient = threadClient;
|
||||||
});
|
test_pause_frame();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
}
|
}
|
||||||
|
|
@ -46,17 +48,18 @@ var gSliceTests = [
|
||||||
|
|
||||||
function test_frame_slice() {
|
function test_frame_slice() {
|
||||||
if (gSliceTests.length == 0) {
|
if (gSliceTests.length == 0) {
|
||||||
gThreadClient.resume(function () { finishClient(gClient); });
|
gThreadClient.resume(() => finishClient(gClient));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let test = gSliceTests.shift();
|
let test = gSliceTests.shift();
|
||||||
gThreadClient.getFrames(test.start, test.count, function (aResponse) {
|
gThreadClient.getFrames(test.start, test.count, function (response) {
|
||||||
var testFrames = gFrames.slice(test.start, test.count ? test.start + test.count : undefined);
|
let testFrames = gFrames.slice(test.start,
|
||||||
do_check_eq(testFrames.length, aResponse.frames.length);
|
test.count ? test.start + test.count : undefined);
|
||||||
for (var i = 0; i < testFrames.length; i++) {
|
do_check_eq(testFrames.length, response.frames.length);
|
||||||
|
for (let i = 0; i < testFrames.length; i++) {
|
||||||
let expected = testFrames[i];
|
let expected = testFrames[i];
|
||||||
let actual = aResponse.frames[i];
|
let actual = response.frames[i];
|
||||||
|
|
||||||
if (test.resetActors) {
|
if (test.resetActors) {
|
||||||
expected.actor = actual.actor;
|
expected.actor = actual.actor;
|
||||||
|
|
@ -70,9 +73,8 @@ function test_frame_slice() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_pause_frame()
|
function test_pause_frame() {
|
||||||
{
|
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||||
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket1) {
|
|
||||||
test_frame_slice();
|
test_frame_slice();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
/* eslint-disable no-shadow, max-nested-callbacks */
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Verify that frame actors retrieved with the frames request
|
* Verify that frame actors retrieved with the frames request
|
||||||
|
|
@ -10,64 +13,37 @@ var gDebuggee;
|
||||||
var gClient;
|
var gClient;
|
||||||
var gThreadClient;
|
var gThreadClient;
|
||||||
|
|
||||||
function run_test()
|
function run_test() {
|
||||||
{
|
|
||||||
initTestDebuggerServer();
|
initTestDebuggerServer();
|
||||||
gDebuggee = addTestGlobal("test-stack");
|
gDebuggee = addTestGlobal("test-stack");
|
||||||
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
||||||
gClient.connect().then(function () {
|
gClient.connect().then(function () {
|
||||||
attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) {
|
attachTestTabAndResume(gClient, "test-stack",
|
||||||
gThreadClient = aThreadClient;
|
function (response, tabClient, threadClient) {
|
||||||
test_pause_frame();
|
gThreadClient = threadClient;
|
||||||
});
|
test_pause_frame();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_frame_slice() {
|
function test_pause_frame() {
|
||||||
if (gSliceTests.length == 0) {
|
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||||
gThreadClient.resume(function () { finishClient(gClient); });
|
gThreadClient.getFrames(0, null, function (frameResponse) {
|
||||||
return;
|
do_check_eq(frameResponse.frames.length, 5);
|
||||||
}
|
|
||||||
|
|
||||||
let test = gSliceTests.shift();
|
|
||||||
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++) {
|
|
||||||
let expected = testFrames[i];
|
|
||||||
let actual = aResponse.frames[i];
|
|
||||||
|
|
||||||
if (test.resetActors) {
|
|
||||||
expected.actor = actual.actor;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (var key in expected) {
|
|
||||||
do_check_eq(expected[key], actual[key]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
test_frame_slice();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function test_pause_frame()
|
|
||||||
{
|
|
||||||
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket1) {
|
|
||||||
gThreadClient.getFrames(0, null, function (aFrameResponse) {
|
|
||||||
do_check_eq(aFrameResponse.frames.length, 5);
|
|
||||||
// Now wait for the next pause, after which the three
|
// Now wait for the next pause, after which the three
|
||||||
// youngest actors should be popped..
|
// youngest actors should be popped..
|
||||||
let expectPopped = aFrameResponse.frames.slice(0, 3).map(frame => frame.actor);
|
let expectPopped = frameResponse.frames.slice(0, 3).map(frame => frame.actor);
|
||||||
expectPopped.sort();
|
expectPopped.sort();
|
||||||
|
|
||||||
gThreadClient.addOneTimeListener("paused", function (aEvent, aPausePacket) {
|
gThreadClient.addOneTimeListener("paused", function (event, pausePacket) {
|
||||||
let popped = aPausePacket.poppedFrames.sort();
|
let popped = pausePacket.poppedFrames.sort();
|
||||||
do_check_eq(popped.length, 3);
|
do_check_eq(popped.length, 3);
|
||||||
for (let i = 0; i < 3; i++) {
|
for (let i = 0; i < 3; i++) {
|
||||||
do_check_eq(expectPopped[i], popped[i]);
|
do_check_eq(expectPopped[i], popped[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
gThreadClient.resume(function () { finishClient(gClient); });
|
gThreadClient.resume(() => finishClient(gClient));
|
||||||
});
|
});
|
||||||
gThreadClient.resume();
|
gThreadClient.resume();
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
/* eslint-disable no-shadow */
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Verify that wasm frame(s) can be requested from the client.
|
* Verify that wasm frame(s) can be requested from the client.
|
||||||
|
|
@ -9,34 +12,35 @@ var gDebuggee;
|
||||||
var gClient;
|
var gClient;
|
||||||
var gThreadClient;
|
var gThreadClient;
|
||||||
|
|
||||||
function run_test()
|
function run_test() {
|
||||||
{
|
|
||||||
if (typeof WebAssembly == "undefined") {
|
if (typeof WebAssembly == "undefined") {
|
||||||
return; // wasm is not enabled for this platform
|
// wasm is not enabled for this platform
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
initTestDebuggerServer();
|
initTestDebuggerServer();
|
||||||
gDebuggee = addTestGlobal("test-stack");
|
gDebuggee = addTestGlobal("test-stack");
|
||||||
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
||||||
gClient.connect().then(function () {
|
gClient.connect().then(function () {
|
||||||
attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) {
|
attachTestTabAndResume(
|
||||||
gThreadClient = aThreadClient;
|
gClient, "test-stack",
|
||||||
gThreadClient.reconfigure({ observeAsmJS: true }, function (aResponse) {
|
function (response, tabClient, threadClient) {
|
||||||
do_check_eq(!!aResponse.error, false);
|
gThreadClient = threadClient;
|
||||||
test_pause_frame();
|
gThreadClient.reconfigure({ observeAsmJS: true }, function (response) {
|
||||||
|
do_check_eq(!!response.error, false);
|
||||||
|
test_pause_frame();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
});
|
});
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_pause_frame()
|
function test_pause_frame() {
|
||||||
{
|
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||||
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket1) {
|
gThreadClient.getFrames(0, null, function (frameResponse) {
|
||||||
gThreadClient.getFrames(0, null, function (aFrameResponse) {
|
do_check_eq(frameResponse.frames.length, 4);
|
||||||
do_check_eq(aFrameResponse.frames.length, 4);
|
|
||||||
|
|
||||||
let wasmFrame = aFrameResponse.frames[1];
|
let wasmFrame = frameResponse.frames[1];
|
||||||
do_check_eq(wasmFrame.type, "wasmcall");
|
do_check_eq(wasmFrame.type, "wasmcall");
|
||||||
do_check_eq(wasmFrame.this, undefined);
|
do_check_eq(wasmFrame.this, undefined);
|
||||||
|
|
||||||
|
|
@ -49,15 +53,16 @@ function test_pause_frame()
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/* eslint-disable comma-spacing, max-len */
|
||||||
gDebuggee.eval("(" + function () {
|
gDebuggee.eval("(" + function () {
|
||||||
// WebAssembly bytecode was generated by running:
|
// WebAssembly bytecode was generated by running:
|
||||||
// js -e 'print(wasmTextToBinary("(module(import \"a\" \"b\")(func(export \"c\")call 0))"))'
|
// js -e 'print(wasmTextToBinary("(module(import \"a\" \"b\")(func(export \"c\")call 0))"))'
|
||||||
var m = new WebAssembly.Module(new Uint8Array([
|
let m = new WebAssembly.Module(new Uint8Array([
|
||||||
0,97,115,109,1,0,0,0,1,132,128,128,128,0,1,96,0,0,2,135,128,128,128,0,1,1,97,1,
|
0,97,115,109,1,0,0,0,1,132,128,128,128,0,1,96,0,0,2,135,128,128,128,0,1,1,97,1,
|
||||||
98,0,0,3,130,128,128,128,0,1,0,6,129,128,128,128,0,0,7,133,128,128,128,0,1,1,99,
|
98,0,0,3,130,128,128,128,0,1,0,6,129,128,128,128,0,0,7,133,128,128,128,0,1,1,99,
|
||||||
0,1,10,138,128,128,128,0,1,132,128,128,128,0,0,16,0,11
|
0,1,10,138,128,128,128,0,1,132,128,128,128,0,0,16,0,11
|
||||||
]));
|
]));
|
||||||
var i = new WebAssembly.Instance(m, {a: {b: () => {
|
let i = new WebAssembly.Instance(m, {a: {b: () => {
|
||||||
debugger;
|
debugger;
|
||||||
}}});
|
}}});
|
||||||
i.exports.c();
|
i.exports.c();
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check a frame actor's arguments property.
|
* Check a frame actor's arguments property.
|
||||||
*/
|
*/
|
||||||
|
|
@ -9,24 +11,23 @@ var gDebuggee;
|
||||||
var gClient;
|
var gClient;
|
||||||
var gThreadClient;
|
var gThreadClient;
|
||||||
|
|
||||||
function run_test()
|
function run_test() {
|
||||||
{
|
|
||||||
initTestDebuggerServer();
|
initTestDebuggerServer();
|
||||||
gDebuggee = addTestGlobal("test-stack");
|
gDebuggee = addTestGlobal("test-stack");
|
||||||
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
||||||
gClient.connect().then(function () {
|
gClient.connect().then(function () {
|
||||||
attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) {
|
attachTestTabAndResume(gClient, "test-stack",
|
||||||
gThreadClient = aThreadClient;
|
function (response, tabClient, threadClient) {
|
||||||
test_pause_frame();
|
gThreadClient = threadClient;
|
||||||
});
|
test_pause_frame();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_pause_frame()
|
function test_pause_frame() {
|
||||||
{
|
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||||
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
let args = packet.frame.arguments;
|
||||||
let args = aPacket.frame["arguments"];
|
|
||||||
do_check_eq(args.length, 6);
|
do_check_eq(args.length, 6);
|
||||||
do_check_eq(args[0], 42);
|
do_check_eq(args[0], 42);
|
||||||
do_check_eq(args[1], true);
|
do_check_eq(args[1], true);
|
||||||
|
|
@ -43,7 +44,7 @@ function test_pause_frame()
|
||||||
});
|
});
|
||||||
|
|
||||||
gDebuggee.eval("(" + function () {
|
gDebuggee.eval("(" + function () {
|
||||||
function stopMe(aNumber, aBool, aString, aNull, aUndefined, aObject) {
|
function stopMe(number, bool, string, null_, undef, object) {
|
||||||
debugger;
|
debugger;
|
||||||
}
|
}
|
||||||
stopMe(42, true, "nasu", null, undefined, { foo: "bar" });
|
stopMe(42, true, "nasu", null, undefined, { foo: "bar" });
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check a frame actor's bindings property.
|
* Check a frame actor's bindings property.
|
||||||
*/
|
*/
|
||||||
|
|
@ -9,36 +11,35 @@ var gDebuggee;
|
||||||
var gClient;
|
var gClient;
|
||||||
var gThreadClient;
|
var gThreadClient;
|
||||||
|
|
||||||
function run_test()
|
function run_test() {
|
||||||
{
|
|
||||||
initTestDebuggerServer();
|
initTestDebuggerServer();
|
||||||
gDebuggee = addTestGlobal("test-stack");
|
gDebuggee = addTestGlobal("test-stack");
|
||||||
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
||||||
gClient.connect().then(function () {
|
gClient.connect().then(function () {
|
||||||
attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) {
|
attachTestTabAndResume(gClient, "test-stack",
|
||||||
gThreadClient = aThreadClient;
|
function (response, tabClient, threadClient) {
|
||||||
test_pause_frame();
|
gThreadClient = threadClient;
|
||||||
});
|
test_pause_frame();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_pause_frame()
|
function test_pause_frame() {
|
||||||
{
|
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||||
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
let bindings = packet.frame.environment.bindings;
|
||||||
let bindings = aPacket.frame.environment.bindings;
|
|
||||||
let args = bindings.arguments;
|
let args = bindings.arguments;
|
||||||
let vars = bindings.variables;
|
let vars = bindings.variables;
|
||||||
|
|
||||||
do_check_eq(args.length, 6);
|
do_check_eq(args.length, 6);
|
||||||
do_check_eq(args[0].aNumber.value, 42);
|
do_check_eq(args[0].number.value, 42);
|
||||||
do_check_eq(args[1].aBool.value, true);
|
do_check_eq(args[1].bool.value, true);
|
||||||
do_check_eq(args[2].aString.value, "nasu");
|
do_check_eq(args[2].string.value, "nasu");
|
||||||
do_check_eq(args[3].aNull.value.type, "null");
|
do_check_eq(args[3].null_.value.type, "null");
|
||||||
do_check_eq(args[4].aUndefined.value.type, "undefined");
|
do_check_eq(args[4].undef.value.type, "undefined");
|
||||||
do_check_eq(args[5].aObject.value.type, "object");
|
do_check_eq(args[5].object.value.type, "object");
|
||||||
do_check_eq(args[5].aObject.value.class, "Object");
|
do_check_eq(args[5].object.value.class, "Object");
|
||||||
do_check_true(!!args[5].aObject.value.actor);
|
do_check_true(!!args[5].object.value.actor);
|
||||||
|
|
||||||
do_check_eq(vars.a.value, 1);
|
do_check_eq(vars.a.value, 1);
|
||||||
do_check_eq(vars.b.value, true);
|
do_check_eq(vars.b.value, true);
|
||||||
|
|
@ -47,17 +48,17 @@ function test_pause_frame()
|
||||||
do_check_true(!!vars.c.value.actor);
|
do_check_true(!!vars.c.value.actor);
|
||||||
|
|
||||||
let objClient = gThreadClient.pauseGrip(vars.c.value);
|
let objClient = gThreadClient.pauseGrip(vars.c.value);
|
||||||
objClient.getPrototypeAndProperties(function (aResponse) {
|
objClient.getPrototypeAndProperties(function (response) {
|
||||||
do_check_eq(aResponse.ownProperties.a.configurable, true);
|
do_check_eq(response.ownProperties.a.configurable, true);
|
||||||
do_check_eq(aResponse.ownProperties.a.enumerable, true);
|
do_check_eq(response.ownProperties.a.enumerable, true);
|
||||||
do_check_eq(aResponse.ownProperties.a.writable, true);
|
do_check_eq(response.ownProperties.a.writable, true);
|
||||||
do_check_eq(aResponse.ownProperties.a.value, "a");
|
do_check_eq(response.ownProperties.a.value, "a");
|
||||||
|
|
||||||
do_check_eq(aResponse.ownProperties.b.configurable, true);
|
do_check_eq(response.ownProperties.b.configurable, true);
|
||||||
do_check_eq(aResponse.ownProperties.b.enumerable, true);
|
do_check_eq(response.ownProperties.b.enumerable, true);
|
||||||
do_check_eq(aResponse.ownProperties.b.writable, true);
|
do_check_eq(response.ownProperties.b.writable, true);
|
||||||
do_check_eq(aResponse.ownProperties.b.value.type, "undefined");
|
do_check_eq(response.ownProperties.b.value.type, "undefined");
|
||||||
do_check_false("class" in aResponse.ownProperties.b.value);
|
do_check_false("class" in response.ownProperties.b.value);
|
||||||
|
|
||||||
gThreadClient.resume(function () {
|
gThreadClient.resume(function () {
|
||||||
finishClient(gClient);
|
finishClient(gClient);
|
||||||
|
|
@ -65,8 +66,9 @@ function test_pause_frame()
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/* eslint-disable */
|
||||||
gDebuggee.eval("(" + function () {
|
gDebuggee.eval("(" + function () {
|
||||||
function stopMe(aNumber, aBool, aString, aNull, aUndefined, aObject) {
|
function stopMe(number, bool, string, null_, undef, object) {
|
||||||
var a = 1;
|
var a = 1;
|
||||||
var b = true;
|
var b = true;
|
||||||
var c = { a: "a", b: undefined };
|
var c = { a: "a", b: undefined };
|
||||||
|
|
@ -74,4 +76,5 @@ function test_pause_frame()
|
||||||
}
|
}
|
||||||
stopMe(42, true, "nasu", null, undefined, { foo: "bar" });
|
stopMe(42, true, "nasu", null, undefined, { foo: "bar" });
|
||||||
} + ")()");
|
} + ")()");
|
||||||
|
/* eslint-enable */
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check a frame actor's parent bindings.
|
* Check a frame actor's parent bindings.
|
||||||
*/
|
*/
|
||||||
|
|
@ -9,24 +11,23 @@ var gDebuggee;
|
||||||
var gClient;
|
var gClient;
|
||||||
var gThreadClient;
|
var gThreadClient;
|
||||||
|
|
||||||
function run_test()
|
function run_test() {
|
||||||
{
|
|
||||||
initTestDebuggerServer();
|
initTestDebuggerServer();
|
||||||
gDebuggee = addTestGlobal("test-stack");
|
gDebuggee = addTestGlobal("test-stack");
|
||||||
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
||||||
gClient.connect().then(function () {
|
gClient.connect().then(function () {
|
||||||
attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) {
|
attachTestTabAndResume(gClient, "test-stack",
|
||||||
gThreadClient = aThreadClient;
|
function (response, tabClient, threadClient) {
|
||||||
test_pause_frame();
|
gThreadClient = threadClient;
|
||||||
});
|
test_pause_frame();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_pause_frame()
|
function test_pause_frame() {
|
||||||
{
|
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||||
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
let parentEnv = packet.frame.environment.parent;
|
||||||
let parentEnv = aPacket.frame.environment.parent;
|
|
||||||
let bindings = parentEnv.bindings;
|
let bindings = parentEnv.bindings;
|
||||||
let args = bindings.arguments;
|
let args = bindings.arguments;
|
||||||
let vars = bindings.variables;
|
let vars = bindings.variables;
|
||||||
|
|
@ -40,10 +41,10 @@ function test_pause_frame()
|
||||||
parentEnv = parentEnv.parent.parent;
|
parentEnv = parentEnv.parent.parent;
|
||||||
do_check_neq(parentEnv, undefined);
|
do_check_neq(parentEnv, undefined);
|
||||||
let objClient = gThreadClient.pauseGrip(parentEnv.object);
|
let objClient = gThreadClient.pauseGrip(parentEnv.object);
|
||||||
objClient.getPrototypeAndProperties(function (aResponse) {
|
objClient.getPrototypeAndProperties(function (response) {
|
||||||
do_check_eq(aResponse.ownProperties.Object.value.type, "object");
|
do_check_eq(response.ownProperties.Object.value.type, "object");
|
||||||
do_check_eq(aResponse.ownProperties.Object.value.class, "Function");
|
do_check_eq(response.ownProperties.Object.value.class, "Function");
|
||||||
do_check_true(!!aResponse.ownProperties.Object.value.actor);
|
do_check_true(!!response.ownProperties.Object.value.actor);
|
||||||
|
|
||||||
gThreadClient.resume(function () {
|
gThreadClient.resume(function () {
|
||||||
finishClient(gClient);
|
finishClient(gClient);
|
||||||
|
|
@ -51,8 +52,9 @@ function test_pause_frame()
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/* eslint-disable */
|
||||||
gDebuggee.eval("(" + function () {
|
gDebuggee.eval("(" + function () {
|
||||||
function stopMe(aNumber, aBool, aString, aNull, aUndefined, aObject) {
|
function stopMe(number, bool, string, null_, undef, object) {
|
||||||
var a = 1;
|
var a = 1;
|
||||||
var b = true;
|
var b = true;
|
||||||
var c = { a: "a" };
|
var c = { a: "a" };
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,9 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
|
||||||
|
/* strict mode code may not contain 'with' statements */
|
||||||
|
/* eslint-disable strict */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check a |with| frame actor's bindings.
|
* Check a |with| frame actor's bindings.
|
||||||
*/
|
*/
|
||||||
|
|
@ -9,24 +12,23 @@ var gDebuggee;
|
||||||
var gClient;
|
var gClient;
|
||||||
var gThreadClient;
|
var gThreadClient;
|
||||||
|
|
||||||
function run_test()
|
function run_test() {
|
||||||
{
|
|
||||||
initTestDebuggerServer();
|
initTestDebuggerServer();
|
||||||
gDebuggee = addTestGlobal("test-stack");
|
gDebuggee = addTestGlobal("test-stack");
|
||||||
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
||||||
gClient.connect().then(function () {
|
gClient.connect().then(function () {
|
||||||
attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) {
|
attachTestTabAndResume(gClient, "test-stack",
|
||||||
gThreadClient = aThreadClient;
|
function (response, tabClient, threadClient) {
|
||||||
test_pause_frame();
|
gThreadClient = threadClient;
|
||||||
});
|
test_pause_frame();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_pause_frame()
|
function test_pause_frame() {
|
||||||
{
|
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||||
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
let env = packet.frame.environment;
|
||||||
let env = aPacket.frame.environment;
|
|
||||||
do_check_neq(env, undefined);
|
do_check_neq(env, undefined);
|
||||||
|
|
||||||
let parentEnv = env.parent;
|
let parentEnv = env.parent;
|
||||||
|
|
@ -36,18 +38,18 @@ function test_pause_frame()
|
||||||
let args = bindings.arguments;
|
let args = bindings.arguments;
|
||||||
let vars = bindings.variables;
|
let vars = bindings.variables;
|
||||||
do_check_eq(args.length, 1);
|
do_check_eq(args.length, 1);
|
||||||
do_check_eq(args[0].aNumber.value, 10);
|
do_check_eq(args[0].number.value, 10);
|
||||||
do_check_eq(vars.r.value, 10);
|
do_check_eq(vars.r.value, 10);
|
||||||
do_check_eq(vars.a.value, Math.PI * 100);
|
do_check_eq(vars.a.value, Math.PI * 100);
|
||||||
do_check_eq(vars.arguments.value.class, "Arguments");
|
do_check_eq(vars.arguments.value.class, "Arguments");
|
||||||
do_check_true(!!vars.arguments.value.actor);
|
do_check_true(!!vars.arguments.value.actor);
|
||||||
|
|
||||||
let objClient = gThreadClient.pauseGrip(env.object);
|
let objClient = gThreadClient.pauseGrip(env.object);
|
||||||
objClient.getPrototypeAndProperties(function (aResponse) {
|
objClient.getPrototypeAndProperties(function (response) {
|
||||||
do_check_eq(aResponse.ownProperties.PI.value, Math.PI);
|
do_check_eq(response.ownProperties.PI.value, Math.PI);
|
||||||
do_check_eq(aResponse.ownProperties.cos.value.type, "object");
|
do_check_eq(response.ownProperties.cos.value.type, "object");
|
||||||
do_check_eq(aResponse.ownProperties.cos.value.class, "Function");
|
do_check_eq(response.ownProperties.cos.value.class, "Function");
|
||||||
do_check_true(!!aResponse.ownProperties.cos.value.actor);
|
do_check_true(!!response.ownProperties.cos.value.actor);
|
||||||
|
|
||||||
gThreadClient.resume(function () {
|
gThreadClient.resume(function () {
|
||||||
finishClient(gClient);
|
finishClient(gClient);
|
||||||
|
|
@ -55,10 +57,11 @@ function test_pause_frame()
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/* eslint-disable */
|
||||||
gDebuggee.eval("(" + function () {
|
gDebuggee.eval("(" + function () {
|
||||||
function stopMe(aNumber) {
|
function stopMe(number) {
|
||||||
var a;
|
var a;
|
||||||
var r = aNumber;
|
var r = number;
|
||||||
with (Math) {
|
with (Math) {
|
||||||
a = PI * r * r;
|
a = PI * r * r;
|
||||||
debugger;
|
debugger;
|
||||||
|
|
@ -66,4 +69,5 @@ function test_pause_frame()
|
||||||
}
|
}
|
||||||
stopMe(10);
|
stopMe(10);
|
||||||
} + ")()");
|
} + ")()");
|
||||||
|
/* eslint-enable */
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,49 +1,52 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
/* eslint-disable no-shadow, max-nested-callbacks */
|
||||||
|
|
||||||
|
/* strict mode code may not contain 'with' statements */
|
||||||
|
/* eslint-disable strict */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check the environment bindongs of a |with| within a |with|.
|
* Check the environment bindings of a |with| within a |with|.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var gDebuggee;
|
var gDebuggee;
|
||||||
var gClient;
|
var gClient;
|
||||||
var gThreadClient;
|
var gThreadClient;
|
||||||
|
|
||||||
function run_test()
|
function run_test() {
|
||||||
{
|
|
||||||
initTestDebuggerServer();
|
initTestDebuggerServer();
|
||||||
gDebuggee = addTestGlobal("test-stack");
|
gDebuggee = addTestGlobal("test-stack");
|
||||||
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
||||||
gClient.connect().then(function () {
|
gClient.connect().then(function () {
|
||||||
attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) {
|
attachTestTabAndResume(gClient, "test-stack",
|
||||||
gThreadClient = aThreadClient;
|
function (response, tabClient, threadClient) {
|
||||||
test_pause_frame();
|
gThreadClient = threadClient;
|
||||||
});
|
test_pause_frame();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_pause_frame()
|
function test_pause_frame() {
|
||||||
{
|
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||||
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
let env = packet.frame.environment;
|
||||||
let env = aPacket.frame.environment;
|
|
||||||
do_check_neq(env, undefined);
|
do_check_neq(env, undefined);
|
||||||
|
|
||||||
let objClient = gThreadClient.pauseGrip(env.object);
|
let objClient = gThreadClient.pauseGrip(env.object);
|
||||||
objClient.getPrototypeAndProperties(function (aResponse) {
|
objClient.getPrototypeAndProperties(function (response) {
|
||||||
do_check_eq(aResponse.ownProperties.one.value, 1);
|
do_check_eq(response.ownProperties.one.value, 1);
|
||||||
do_check_eq(aResponse.ownProperties.two.value, 2);
|
do_check_eq(response.ownProperties.two.value, 2);
|
||||||
do_check_eq(aResponse.ownProperties.foo, undefined);
|
do_check_eq(response.ownProperties.foo, undefined);
|
||||||
|
|
||||||
let parentEnv = env.parent;
|
let parentEnv = env.parent;
|
||||||
do_check_neq(parentEnv, undefined);
|
do_check_neq(parentEnv, undefined);
|
||||||
|
|
||||||
let parentClient = gThreadClient.pauseGrip(parentEnv.object);
|
let parentClient = gThreadClient.pauseGrip(parentEnv.object);
|
||||||
parentClient.getPrototypeAndProperties(function (aResponse) {
|
parentClient.getPrototypeAndProperties(function (response) {
|
||||||
do_check_eq(aResponse.ownProperties.PI.value, Math.PI);
|
do_check_eq(response.ownProperties.PI.value, Math.PI);
|
||||||
do_check_eq(aResponse.ownProperties.cos.value.type, "object");
|
do_check_eq(response.ownProperties.cos.value.type, "object");
|
||||||
do_check_eq(aResponse.ownProperties.cos.value.class, "Function");
|
do_check_eq(response.ownProperties.cos.value.class, "Function");
|
||||||
do_check_true(!!aResponse.ownProperties.cos.value.actor);
|
do_check_true(!!response.ownProperties.cos.value.actor);
|
||||||
|
|
||||||
parentEnv = parentEnv.parent;
|
parentEnv = parentEnv.parent;
|
||||||
do_check_neq(parentEnv, undefined);
|
do_check_neq(parentEnv, undefined);
|
||||||
|
|
@ -52,7 +55,7 @@ function test_pause_frame()
|
||||||
let args = bindings.arguments;
|
let args = bindings.arguments;
|
||||||
let vars = bindings.variables;
|
let vars = bindings.variables;
|
||||||
do_check_eq(args.length, 1);
|
do_check_eq(args.length, 1);
|
||||||
do_check_eq(args[0].aNumber.value, 10);
|
do_check_eq(args[0].number.value, 10);
|
||||||
do_check_eq(vars.r.value, 10);
|
do_check_eq(vars.r.value, 10);
|
||||||
do_check_eq(vars.a.value, Math.PI * 100);
|
do_check_eq(vars.a.value, Math.PI * 100);
|
||||||
do_check_eq(vars.arguments.value.class, "Arguments");
|
do_check_eq(vars.arguments.value.class, "Arguments");
|
||||||
|
|
@ -64,13 +67,13 @@ function test_pause_frame()
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/* eslint-disable */
|
||||||
gDebuggee.eval("(" + function () {
|
gDebuggee.eval("(" + function () {
|
||||||
function stopMe(aNumber) {
|
function stopMe(number) {
|
||||||
var a, obj = { one: 1, two: 2 };
|
var a, obj = { one: 1, two: 2 };
|
||||||
var r = aNumber;
|
var r = number;
|
||||||
with (Math) {
|
with (Math) {
|
||||||
a = PI * r * r;
|
a = PI * r * r;
|
||||||
with (obj) {
|
with (obj) {
|
||||||
|
|
@ -81,4 +84,5 @@ function test_pause_frame()
|
||||||
}
|
}
|
||||||
stopMe(10);
|
stopMe(10);
|
||||||
} + ")()");
|
} + ")()");
|
||||||
|
/* eslint-enable */
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
/* eslint-disable no-shadow, max-nested-callbacks */
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check the environment bindings of a |with| in global scope.
|
* Check the environment bindings of a |with| in global scope.
|
||||||
|
|
@ -9,44 +12,43 @@ var gDebuggee;
|
||||||
var gClient;
|
var gClient;
|
||||||
var gThreadClient;
|
var gThreadClient;
|
||||||
|
|
||||||
function run_test()
|
function run_test() {
|
||||||
{
|
|
||||||
initTestDebuggerServer();
|
initTestDebuggerServer();
|
||||||
gDebuggee = addTestGlobal("test-stack");
|
gDebuggee = addTestGlobal("test-stack");
|
||||||
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
||||||
gClient.connect().then(function () {
|
gClient.connect().then(function () {
|
||||||
attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) {
|
attachTestTabAndResume(gClient, "test-stack",
|
||||||
gThreadClient = aThreadClient;
|
function (response, tabClient, threadClient) {
|
||||||
test_pause_frame();
|
gThreadClient = threadClient;
|
||||||
});
|
test_pause_frame();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_pause_frame()
|
function test_pause_frame() {
|
||||||
{
|
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||||
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
let env = packet.frame.environment;
|
||||||
let env = aPacket.frame.environment;
|
|
||||||
do_check_neq(env, undefined);
|
do_check_neq(env, undefined);
|
||||||
|
|
||||||
let objClient = gThreadClient.pauseGrip(env.object);
|
let objClient = gThreadClient.pauseGrip(env.object);
|
||||||
objClient.getPrototypeAndProperties(function (aResponse) {
|
objClient.getPrototypeAndProperties(function (response) {
|
||||||
do_check_eq(aResponse.ownProperties.PI.value, Math.PI);
|
do_check_eq(response.ownProperties.PI.value, Math.PI);
|
||||||
do_check_eq(aResponse.ownProperties.cos.value.type, "object");
|
do_check_eq(response.ownProperties.cos.value.type, "object");
|
||||||
do_check_eq(aResponse.ownProperties.cos.value.class, "Function");
|
do_check_eq(response.ownProperties.cos.value.class, "Function");
|
||||||
do_check_true(!!aResponse.ownProperties.cos.value.actor);
|
do_check_true(!!response.ownProperties.cos.value.actor);
|
||||||
|
|
||||||
// Skip the global lexical scope.
|
// Skip the global lexical scope.
|
||||||
let parentEnv = env.parent.parent;
|
let parentEnv = env.parent.parent;
|
||||||
do_check_neq(parentEnv, undefined);
|
do_check_neq(parentEnv, undefined);
|
||||||
|
|
||||||
let parentClient = gThreadClient.pauseGrip(parentEnv.object);
|
let parentClient = gThreadClient.pauseGrip(parentEnv.object);
|
||||||
parentClient.getPrototypeAndProperties(function (aResponse) {
|
parentClient.getPrototypeAndProperties(function (response) {
|
||||||
do_check_eq(aResponse.ownProperties.a.value, Math.PI * 100);
|
do_check_eq(response.ownProperties.a.value, Math.PI * 100);
|
||||||
do_check_eq(aResponse.ownProperties.r.value, 10);
|
do_check_eq(response.ownProperties.r.value, 10);
|
||||||
do_check_eq(aResponse.ownProperties.Object.value.type, "object");
|
do_check_eq(response.ownProperties.Object.value.type, "object");
|
||||||
do_check_eq(aResponse.ownProperties.Object.value.class, "Function");
|
do_check_eq(response.ownProperties.Object.value.class, "Function");
|
||||||
do_check_true(!!aResponse.ownProperties.Object.value.actor);
|
do_check_true(!!response.ownProperties.Object.value.actor);
|
||||||
|
|
||||||
gThreadClient.resume(function () {
|
gThreadClient.resume(function () {
|
||||||
finishClient(gClient);
|
finishClient(gClient);
|
||||||
|
|
|
||||||
|
|
@ -1,32 +1,32 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
var gDebuggee;
|
var gDebuggee;
|
||||||
var gClient;
|
var gClient;
|
||||||
var gThreadClient;
|
var gThreadClient;
|
||||||
|
|
||||||
function run_test()
|
function run_test() {
|
||||||
{
|
|
||||||
initTestDebuggerServer();
|
initTestDebuggerServer();
|
||||||
gDebuggee = addTestGlobal("test-grips");
|
gDebuggee = addTestGlobal("test-grips");
|
||||||
|
|
||||||
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
||||||
gClient.connect().then(function () {
|
gClient.connect().then(function () {
|
||||||
attachTestTabAndResume(gClient, "test-grips", function (aResponse, aTabClient, aThreadClient) {
|
attachTestTabAndResume(gClient, "test-grips",
|
||||||
gThreadClient = aThreadClient;
|
function (response, tabClient, threadClient) {
|
||||||
test_banana_environment();
|
gThreadClient = threadClient;
|
||||||
});
|
test_banana_environment();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_banana_environment()
|
function test_banana_environment() {
|
||||||
{
|
|
||||||
|
|
||||||
gThreadClient.addOneTimeListener("paused",
|
gThreadClient.addOneTimeListener("paused",
|
||||||
function (aEvent, aPacket) {
|
function (event, packet) {
|
||||||
equal(aPacket.type, "paused");
|
equal(packet.type, "paused");
|
||||||
let env = aPacket.frame.environment;
|
let env = packet.frame.environment;
|
||||||
equal(env.type, "function");
|
equal(env.type, "function");
|
||||||
equal(env.function.name, "banana3");
|
equal(env.function.name, "banana3");
|
||||||
let parent = env.parent;
|
let parent = env.parent;
|
||||||
|
|
@ -47,14 +47,12 @@ function test_banana_environment()
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
gDebuggee.eval("\
|
gDebuggee.eval("function banana(x) {\n" +
|
||||||
function banana(x) { \n\
|
" return function banana2(y) {\n" +
|
||||||
return function banana2(y) { \n\
|
" return function banana3(z) {\n" +
|
||||||
return function banana3(z) { \n\
|
" debugger;\n" +
|
||||||
debugger; \n\
|
" };\n" +
|
||||||
}; \n\
|
" };\n" +
|
||||||
}; \n\
|
"}\n" +
|
||||||
} \n\
|
"banana('x')('y')('z');\n");
|
||||||
banana('x')('y')('z'); \n\
|
|
||||||
");
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,31 +1,32 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
/* eslint-disable no-shadow, max-nested-callbacks */
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
var gDebuggee;
|
var gDebuggee;
|
||||||
var gClient;
|
var gClient;
|
||||||
var gThreadClient;
|
var gThreadClient;
|
||||||
|
|
||||||
// Test that the EnvironmentClient's getBindings() method works as expected.
|
// Test that the EnvironmentClient's getBindings() method works as expected.
|
||||||
function run_test()
|
function run_test() {
|
||||||
{
|
|
||||||
initTestDebuggerServer();
|
initTestDebuggerServer();
|
||||||
gDebuggee = addTestGlobal("test-bindings");
|
gDebuggee = addTestGlobal("test-bindings");
|
||||||
|
|
||||||
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
||||||
gClient.connect().then(function () {
|
gClient.connect().then(function () {
|
||||||
attachTestTabAndResume(gClient, "test-bindings", function (aResponse, aTabClient, aThreadClient) {
|
attachTestTabAndResume(gClient, "test-bindings",
|
||||||
gThreadClient = aThreadClient;
|
function (response, tabClient, threadClient) {
|
||||||
test_banana_environment();
|
gThreadClient = threadClient;
|
||||||
});
|
test_banana_environment();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_banana_environment()
|
function test_banana_environment() {
|
||||||
{
|
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||||
|
let environment = packet.frame.environment;
|
||||||
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
|
||||||
let environment = aPacket.frame.environment;
|
|
||||||
do_check_eq(environment.type, "function");
|
do_check_eq(environment.type, "function");
|
||||||
|
|
||||||
let parent = environment.parent;
|
let parent = environment.parent;
|
||||||
|
|
@ -35,30 +36,28 @@ function test_banana_environment()
|
||||||
do_check_eq(grandpa.type, "function");
|
do_check_eq(grandpa.type, "function");
|
||||||
|
|
||||||
let envClient = gThreadClient.environment(environment);
|
let envClient = gThreadClient.environment(environment);
|
||||||
envClient.getBindings(aResponse => {
|
envClient.getBindings(response => {
|
||||||
do_check_eq(aResponse.bindings.arguments[0].z.value, "z");
|
do_check_eq(response.bindings.arguments[0].z.value, "z");
|
||||||
|
|
||||||
let parentClient = gThreadClient.environment(parent);
|
let parentClient = gThreadClient.environment(parent);
|
||||||
parentClient.getBindings(aResponse => {
|
parentClient.getBindings(response => {
|
||||||
do_check_eq(aResponse.bindings.variables.banana3.value.class, "Function");
|
do_check_eq(response.bindings.variables.banana3.value.class, "Function");
|
||||||
|
|
||||||
let grandpaClient = gThreadClient.environment(grandpa);
|
let grandpaClient = gThreadClient.environment(grandpa);
|
||||||
grandpaClient.getBindings(aResponse => {
|
grandpaClient.getBindings(response => {
|
||||||
do_check_eq(aResponse.bindings.arguments[0].y.value, "y");
|
do_check_eq(response.bindings.arguments[0].y.value, "y");
|
||||||
gThreadClient.resume(() => finishClient(gClient));
|
gThreadClient.resume(() => finishClient(gClient));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
gDebuggee.eval("\
|
gDebuggee.eval("function banana(x) {\n" +
|
||||||
function banana(x) { \n\
|
" return function banana2(y) {\n" +
|
||||||
return function banana2(y) { \n\
|
" return function banana3(z) {\n" +
|
||||||
return function banana3(z) { \n\
|
" debugger;\n" +
|
||||||
debugger; \n\
|
" };\n" +
|
||||||
}; \n\
|
" };\n" +
|
||||||
}; \n\
|
"}\n" +
|
||||||
} \n\
|
"banana('x')('y')('z');\n");
|
||||||
banana('x')('y')('z'); \n\
|
|
||||||
");
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,27 +1,29 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
/* eslint-disable max-nested-callbacks */
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
var gDebuggee;
|
var gDebuggee;
|
||||||
var gClient;
|
var gClient;
|
||||||
var gThreadClient;
|
var gThreadClient;
|
||||||
|
|
||||||
function run_test()
|
function run_test() {
|
||||||
{
|
|
||||||
initTestDebuggerServer();
|
initTestDebuggerServer();
|
||||||
gDebuggee = addTestGlobal("test-stack");
|
gDebuggee = addTestGlobal("test-stack");
|
||||||
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
||||||
gClient.connect().then(function () {
|
gClient.connect().then(function () {
|
||||||
attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) {
|
attachTestTabAndResume(gClient, "test-stack",
|
||||||
gThreadClient = aThreadClient;
|
function (response, tabClient, threadClient) {
|
||||||
test_pause_frame();
|
gThreadClient = threadClient;
|
||||||
});
|
test_pause_frame();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_pause_frame()
|
function test_pause_frame() {
|
||||||
{
|
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||||
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
|
||||||
gThreadClient.addOneTimeListener("framesadded", function () {
|
gThreadClient.addOneTimeListener("framesadded", function () {
|
||||||
do_check_eq(gThreadClient.cachedFrames.length, 3);
|
do_check_eq(gThreadClient.cachedFrames.length, 3);
|
||||||
do_check_true(gThreadClient.moreFrames);
|
do_check_true(gThreadClient.moreFrames);
|
||||||
|
|
@ -39,6 +41,7 @@ function test_pause_frame()
|
||||||
do_check_true(gThreadClient.fillFrames(3));
|
do_check_true(gThreadClient.fillFrames(3));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/* eslint-disable */
|
||||||
gDebuggee.eval("(" + function () {
|
gDebuggee.eval("(" + function () {
|
||||||
var recurseLeft = 5;
|
var recurseLeft = 5;
|
||||||
function recurse() {
|
function recurse() {
|
||||||
|
|
@ -50,4 +53,5 @@ function test_pause_frame()
|
||||||
}
|
}
|
||||||
recurse();
|
recurse();
|
||||||
} + ")()");
|
} + ")()");
|
||||||
|
/* eslint-enable */
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,27 +1,28 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
var gDebuggee;
|
var gDebuggee;
|
||||||
var gClient;
|
var gClient;
|
||||||
var gThreadClient;
|
var gThreadClient;
|
||||||
|
|
||||||
function run_test()
|
function run_test() {
|
||||||
{
|
|
||||||
initTestDebuggerServer();
|
initTestDebuggerServer();
|
||||||
gDebuggee = addTestGlobal("test-stack");
|
gDebuggee = addTestGlobal("test-stack");
|
||||||
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
||||||
gClient.connect().then(function () {
|
gClient.connect().then(function () {
|
||||||
attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) {
|
attachTestTabAndResume(gClient, "test-stack",
|
||||||
gThreadClient = aThreadClient;
|
function (response, tabClient, threadClient) {
|
||||||
test_pause_frame();
|
gThreadClient = threadClient;
|
||||||
});
|
test_pause_frame();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_pause_frame()
|
function test_pause_frame() {
|
||||||
{
|
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||||
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
|
||||||
// Ask for exactly the number of frames we expect.
|
// Ask for exactly the number of frames we expect.
|
||||||
gThreadClient.addOneTimeListener("framesadded", function () {
|
gThreadClient.addOneTimeListener("framesadded", function () {
|
||||||
do_check_false(gThreadClient.moreFrames);
|
do_check_false(gThreadClient.moreFrames);
|
||||||
|
|
@ -32,6 +33,7 @@ function test_pause_frame()
|
||||||
do_check_true(gThreadClient.fillFrames(3));
|
do_check_true(gThreadClient.fillFrames(3));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/* eslint-disable */
|
||||||
gDebuggee.eval("(" + function () {
|
gDebuggee.eval("(" + function () {
|
||||||
var recurseLeft = 1;
|
var recurseLeft = 1;
|
||||||
function recurse() {
|
function recurse() {
|
||||||
|
|
@ -43,4 +45,5 @@ function test_pause_frame()
|
||||||
}
|
}
|
||||||
recurse();
|
recurse();
|
||||||
} + ")()");
|
} + ")()");
|
||||||
|
/* eslint-enable */
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,13 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
var gDebuggee;
|
var gDebuggee;
|
||||||
var gClient;
|
var gClient;
|
||||||
var gThreadClient;
|
var gThreadClient;
|
||||||
|
|
||||||
function run_test()
|
function run_test() {
|
||||||
{
|
|
||||||
initTestDebuggerServer();
|
initTestDebuggerServer();
|
||||||
gDebuggee = addTestGlobal("test-grips");
|
gDebuggee = addTestGlobal("test-grips");
|
||||||
gDebuggee.eval(function stopMe(arg1) {
|
gDebuggee.eval(function stopMe(arg1) {
|
||||||
|
|
@ -15,39 +16,38 @@ function run_test()
|
||||||
|
|
||||||
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
||||||
gClient.connect().then(function () {
|
gClient.connect().then(function () {
|
||||||
attachTestTabAndResume(gClient, "test-grips", function (aResponse, aTabClient, aThreadClient) {
|
attachTestTabAndResume(gClient, "test-grips",
|
||||||
gThreadClient = aThreadClient;
|
function (response, tabClient, threadClient) {
|
||||||
test_named_function();
|
gThreadClient = threadClient;
|
||||||
});
|
test_named_function();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_named_function()
|
function test_named_function() {
|
||||||
{
|
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||||
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
let args = packet.frame.arguments;
|
||||||
let args = aPacket.frame.arguments;
|
|
||||||
|
|
||||||
do_check_eq(args[0].class, "Function");
|
do_check_eq(args[0].class, "Function");
|
||||||
do_check_eq(args[0].name, "stopMe");
|
do_check_eq(args[0].name, "stopMe");
|
||||||
do_check_eq(args[0].displayName, "stopMe");
|
do_check_eq(args[0].displayName, "stopMe");
|
||||||
|
|
||||||
let objClient = gThreadClient.pauseGrip(args[0]);
|
let objClient = gThreadClient.pauseGrip(args[0]);
|
||||||
objClient.getParameterNames(function (aResponse) {
|
objClient.getParameterNames(function (response) {
|
||||||
do_check_eq(aResponse.parameterNames.length, 1);
|
do_check_eq(response.parameterNames.length, 1);
|
||||||
do_check_eq(aResponse.parameterNames[0], "arg1");
|
do_check_eq(response.parameterNames[0], "arg1");
|
||||||
|
|
||||||
gThreadClient.resume(test_inferred_name_function);
|
gThreadClient.resume(test_inferred_name_function);
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
gDebuggee.eval("stopMe(stopMe)");
|
gDebuggee.eval("stopMe(stopMe)");
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_inferred_name_function() {
|
function test_inferred_name_function() {
|
||||||
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||||
let args = aPacket.frame.arguments;
|
let args = packet.frame.arguments;
|
||||||
|
|
||||||
do_check_eq(args[0].class, "Function");
|
do_check_eq(args[0].class, "Function");
|
||||||
// No name for an anonymous function, but it should have an inferred name.
|
// No name for an anonymous function, but it should have an inferred name.
|
||||||
|
|
@ -55,11 +55,11 @@ function test_inferred_name_function() {
|
||||||
do_check_eq(args[0].displayName, "m");
|
do_check_eq(args[0].displayName, "m");
|
||||||
|
|
||||||
let objClient = gThreadClient.pauseGrip(args[0]);
|
let objClient = gThreadClient.pauseGrip(args[0]);
|
||||||
objClient.getParameterNames(function (aResponse) {
|
objClient.getParameterNames(function (response) {
|
||||||
do_check_eq(aResponse.parameterNames.length, 3);
|
do_check_eq(response.parameterNames.length, 3);
|
||||||
do_check_eq(aResponse.parameterNames[0], "foo");
|
do_check_eq(response.parameterNames[0], "foo");
|
||||||
do_check_eq(aResponse.parameterNames[1], "bar");
|
do_check_eq(response.parameterNames[1], "bar");
|
||||||
do_check_eq(aResponse.parameterNames[2], "baz");
|
do_check_eq(response.parameterNames[2], "baz");
|
||||||
|
|
||||||
gThreadClient.resume(test_anonymous_function);
|
gThreadClient.resume(test_anonymous_function);
|
||||||
});
|
});
|
||||||
|
|
@ -69,8 +69,8 @@ function test_inferred_name_function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_anonymous_function() {
|
function test_anonymous_function() {
|
||||||
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||||
let args = aPacket.frame.arguments;
|
let args = packet.frame.arguments;
|
||||||
|
|
||||||
do_check_eq(args[0].class, "Function");
|
do_check_eq(args[0].class, "Function");
|
||||||
// No name for an anonymous function, and no inferred name, either.
|
// No name for an anonymous function, and no inferred name, either.
|
||||||
|
|
@ -78,11 +78,11 @@ function test_anonymous_function() {
|
||||||
do_check_eq(args[0].displayName, undefined);
|
do_check_eq(args[0].displayName, undefined);
|
||||||
|
|
||||||
let objClient = gThreadClient.pauseGrip(args[0]);
|
let objClient = gThreadClient.pauseGrip(args[0]);
|
||||||
objClient.getParameterNames(function (aResponse) {
|
objClient.getParameterNames(function (response) {
|
||||||
do_check_eq(aResponse.parameterNames.length, 3);
|
do_check_eq(response.parameterNames.length, 3);
|
||||||
do_check_eq(aResponse.parameterNames[0], "foo");
|
do_check_eq(response.parameterNames[0], "foo");
|
||||||
do_check_eq(aResponse.parameterNames[1], "bar");
|
do_check_eq(response.parameterNames[1], "bar");
|
||||||
do_check_eq(aResponse.parameterNames[2], "baz");
|
do_check_eq(response.parameterNames[2], "baz");
|
||||||
|
|
||||||
gThreadClient.resume(function () {
|
gThreadClient.resume(function () {
|
||||||
finishClient(gClient);
|
finishClient(gClient);
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,8 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test if getExecutableLines return correct information
|
* Test if getExecutableLines return correct information
|
||||||
*/
|
*/
|
||||||
|
|
@ -20,8 +22,8 @@ function run_test() {
|
||||||
attachTestTabAndResume(
|
attachTestTabAndResume(
|
||||||
gClient,
|
gClient,
|
||||||
"test-get-executable-lines",
|
"test-get-executable-lines",
|
||||||
function (aResponse, aTabClient, aThreadClient) {
|
function (response, tabClient, threadClient) {
|
||||||
gThreadClient = aThreadClient;
|
gThreadClient = threadClient;
|
||||||
test_executable_lines();
|
test_executable_lines();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,8 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test if getExecutableLines return correct information
|
* Test if getExecutableLines return correct information
|
||||||
*/
|
*/
|
||||||
|
|
@ -20,8 +22,8 @@ function run_test() {
|
||||||
attachTestTabAndResume(
|
attachTestTabAndResume(
|
||||||
gClient,
|
gClient,
|
||||||
"test-get-executable-lines",
|
"test-get-executable-lines",
|
||||||
function (aResponse, aTabClient, aThreadClient) {
|
function (response, tabClient, threadClient) {
|
||||||
gThreadClient = aThreadClient;
|
gThreadClient = threadClient;
|
||||||
test_executable_lines();
|
test_executable_lines();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,8 @@ const TEST_DATA = [
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
desc: "Multiple rules test case",
|
desc: "Multiple rules test case",
|
||||||
input: "#id{color:red;background:yellow;}.class-one .class-two { position:absolute; line-height: 45px}",
|
input: "#id{color:red;background:yellow;}.class-one .class-two " +
|
||||||
|
"{ position:absolute; line-height: 45px}",
|
||||||
line: 1,
|
line: 1,
|
||||||
column: 34,
|
column: 34,
|
||||||
expected: {offset: 56, text: " position:absolute; line-height: 45px"}
|
expected: {offset: 56, text: " position:absolute; line-height: 45px"}
|
||||||
|
|
|
||||||
|
|
@ -1,22 +1,22 @@
|
||||||
function run_test()
|
/* eslint-disable strict */
|
||||||
{
|
function run_test() {
|
||||||
Components.utils.import("resource://gre/modules/jsdebugger.jsm");
|
Components.utils.import("resource://gre/modules/jsdebugger.jsm");
|
||||||
addDebuggerToGlobal(this);
|
addDebuggerToGlobal(this);
|
||||||
var xpcInspector = Cc["@mozilla.org/jsinspector;1"].getService(Ci.nsIJSInspector);
|
let xpcInspector = Cc["@mozilla.org/jsinspector;1"].getService(Ci.nsIJSInspector);
|
||||||
var g = testGlobal("test1");
|
let g = testGlobal("test1");
|
||||||
|
|
||||||
var dbg = new Debugger();
|
let dbg = new Debugger();
|
||||||
dbg.uncaughtExceptionHook = testExceptionHook;
|
dbg.uncaughtExceptionHook = testExceptionHook;
|
||||||
|
|
||||||
dbg.addDebuggee(g);
|
dbg.addDebuggee(g);
|
||||||
dbg.onDebuggerStatement = function (aFrame) {
|
dbg.onDebuggerStatement = function (frame) {
|
||||||
do_check_true(aFrame === dbg.getNewestFrame());
|
do_check_true(frame === dbg.getNewestFrame());
|
||||||
// Execute from the nested event loop, dbg.getNewestFrame() won't
|
// Execute from the nested event loop, dbg.getNewestFrame() won't
|
||||||
// be working anymore.
|
// be working anymore.
|
||||||
|
|
||||||
do_execute_soon(function () {
|
do_execute_soon(function () {
|
||||||
try {
|
try {
|
||||||
do_check_true(aFrame === dbg.getNewestFrame());
|
do_check_true(frame === dbg.getNewestFrame());
|
||||||
} finally {
|
} finally {
|
||||||
xpcInspector.exitNestedEventLoop("test");
|
xpcInspector.exitNestedEventLoop("test");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
/* eslint-disable no-shadow */
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test that setting ignoreCaughtExceptions will cause the debugger to ignore
|
* Test that setting ignoreCaughtExceptions will cause the debugger to ignore
|
||||||
|
|
@ -10,26 +13,25 @@ var gDebuggee;
|
||||||
var gClient;
|
var gClient;
|
||||||
var gThreadClient;
|
var gThreadClient;
|
||||||
|
|
||||||
function run_test()
|
function run_test() {
|
||||||
{
|
|
||||||
initTestDebuggerServer();
|
initTestDebuggerServer();
|
||||||
gDebuggee = addTestGlobal("test-stack");
|
gDebuggee = addTestGlobal("test-stack");
|
||||||
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
||||||
gClient.connect().then(function () {
|
gClient.connect().then(function () {
|
||||||
attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) {
|
attachTestTabAndResume(gClient, "test-stack",
|
||||||
gThreadClient = aThreadClient;
|
function (response, tabClient, threadClient) {
|
||||||
test_pause_frame();
|
gThreadClient = threadClient;
|
||||||
});
|
test_pause_frame();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_pause_frame()
|
function test_pause_frame() {
|
||||||
{
|
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||||
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||||
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
do_check_eq(packet.why.type, "exception");
|
||||||
do_check_eq(aPacket.why.type, "exception");
|
do_check_eq(packet.why.exception, "bar");
|
||||||
do_check_eq(aPacket.why.exception, "bar");
|
|
||||||
gThreadClient.resume(function () {
|
gThreadClient.resume(function () {
|
||||||
finishClient(gClient);
|
finishClient(gClient);
|
||||||
});
|
});
|
||||||
|
|
@ -39,6 +41,7 @@ function test_pause_frame()
|
||||||
});
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
/* eslint-disable */
|
||||||
gDebuggee.eval("(" + function () {
|
gDebuggee.eval("(" + function () {
|
||||||
debugger;
|
debugger;
|
||||||
try {
|
try {
|
||||||
|
|
@ -46,5 +49,8 @@ function test_pause_frame()
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
throw "bar";
|
throw "bar";
|
||||||
} + ")()");
|
} + ")()");
|
||||||
} catch (e) {}
|
/* eslint-enable */
|
||||||
|
} catch (e) {
|
||||||
|
/* Empty */
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,41 +1,42 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test that the debugger automatically ignores NS_ERROR_NO_INTERFACE
|
* Test that the debugger automatically ignores NS_ERROR_NO_INTERFACE
|
||||||
* exceptions, but not normal ones.
|
* exceptions, but not normal ones.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
var gDebuggee;
|
var gDebuggee;
|
||||||
var gClient;
|
var gClient;
|
||||||
var gThreadClient;
|
var gThreadClient;
|
||||||
|
|
||||||
function run_test()
|
function run_test() {
|
||||||
{
|
|
||||||
initTestDebuggerServer();
|
initTestDebuggerServer();
|
||||||
gDebuggee = addTestGlobal("test-no-interface");
|
gDebuggee = addTestGlobal("test-no-interface");
|
||||||
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
||||||
gClient.connect().then(function () {
|
gClient.connect().then(function () {
|
||||||
attachTestTabAndResume(gClient, "test-no-interface", function (aResponse, aTabClient, aThreadClient) {
|
attachTestTabAndResume(gClient, "test-no-interface",
|
||||||
gThreadClient = aThreadClient;
|
function (response, tabClient, threadClient) {
|
||||||
test_pause_frame();
|
gThreadClient = threadClient;
|
||||||
});
|
test_pause_frame();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_pause_frame()
|
function test_pause_frame() {
|
||||||
{
|
|
||||||
gThreadClient.pauseOnExceptions(true, false, function () {
|
gThreadClient.pauseOnExceptions(true, false, function () {
|
||||||
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||||
do_check_eq(aPacket.why.type, "exception");
|
do_check_eq(packet.why.type, "exception");
|
||||||
do_check_eq(aPacket.why.exception, 42);
|
do_check_eq(packet.why.exception, 42);
|
||||||
gThreadClient.resume(function () {
|
gThreadClient.resume(function () {
|
||||||
finishClient(gClient);
|
finishClient(gClient);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/* eslint-disable */
|
||||||
gDebuggee.eval("(" + function () {
|
gDebuggee.eval("(" + function () {
|
||||||
function QueryInterface() {
|
function QueryInterface() {
|
||||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||||
|
|
@ -50,5 +51,6 @@ function test_pause_frame()
|
||||||
stopMe();
|
stopMe();
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
} + ")()");
|
} + ")()");
|
||||||
|
/* eslint-enable */
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,48 +1,47 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
/* eslint-disable no-shadow */
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
var gClient;
|
var gClient;
|
||||||
var gDebuggee;
|
var gDebuggee;
|
||||||
|
|
||||||
function run_test()
|
function run_test() {
|
||||||
{
|
|
||||||
initTestDebuggerServer();
|
initTestDebuggerServer();
|
||||||
gDebuggee = testGlobal("test-1");
|
gDebuggee = testGlobal("test-1");
|
||||||
DebuggerServer.addTestGlobal(gDebuggee);
|
DebuggerServer.addTestGlobal(gDebuggee);
|
||||||
|
|
||||||
let transport = DebuggerServer.connectPipe();
|
let transport = DebuggerServer.connectPipe();
|
||||||
gClient = new DebuggerClient(transport);
|
gClient = new DebuggerClient(transport);
|
||||||
gClient.connect().then(function (aType, aTraits) {
|
gClient.connect().then(function (type, traits) {
|
||||||
attachTestTab(gClient, "test-1", test_attach);
|
attachTestTab(gClient, "test-1", test_attach);
|
||||||
});
|
});
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_attach(aResponse, aTabClient)
|
function test_attach(response, tabClient) {
|
||||||
{
|
tabClient.attachThread({}, function (response, threadClient) {
|
||||||
aTabClient.attachThread({}, function (aResponse, aThreadClient) {
|
do_check_eq(threadClient.paused, true);
|
||||||
do_check_eq(aThreadClient.paused, true);
|
threadClient.resume(function () {
|
||||||
aThreadClient.resume(function () {
|
test_interrupt(threadClient);
|
||||||
test_interrupt(aThreadClient);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_interrupt(aThreadClient)
|
function test_interrupt(threadClient) {
|
||||||
{
|
do_check_eq(threadClient.paused, false);
|
||||||
do_check_eq(aThreadClient.paused, false);
|
threadClient.interrupt(function (response) {
|
||||||
aThreadClient.interrupt(function (aResponse) {
|
do_check_eq(threadClient.paused, true);
|
||||||
do_check_eq(aThreadClient.paused, true);
|
threadClient.resume(function () {
|
||||||
aThreadClient.resume(function () {
|
do_check_eq(threadClient.paused, false);
|
||||||
do_check_eq(aThreadClient.paused, false);
|
|
||||||
cleanup();
|
cleanup();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function cleanup()
|
function cleanup() {
|
||||||
{
|
gClient.addListener("closed", function (event) {
|
||||||
gClient.addListener("closed", function (aEvent) {
|
|
||||||
do_test_finished();
|
do_test_finished();
|
||||||
});
|
});
|
||||||
gClient.close();
|
gClient.close();
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
// Test the LayoutChangesObserver
|
// Test the LayoutChangesObserver
|
||||||
|
|
||||||
var {
|
var {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check basic getSources functionality.
|
* Check basic getSources functionality.
|
||||||
*/
|
*/
|
||||||
|
|
@ -11,33 +13,32 @@ var gThreadClient;
|
||||||
|
|
||||||
var gNumTimesSourcesSent = 0;
|
var gNumTimesSourcesSent = 0;
|
||||||
|
|
||||||
function run_test()
|
function run_test() {
|
||||||
{
|
|
||||||
initTestDebuggerServer();
|
initTestDebuggerServer();
|
||||||
gDebuggee = addTestGlobal("test-stack");
|
gDebuggee = addTestGlobal("test-stack");
|
||||||
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
||||||
gClient.request = (function (request) {
|
gClient.request = (function (origRequest) {
|
||||||
return function (aRequest, aOnResponse) {
|
return function (request, onResponse) {
|
||||||
if (aRequest.type === "sources") {
|
if (request.type === "sources") {
|
||||||
++gNumTimesSourcesSent;
|
++gNumTimesSourcesSent;
|
||||||
}
|
}
|
||||||
return request.call(this, aRequest, aOnResponse);
|
return origRequest.call(this, request, onResponse);
|
||||||
};
|
};
|
||||||
}(gClient.request));
|
}(gClient.request));
|
||||||
gClient.connect().then(function () {
|
gClient.connect().then(function () {
|
||||||
attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) {
|
attachTestTabAndResume(gClient, "test-stack",
|
||||||
gThreadClient = aThreadClient;
|
function (response, tabClient, threadClient) {
|
||||||
test_simple_listsources();
|
gThreadClient = threadClient;
|
||||||
});
|
test_simple_listsources();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_simple_listsources()
|
function test_simple_listsources() {
|
||||||
{
|
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||||
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
gThreadClient.getSources(function (response) {
|
||||||
gThreadClient.getSources(function (aResponse) {
|
do_check_true(response.sources.some(function (s) {
|
||||||
do_check_true(aResponse.sources.some(function (s) {
|
|
||||||
return s.url && s.url.match(/test_listsources-01.js/);
|
return s.url && s.url.match(/test_listsources-01.js/);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
@ -51,9 +52,11 @@ function test_simple_listsources()
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/* eslint-disable */
|
||||||
Components.utils.evalInSandbox("var line0 = Error().lineNumber;\n" +
|
Components.utils.evalInSandbox("var line0 = Error().lineNumber;\n" +
|
||||||
"debugger;\n" + // line0 + 1
|
"debugger;\n" + // line0 + 1
|
||||||
"var a = 1;\n" + // line0 + 2
|
"var a = 1;\n" + // line0 + 2
|
||||||
"var b = 2;\n", // line0 + 3
|
"var b = 2;\n", // line0 + 3
|
||||||
gDebuggee);
|
gDebuggee);
|
||||||
|
/* eslint-enable */
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,44 +1,44 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check getting sources before there are any.
|
* Check getting sources before there are any.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var gDebuggee;
|
|
||||||
var gClient;
|
var gClient;
|
||||||
var gThreadClient;
|
var gThreadClient;
|
||||||
|
|
||||||
var gNumTimesSourcesSent = 0;
|
var gNumTimesSourcesSent = 0;
|
||||||
|
|
||||||
function run_test()
|
function run_test() {
|
||||||
{
|
|
||||||
initTestDebuggerServer();
|
initTestDebuggerServer();
|
||||||
gDebuggee = addTestGlobal("test-stack");
|
addTestGlobal("test-stack");
|
||||||
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
||||||
gClient.request = (function (request) {
|
gClient.request = (function (origRequest) {
|
||||||
return function (aRequest, aOnResponse) {
|
return function (request, onResponse) {
|
||||||
if (aRequest.type === "sources") {
|
if (request.type === "sources") {
|
||||||
++gNumTimesSourcesSent;
|
++gNumTimesSourcesSent;
|
||||||
}
|
}
|
||||||
return request.call(this, aRequest, aOnResponse);
|
return origRequest.call(this, request, onResponse);
|
||||||
};
|
};
|
||||||
}(gClient.request));
|
}(gClient.request));
|
||||||
gClient.connect().then(function () {
|
gClient.connect().then(function () {
|
||||||
attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) {
|
attachTestTabAndResume(gClient, "test-stack",
|
||||||
gThreadClient = aThreadClient;
|
function (response, tabClient, threadClient) {
|
||||||
test_listing_zero_sources();
|
gThreadClient = threadClient;
|
||||||
});
|
test_listing_zero_sources();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_listing_zero_sources()
|
function test_listing_zero_sources() {
|
||||||
{
|
gThreadClient.getSources(function (packet) {
|
||||||
gThreadClient.getSources(function (aPacket) {
|
do_check_true(!packet.error);
|
||||||
do_check_true(!aPacket.error);
|
do_check_true(!!packet.sources);
|
||||||
do_check_true(!!aPacket.sources);
|
do_check_eq(packet.sources.length, 0);
|
||||||
do_check_eq(aPacket.sources.length, 0);
|
|
||||||
|
|
||||||
do_check_true(gNumTimesSourcesSent <= 1,
|
do_check_true(gNumTimesSourcesSent <= 1,
|
||||||
"Should only send one sources request at most, even though we"
|
"Should only send one sources request at most, even though we"
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check getSources functionality when there are lots of sources.
|
* Check getSources functionality when there are lots of sources.
|
||||||
*/
|
*/
|
||||||
|
|
@ -9,29 +11,28 @@ var gDebuggee;
|
||||||
var gClient;
|
var gClient;
|
||||||
var gThreadClient;
|
var gThreadClient;
|
||||||
|
|
||||||
function run_test()
|
function run_test() {
|
||||||
{
|
|
||||||
initTestDebuggerServer();
|
initTestDebuggerServer();
|
||||||
gDebuggee = addTestGlobal("test-sources");
|
gDebuggee = addTestGlobal("test-sources");
|
||||||
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
||||||
gClient.connect().then(function () {
|
gClient.connect().then(function () {
|
||||||
attachTestTabAndResume(gClient, "test-sources", function (aResponse, aTabClient, aThreadClient) {
|
attachTestTabAndResume(gClient, "test-sources",
|
||||||
gThreadClient = aThreadClient;
|
function (response, tabClient, threadClient) {
|
||||||
test_simple_listsources();
|
gThreadClient = threadClient;
|
||||||
});
|
test_simple_listsources();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_simple_listsources()
|
function test_simple_listsources() {
|
||||||
{
|
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||||
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
gThreadClient.getSources(function (response) {
|
||||||
gThreadClient.getSources(function (aResponse) {
|
|
||||||
do_check_true(
|
do_check_true(
|
||||||
!aResponse.error,
|
!response.error,
|
||||||
"There shouldn't be an error fetching large amounts of sources.");
|
"There shouldn't be an error fetching large amounts of sources.");
|
||||||
|
|
||||||
do_check_true(aResponse.sources.some(function (s) {
|
do_check_true(response.sources.some(function (s) {
|
||||||
return s.url.match(/foo-999.js$/);
|
return s.url.match(/foo-999.js$/);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
/* eslint-disable no-shadow */
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check getSources functionality with sourcemaps.
|
* Check getSources functionality with sourcemaps.
|
||||||
|
|
@ -18,12 +21,12 @@ function run_test() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function run_test_with_server(server, cb) {
|
function run_test_with_server(server, cb) {
|
||||||
Task.spawn(function*() {
|
Task.spawn(function* () {
|
||||||
initTestDebuggerServer(server);
|
initTestDebuggerServer(server);
|
||||||
const debuggee = addTestGlobal("test-sources", server);
|
const debuggee = addTestGlobal("test-sources", server);
|
||||||
const client = new DebuggerClient(server.connectPipe());
|
const client = new DebuggerClient(server.connectPipe());
|
||||||
yield client.connect();
|
yield client.connect();
|
||||||
const [,,threadClient] = yield attachTestTabAndResume(client, "test-sources");
|
const [,, threadClient] = yield attachTestTabAndResume(client, "test-sources");
|
||||||
|
|
||||||
yield threadClient.reconfigure({ useSourceMaps: true });
|
yield threadClient.reconfigure({ useSourceMaps: true });
|
||||||
addSources(debuggee);
|
addSources(debuggee);
|
||||||
|
|
@ -33,7 +36,7 @@ function run_test_with_server(server, cb) {
|
||||||
|
|
||||||
yield threadClient.reconfigure({ useSourceMaps: false });
|
yield threadClient.reconfigure({ useSourceMaps: false });
|
||||||
|
|
||||||
threadClient.getSources(function(res) {
|
threadClient.getSources(function (res) {
|
||||||
do_check_eq(res.sources.length, 1, "1 source exist");
|
do_check_eq(res.sources.length, 1, "1 source exist");
|
||||||
client.close().then(cb);
|
client.close().then(cb);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -14,8 +14,7 @@ function run_test() {
|
||||||
|
|
||||||
const TEST_STRING = "This is a very long string!";
|
const TEST_STRING = "This is a very long string!";
|
||||||
|
|
||||||
function makeMockLongStringActor()
|
function makeMockLongStringActor() {
|
||||||
{
|
|
||||||
let string = TEST_STRING;
|
let string = TEST_STRING;
|
||||||
let actor = new LongStringActor(string);
|
let actor = new LongStringActor(string);
|
||||||
actor.actorID = "longString1";
|
actor.actorID = "longString1";
|
||||||
|
|
@ -27,8 +26,7 @@ function makeMockLongStringActor()
|
||||||
return actor;
|
return actor;
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_LSA_destroy()
|
function test_LSA_destroy() {
|
||||||
{
|
|
||||||
let actor = makeMockLongStringActor();
|
let actor = makeMockLongStringActor();
|
||||||
do_check_eq(actor.registeredPool.longStringActors[TEST_STRING], actor);
|
do_check_eq(actor.registeredPool.longStringActors[TEST_STRING], actor);
|
||||||
|
|
||||||
|
|
@ -36,27 +34,18 @@ function test_LSA_destroy()
|
||||||
do_check_eq(actor.registeredPool.longStringActors[TEST_STRING], void 0);
|
do_check_eq(actor.registeredPool.longStringActors[TEST_STRING], void 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_LSA_substring()
|
function test_LSA_grip() {
|
||||||
{
|
|
||||||
let actor = makeMockLongStringActor();
|
|
||||||
do_check_eq(actor._substring(0, 4), TEST_STRING.substring(0, 4));
|
|
||||||
do_check_eq(actor._substring(6, 9), TEST_STRING.substring(6, 9));
|
|
||||||
do_check_eq(actor._substring(0, TEST_STRING.length), TEST_STRING);
|
|
||||||
}
|
|
||||||
|
|
||||||
function test_LSA_grip()
|
|
||||||
{
|
|
||||||
let actor = makeMockLongStringActor();
|
let actor = makeMockLongStringActor();
|
||||||
|
|
||||||
let grip = actor.grip();
|
let grip = actor.grip();
|
||||||
do_check_eq(grip.type, "longString");
|
do_check_eq(grip.type, "longString");
|
||||||
do_check_eq(grip.initial, TEST_STRING.substring(0, DebuggerServer.LONG_STRING_INITIAL_LENGTH));
|
do_check_eq(grip.initial,
|
||||||
|
TEST_STRING.substring(0, DebuggerServer.LONG_STRING_INITIAL_LENGTH));
|
||||||
do_check_eq(grip.length, TEST_STRING.length);
|
do_check_eq(grip.length, TEST_STRING.length);
|
||||||
do_check_eq(grip.actor, actor.actorID);
|
do_check_eq(grip.actor, actor.actorID);
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_LSA_onSubstring()
|
function test_LSA_onSubstring() {
|
||||||
{
|
|
||||||
let actor = makeMockLongStringActor();
|
let actor = makeMockLongStringActor();
|
||||||
let response;
|
let response;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,13 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
var gDebuggee;
|
var gDebuggee;
|
||||||
var gClient;
|
var gClient;
|
||||||
var gThreadClient;
|
var gThreadClient;
|
||||||
|
|
||||||
function run_test()
|
function run_test() {
|
||||||
{
|
|
||||||
initTestDebuggerServer();
|
initTestDebuggerServer();
|
||||||
gDebuggee = addTestGlobal("test-grips");
|
gDebuggee = addTestGlobal("test-grips");
|
||||||
gDebuggee.eval(function stopMe(arg1) {
|
gDebuggee.eval(function stopMe(arg1) {
|
||||||
|
|
@ -15,16 +16,16 @@ function run_test()
|
||||||
|
|
||||||
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
||||||
gClient.connect().then(function () {
|
gClient.connect().then(function () {
|
||||||
attachTestTabAndResume(gClient, "test-grips", function (aResponse, aTabClient, aThreadClient) {
|
attachTestTabAndResume(gClient, "test-grips",
|
||||||
gThreadClient = aThreadClient;
|
function (response, tabClient, threadClient) {
|
||||||
test_longstring_grip();
|
gThreadClient = threadClient;
|
||||||
});
|
test_longstring_grip();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_longstring_grip()
|
function test_longstring_grip() {
|
||||||
{
|
|
||||||
let longString = "All I want is to be a monkey of moderate intelligence who"
|
let longString = "All I want is to be a monkey of moderate intelligence who"
|
||||||
+ " wears a suit... that's why I'm transferring to business school! Maybe I"
|
+ " wears a suit... that's why I'm transferring to business school! Maybe I"
|
||||||
+ " love you so much, I love you no matter who you are pretending to be."
|
+ " love you so much, I love you no matter who you are pretending to be."
|
||||||
|
|
@ -38,20 +39,21 @@ function test_longstring_grip()
|
||||||
|
|
||||||
DebuggerServer.LONG_STRING_LENGTH = 200;
|
DebuggerServer.LONG_STRING_LENGTH = 200;
|
||||||
|
|
||||||
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||||
let args = aPacket.frame.arguments;
|
let args = packet.frame.arguments;
|
||||||
do_check_eq(args.length, 1);
|
do_check_eq(args.length, 1);
|
||||||
let grip = args[0];
|
let grip = args[0];
|
||||||
|
|
||||||
try {
|
try {
|
||||||
do_check_eq(grip.type, "longString");
|
do_check_eq(grip.type, "longString");
|
||||||
do_check_eq(grip.length, longString.length);
|
do_check_eq(grip.length, longString.length);
|
||||||
do_check_eq(grip.initial, longString.substr(0, DebuggerServer.LONG_STRING_INITIAL_LENGTH));
|
do_check_eq(grip.initial,
|
||||||
|
longString.substr(0, DebuggerServer.LONG_STRING_INITIAL_LENGTH));
|
||||||
|
|
||||||
let longStringClient = gThreadClient.pauseLongString(grip);
|
let longStringClient = gThreadClient.pauseLongString(grip);
|
||||||
longStringClient.substring(22, 28, function (aResponse) {
|
longStringClient.substring(22, 28, function (response) {
|
||||||
try {
|
try {
|
||||||
do_check_eq(aResponse.substring, "monkey");
|
do_check_eq(response.substring, "monkey");
|
||||||
} finally {
|
} finally {
|
||||||
gThreadClient.resume(function () {
|
gThreadClient.resume(function () {
|
||||||
finishClient(gClient);
|
finishClient(gClient);
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,13 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
var gDebuggee;
|
var gDebuggee;
|
||||||
var gClient;
|
var gClient;
|
||||||
var gThreadClient;
|
var gThreadClient;
|
||||||
|
|
||||||
function run_test()
|
function run_test() {
|
||||||
{
|
|
||||||
initTestDebuggerServer();
|
initTestDebuggerServer();
|
||||||
gDebuggee = addTestGlobal("test-grips");
|
gDebuggee = addTestGlobal("test-grips");
|
||||||
gDebuggee.eval(function stopMe(arg1) {
|
gDebuggee.eval(function stopMe(arg1) {
|
||||||
|
|
@ -16,19 +17,18 @@ function run_test()
|
||||||
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
||||||
gClient.connect().then(function () {
|
gClient.connect().then(function () {
|
||||||
attachTestTabAndResume(
|
attachTestTabAndResume(
|
||||||
gClient, "test-grips", function (aResponse, aTabClient, aThreadClient) {
|
gClient, "test-grips", function (response, tabClient, threadClient) {
|
||||||
gThreadClient = aThreadClient;
|
gThreadClient = threadClient;
|
||||||
test_longstring_grip();
|
test_longstring_grip();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_longstring_grip()
|
function test_longstring_grip() {
|
||||||
{
|
|
||||||
DebuggerServer.LONG_STRING_LENGTH = 200;
|
DebuggerServer.LONG_STRING_LENGTH = 200;
|
||||||
|
|
||||||
gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
|
gThreadClient.addOneTimeListener("paused", function (event, packet) {
|
||||||
try {
|
try {
|
||||||
let fakeLongStringGrip = {
|
let fakeLongStringGrip = {
|
||||||
type: "longString",
|
type: "longString",
|
||||||
|
|
@ -37,9 +37,9 @@ function test_longstring_grip()
|
||||||
initial: ""
|
initial: ""
|
||||||
};
|
};
|
||||||
let longStringClient = gThreadClient.pauseLongString(fakeLongStringGrip);
|
let longStringClient = gThreadClient.pauseLongString(fakeLongStringGrip);
|
||||||
longStringClient.substring(22, 28, function (aResponse) {
|
longStringClient.substring(22, 28, function (response) {
|
||||||
try {
|
try {
|
||||||
do_check_true(!!aResponse.error,
|
do_check_true(!!response.error,
|
||||||
"We should not get a response, but an error.");
|
"We should not get a response, but an error.");
|
||||||
} finally {
|
} finally {
|
||||||
gThreadClient.resume(function () {
|
gThreadClient.resume(function () {
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,7 @@
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
function run_test()
|
function run_test() {
|
||||||
{
|
|
||||||
let EventEmitter = require("devtools/shared/event-emitter");
|
let EventEmitter = require("devtools/shared/event-emitter");
|
||||||
|
|
||||||
function MonitorClient(client, form) {
|
function MonitorClient(client, form) {
|
||||||
|
|
@ -64,7 +63,7 @@ function run_test()
|
||||||
do_check_eq(event.curve, "test");
|
do_check_eq(event.curve, "test");
|
||||||
do_check_eq(event.value, 42);
|
do_check_eq(event.value, 42);
|
||||||
do_check_eq(event.time, time);
|
do_check_eq(event.time, time);
|
||||||
monitor.stop(function (aResponse) {
|
monitor.stop(function (response) {
|
||||||
monitor.destroy();
|
monitor.destroy();
|
||||||
finishClient(client);
|
finishClient(client);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,13 @@
|
||||||
function run_test()
|
/* eslint-disable strict */
|
||||||
{
|
function run_test() {
|
||||||
Components.utils.import("resource://gre/modules/jsdebugger.jsm");
|
Components.utils.import("resource://gre/modules/jsdebugger.jsm");
|
||||||
addDebuggerToGlobal(this);
|
addDebuggerToGlobal(this);
|
||||||
var g = testGlobal("test1");
|
let g = testGlobal("test1");
|
||||||
|
|
||||||
var dbg = new Debugger();
|
let dbg = new Debugger();
|
||||||
dbg.addDebuggee(g);
|
dbg.addDebuggee(g);
|
||||||
dbg.onDebuggerStatement = function (aFrame) {
|
dbg.onDebuggerStatement = function (frame) {
|
||||||
let args = aFrame.arguments;
|
let args = frame.arguments;
|
||||||
try {
|
try {
|
||||||
args[0];
|
args[0];
|
||||||
do_check_true(true);
|
do_check_true(true);
|
||||||
|
|
@ -21,7 +21,8 @@ function run_test()
|
||||||
g2 = testGlobal("test2");
|
g2 = testGlobal("test2");
|
||||||
g2.g = g;
|
g2.g = g;
|
||||||
g2.eval("(" + function createBadEvent() {
|
g2.eval("(" + function createBadEvent() {
|
||||||
let parser = Components.classes["@mozilla.org/xmlextras/domparser;1"].createInstance(Components.interfaces.nsIDOMParser);
|
let parser = Components.classes["@mozilla.org/xmlextras/domparser;1"]
|
||||||
|
.createInstance(Components.interfaces.nsIDOMParser);
|
||||||
let doc = parser.parseFromString("<foo></foo>", "text/xml");
|
let doc = parser.parseFromString("<foo></foo>", "text/xml");
|
||||||
g.stopMe(doc.createEvent("MouseEvent"));
|
g.stopMe(doc.createEvent("MouseEvent"));
|
||||||
} + ")()");
|
} + ")()");
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,8 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
// Test that we can nest event loops when needed in
|
// Test that we can nest event loops when needed in
|
||||||
// ThreadActor.prototype.unsafeSynchronize.
|
// ThreadActor.prototype.unsafeSynchronize.
|
||||||
|
|
||||||
|
|
@ -10,22 +12,25 @@ var gThreadActor;
|
||||||
|
|
||||||
function run_test() {
|
function run_test() {
|
||||||
initTestDebuggerServer();
|
initTestDebuggerServer();
|
||||||
let gDebuggee = addTestGlobal("test-nesting");
|
addTestGlobal("test-nesting");
|
||||||
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
gClient = new DebuggerClient(DebuggerServer.connectPipe());
|
||||||
gClient.connect().then(function () {
|
gClient.connect().then(function () {
|
||||||
attachTestTabAndResume(gClient, "test-nesting", function (aResponse, aTabClient, aThreadClient) {
|
attachTestTabAndResume(
|
||||||
// Reach over the protocol connection and get a reference to the thread actor.
|
gClient, "test-nesting",
|
||||||
gThreadActor = aThreadClient._transport._serverConnection.getActor(aThreadClient._actor);
|
function (response, tabClient, threadClient) {
|
||||||
|
// Reach over the protocol connection and get a reference to the thread actor.
|
||||||
|
gThreadActor =
|
||||||
|
threadClient._transport._serverConnection.getActor(threadClient._actor);
|
||||||
|
|
||||||
test_nesting();
|
test_nesting();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_nesting() {
|
function test_nesting() {
|
||||||
const thread = gThreadActor;
|
const thread = gThreadActor;
|
||||||
const { resolve, reject, promise: p } = promise.defer();
|
const { resolve, promise: p } = promise.defer();
|
||||||
|
|
||||||
let currentStep = 0;
|
let currentStep = 0;
|
||||||
|
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue