forked from mirrors/gecko-dev
Bug 1326410 - Fixing ESLint Errors. r=ntim
MozReview-Commit-ID: HZ3iBCW0hEf
This commit is contained in:
parent
869af55a16
commit
b7b3908f8f
12 changed files with 92 additions and 197 deletions
|
|
@ -115,7 +115,6 @@ devtools/server/tests/browser/**
|
|||
devtools/server/tests/mochitest/**
|
||||
devtools/server/tests/unit/**
|
||||
devtools/shared/heapsnapshot/**
|
||||
devtools/shared/transport/tests/unit/**
|
||||
devtools/shared/webconsole/test/**
|
||||
|
||||
# Ignore devtools pre-processed files
|
||||
|
|
|
|||
|
|
@ -3,6 +3,10 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
/* exported Cr, CC, NetUtil, defer, errorCount, initTestDebuggerServer,
|
||||
writeTestTempFile, socket_transport, local_transport, really_long
|
||||
*/
|
||||
|
||||
var Cc = Components.classes;
|
||||
var Ci = Components.interfaces;
|
||||
var Cu = Components.utils;
|
||||
|
|
@ -17,7 +21,6 @@ const defer = require("devtools/shared/defer");
|
|||
const { Task } = require("devtools/shared/task");
|
||||
|
||||
const Services = require("Services");
|
||||
const DevToolsUtils = require("devtools/shared/DevToolsUtils");
|
||||
|
||||
// We do not want to log packets by default, because in some tests,
|
||||
// we can be sending large amounts of data. The test harness has
|
||||
|
|
@ -31,27 +34,21 @@ Services.prefs.setBoolPref("devtools.debugger.remote-enabled", true);
|
|||
const { DebuggerServer } = require("devtools/server/main");
|
||||
const { DebuggerClient } = require("devtools/shared/client/main");
|
||||
|
||||
function testExceptionHook(ex) {
|
||||
try {
|
||||
do_report_unexpected_exception(ex);
|
||||
} catch (ex) {
|
||||
return {throw: ex};
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
// Convert an nsIScriptError 'aFlags' value into an appropriate string.
|
||||
function scriptErrorFlagsToKind(aFlags) {
|
||||
var kind;
|
||||
if (aFlags & Ci.nsIScriptError.warningFlag)
|
||||
// Convert an nsIScriptError 'flags' value into an appropriate string.
|
||||
function scriptErrorFlagsToKind(flags) {
|
||||
let kind;
|
||||
if (flags & Ci.nsIScriptError.warningFlag) {
|
||||
kind = "warning";
|
||||
if (aFlags & Ci.nsIScriptError.exceptionFlag)
|
||||
}
|
||||
if (flags & Ci.nsIScriptError.exceptionFlag) {
|
||||
kind = "exception";
|
||||
else
|
||||
} else {
|
||||
kind = "error";
|
||||
}
|
||||
|
||||
if (aFlags & Ci.nsIScriptError.strictFlag)
|
||||
if (flags & Ci.nsIScriptError.strictFlag) {
|
||||
kind = "strict " + kind;
|
||||
}
|
||||
|
||||
return kind;
|
||||
}
|
||||
|
|
@ -60,23 +57,24 @@ function scriptErrorFlagsToKind(aFlags) {
|
|||
// into the ether.
|
||||
var errorCount = 0;
|
||||
var listener = {
|
||||
observe: function (aMessage) {
|
||||
observe: function (message) {
|
||||
errorCount++;
|
||||
let string = "";
|
||||
try {
|
||||
// If we've been given an nsIScriptError, then we can print out
|
||||
// something nicely formatted, for tools like Emacs to pick up.
|
||||
var scriptError = aMessage.QueryInterface(Ci.nsIScriptError);
|
||||
dump(aMessage.sourceName + ":" + aMessage.lineNumber + ": " +
|
||||
scriptErrorFlagsToKind(aMessage.flags) + ": " +
|
||||
aMessage.errorMessage + "\n");
|
||||
var string = aMessage.errorMessage;
|
||||
message.QueryInterface(Ci.nsIScriptError);
|
||||
dump(message.sourceName + ":" + message.lineNumber + ": " +
|
||||
scriptErrorFlagsToKind(message.flags) + ": " +
|
||||
message.errorMessage + "\n");
|
||||
string = message.errorMessage;
|
||||
} catch (x) {
|
||||
// Be a little paranoid with message, as the whole goal here is to lose
|
||||
// no information.
|
||||
try {
|
||||
var string = "" + aMessage.message;
|
||||
} catch (x) {
|
||||
var string = "<error converting error message to string>";
|
||||
string = message.message;
|
||||
} catch (e) {
|
||||
string = "<error converting error message to string>";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -86,7 +84,7 @@ var listener = {
|
|||
}
|
||||
|
||||
// Throw in most cases, but ignore the "strict" messages
|
||||
if (!(aMessage.flags & Ci.nsIScriptError.strictFlag)) {
|
||||
if (!(message.flags & Ci.nsIScriptError.strictFlag)) {
|
||||
do_throw("head_dbg.js got console message: " + string + "\n");
|
||||
}
|
||||
}
|
||||
|
|
@ -96,80 +94,6 @@ var consoleService = Cc["@mozilla.org/consoleservice;1"]
|
|||
.getService(Ci.nsIConsoleService);
|
||||
consoleService.registerListener(listener);
|
||||
|
||||
function check_except(func) {
|
||||
try {
|
||||
func();
|
||||
} catch (e) {
|
||||
do_check_true(true);
|
||||
return;
|
||||
}
|
||||
dump("Should have thrown an exception: " + func.toString());
|
||||
do_check_true(false);
|
||||
}
|
||||
|
||||
function testGlobal(aName) {
|
||||
let systemPrincipal = Cc["@mozilla.org/systemprincipal;1"]
|
||||
.createInstance(Ci.nsIPrincipal);
|
||||
|
||||
let sandbox = Cu.Sandbox(systemPrincipal);
|
||||
sandbox.__name = aName;
|
||||
return sandbox;
|
||||
}
|
||||
|
||||
function addTestGlobal(aName)
|
||||
{
|
||||
let global = testGlobal(aName);
|
||||
DebuggerServer.addTestGlobal(global);
|
||||
return global;
|
||||
}
|
||||
|
||||
// List the DebuggerClient |aClient|'s tabs, look for one whose title is
|
||||
// |aTitle|, and apply |aCallback| to the packet's entry for that tab.
|
||||
function getTestTab(aClient, aTitle, aCallback) {
|
||||
aClient.listTabs(function (aResponse) {
|
||||
for (let tab of aResponse.tabs) {
|
||||
if (tab.title === aTitle) {
|
||||
aCallback(tab);
|
||||
return;
|
||||
}
|
||||
}
|
||||
aCallback(null);
|
||||
});
|
||||
}
|
||||
|
||||
// Attach to |aClient|'s tab whose title is |aTitle|; pass |aCallback| the
|
||||
// response packet and a TabClient instance referring to that tab.
|
||||
function attachTestTab(aClient, aTitle, aCallback) {
|
||||
getTestTab(aClient, aTitle, function (aTab) {
|
||||
aClient.attachTab(aTab.actor, aCallback);
|
||||
});
|
||||
}
|
||||
|
||||
// Attach to |aClient|'s tab whose title is |aTitle|, and then attach to
|
||||
// that tab's thread. Pass |aCallback| the thread attach response packet, a
|
||||
// TabClient referring to the tab, and a ThreadClient referring to the
|
||||
// thread.
|
||||
function attachTestThread(aClient, aTitle, aCallback) {
|
||||
attachTestTab(aClient, aTitle, function (aResponse, aTabClient) {
|
||||
function onAttach(aResponse, aThreadClient) {
|
||||
aCallback(aResponse, aTabClient, aThreadClient);
|
||||
}
|
||||
aTabClient.attachThread({ useSourceMaps: true }, onAttach);
|
||||
});
|
||||
}
|
||||
|
||||
// Attach to |aClient|'s tab whose title is |aTitle|, attach to the tab's
|
||||
// thread, and then resume it. Pass |aCallback| the thread's response to
|
||||
// the 'resume' packet, a TabClient for the tab, and a ThreadClient for the
|
||||
// thread.
|
||||
function attachTestTabAndResume(aClient, aTitle, aCallback) {
|
||||
attachTestThread(aClient, aTitle, function (aResponse, aTabClient, aThreadClient) {
|
||||
aThreadClient.resume(function (aResponse) {
|
||||
aCallback(aResponse, aTabClient, aThreadClient);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize the testing debugger server.
|
||||
*/
|
||||
|
|
@ -184,35 +108,6 @@ function initTestDebuggerServer() {
|
|||
DebuggerServer.init();
|
||||
}
|
||||
|
||||
function finishClient(aClient) {
|
||||
aClient.close().then(function () {
|
||||
do_test_finished();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Takes a relative file path and returns the absolute file url for it.
|
||||
*/
|
||||
function getFileUrl(aName, aAllowMissing = false) {
|
||||
let file = do_get_file(aName, aAllowMissing);
|
||||
return Services.io.newFileURI(file).spec;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the full path of the file with the specified name in a
|
||||
* platform-independent and URL-like form.
|
||||
*/
|
||||
function getFilePath(aName, aAllowMissing = false) {
|
||||
let file = do_get_file(aName, aAllowMissing);
|
||||
let path = Services.io.newFileURI(file).spec;
|
||||
let filePrePath = "file://";
|
||||
if ("nsILocalFileWin" in Ci &&
|
||||
file instanceof Ci.nsILocalFileWin) {
|
||||
filePrePath += "/";
|
||||
}
|
||||
return path.slice(filePrePath.length);
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper around do_get_file to prefix files with the name of current test to
|
||||
* avoid collisions when running in parallel.
|
||||
|
|
@ -224,16 +119,16 @@ function getTestTempFile(fileName, allowMissing) {
|
|||
return do_get_file(fileName + "-" + thisTest, allowMissing);
|
||||
}
|
||||
|
||||
function writeTestTempFile(aFileName, aContent) {
|
||||
let file = getTestTempFile(aFileName, true);
|
||||
function writeTestTempFile(fileName, content) {
|
||||
let file = getTestTempFile(fileName, true);
|
||||
let stream = Cc["@mozilla.org/network/file-output-stream;1"]
|
||||
.createInstance(Ci.nsIFileOutputStream);
|
||||
stream.init(file, -1, -1, 0);
|
||||
try {
|
||||
do {
|
||||
let numWritten = stream.write(aContent, aContent.length);
|
||||
aContent = aContent.slice(numWritten);
|
||||
} while (aContent.length > 0);
|
||||
let numWritten = stream.write(content, content.length);
|
||||
content = content.slice(numWritten);
|
||||
} while (content.length > 0);
|
||||
} finally {
|
||||
stream.close();
|
||||
}
|
||||
|
|
@ -248,10 +143,10 @@ var socket_transport = Task.async(function* () {
|
|||
authenticator.allowConnection = () => {
|
||||
return DebuggerServer.AuthenticationResult.ALLOW;
|
||||
};
|
||||
let listener = DebuggerServer.createListener();
|
||||
listener.portOrPath = -1;
|
||||
listener.authenticator = authenticator;
|
||||
yield listener.open();
|
||||
let debuggerListener = DebuggerServer.createListener();
|
||||
debuggerListener.portOrPath = -1;
|
||||
debuggerListener.authenticator = authenticator;
|
||||
yield debuggerListener.open();
|
||||
}
|
||||
let port = DebuggerServer._listeners[0].port;
|
||||
do_print("Debugger server port is " + port);
|
||||
|
|
|
|||
|
|
@ -73,8 +73,8 @@ function json_reply(client, response) {
|
|||
// Send bulk data to server
|
||||
let copyDeferred = defer();
|
||||
request.on("bulk-send-ready", ({writer, done}) => {
|
||||
let input = Cc["@mozilla.org/io/string-input-stream;1"].
|
||||
createInstance(Ci.nsIStringInputStream);
|
||||
let input = Cc["@mozilla.org/io/string-input-stream;1"]
|
||||
.createInstance(Ci.nsIStringInputStream);
|
||||
input.setData(reallyLong, reallyLong.length);
|
||||
try {
|
||||
writer.copyFrom(input, () => {
|
||||
|
|
|
|||
|
|
@ -150,6 +150,18 @@ var test_bulk_request_cs = Task.async(function* (transportFactory, actorType, re
|
|||
client.listTabs(clientDeferred.resolve);
|
||||
});
|
||||
|
||||
function bulkSendReadyCallback({copyFrom}) {
|
||||
NetUtil.asyncFetch({
|
||||
uri: NetUtil.newURI(getTestTempFile("bulk-input")),
|
||||
loadUsingSystemPrincipal: true
|
||||
}, input => {
|
||||
copyFrom(input).then(() => {
|
||||
input.close();
|
||||
bulkCopyDeferred.resolve();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
clientDeferred.promise.then(response => {
|
||||
let request = client.startBulkRequest({
|
||||
actor: response.testBulk,
|
||||
|
|
@ -158,17 +170,7 @@ var test_bulk_request_cs = Task.async(function* (transportFactory, actorType, re
|
|||
});
|
||||
|
||||
// Send bulk data to server
|
||||
request.on("bulk-send-ready", ({copyFrom}) => {
|
||||
NetUtil.asyncFetch({
|
||||
uri: NetUtil.newURI(getTestTempFile("bulk-input")),
|
||||
loadUsingSystemPrincipal: true
|
||||
}, input => {
|
||||
copyFrom(input).then(() => {
|
||||
input.close();
|
||||
bulkCopyDeferred.resolve();
|
||||
});
|
||||
});
|
||||
});
|
||||
request.on("bulk-send-ready", bulkSendReadyCallback);
|
||||
|
||||
// Set up reply handling for this type
|
||||
replyHandlers[replyType](request).then(() => {
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
"use strict";
|
||||
|
||||
var gPort;
|
||||
var gExtraListener;
|
||||
|
||||
function run_test()
|
||||
{
|
||||
function run_test() {
|
||||
do_print("Starting test at " + new Date().toTimeString());
|
||||
initTestDebuggerServer();
|
||||
|
||||
|
|
@ -16,8 +16,7 @@ function run_test()
|
|||
run_next_test();
|
||||
}
|
||||
|
||||
function* test_socket_conn()
|
||||
{
|
||||
function* test_socket_conn() {
|
||||
do_check_eq(DebuggerServer.listeningSockets, 0);
|
||||
let AuthenticatorType = DebuggerServer.Authenticators.get("PROMPT");
|
||||
let authenticator = new AuthenticatorType.Server();
|
||||
|
|
@ -53,9 +52,9 @@ function* test_socket_conn()
|
|||
|
||||
let closedDeferred = defer();
|
||||
transport.hooks = {
|
||||
onPacket: function (aPacket) {
|
||||
this.onPacket = function (aPacket) {
|
||||
do_check_eq(aPacket.unicode, unicodeString);
|
||||
onPacket: function (packet) {
|
||||
this.onPacket = function ({unicode}) {
|
||||
do_check_eq(unicode, unicodeString);
|
||||
transport.close();
|
||||
};
|
||||
// Verify that things work correctly when bigger than the output
|
||||
|
|
@ -64,9 +63,9 @@ function* test_socket_conn()
|
|||
type: "echo",
|
||||
reallylong: really_long(),
|
||||
unicode: unicodeString});
|
||||
do_check_eq(aPacket.from, "root");
|
||||
do_check_eq(packet.from, "root");
|
||||
},
|
||||
onClosed: function (aStatus) {
|
||||
onClosed: function (status) {
|
||||
closedDeferred.resolve();
|
||||
},
|
||||
};
|
||||
|
|
@ -74,8 +73,7 @@ function* test_socket_conn()
|
|||
return closedDeferred.promise;
|
||||
}
|
||||
|
||||
function* test_socket_shutdown()
|
||||
{
|
||||
function* test_socket_shutdown() {
|
||||
do_check_eq(DebuggerServer.listeningSockets, 2);
|
||||
gExtraListener.close();
|
||||
do_check_eq(DebuggerServer.listeningSockets, 1);
|
||||
|
|
@ -87,7 +85,7 @@ function* test_socket_shutdown()
|
|||
|
||||
do_print("Connecting to a server socket at " + new Date().toTimeString());
|
||||
try {
|
||||
let transport = yield DebuggerClient.socketConnect({
|
||||
yield DebuggerClient.socketConnect({
|
||||
host: "127.0.0.1",
|
||||
port: gPort
|
||||
});
|
||||
|
|
@ -98,24 +96,22 @@ function* test_socket_shutdown()
|
|||
// machines it may just time out.
|
||||
do_check_true(true);
|
||||
return;
|
||||
} else {
|
||||
throw e;
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
|
||||
// Shouldn't reach this, should never connect.
|
||||
do_check_true(false);
|
||||
}
|
||||
|
||||
function test_pipe_conn()
|
||||
{
|
||||
function test_pipe_conn() {
|
||||
let transport = DebuggerServer.connectPipe();
|
||||
transport.hooks = {
|
||||
onPacket: function (aPacket) {
|
||||
do_check_eq(aPacket.from, "root");
|
||||
onPacket: function (packet) {
|
||||
do_check_eq(packet.from, "root");
|
||||
transport.close();
|
||||
},
|
||||
onClosed: function (aStatus) {
|
||||
onClosed: function (status) {
|
||||
run_next_test();
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
* Bug 755412 - checks if the server drops the connection on an improperly
|
||||
* framed packet, i.e. when the length header is invalid.
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
const { RawPacket } = require("devtools/shared/transport/packets");
|
||||
|
||||
|
|
@ -61,8 +62,8 @@ var test_helper = Task.async(function* (payload) {
|
|||
});
|
||||
let closedDeferred = defer();
|
||||
transport.hooks = {
|
||||
onPacket: function (aPacket) {
|
||||
this.onPacket = function (aPacket) {
|
||||
onPacket: function (packet) {
|
||||
this.onPacket = function () {
|
||||
do_throw(new Error("This connection should be dropped."));
|
||||
transport.close();
|
||||
};
|
||||
|
|
@ -71,7 +72,7 @@ var test_helper = Task.async(function* (payload) {
|
|||
transport._outgoing.push(new RawPacket(transport, payload));
|
||||
transport._flushOutgoing();
|
||||
},
|
||||
onClosed: function (aStatus) {
|
||||
onClosed: function (status) {
|
||||
do_check_true(true);
|
||||
closedDeferred.resolve();
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
"use strict";
|
||||
|
||||
const StreamUtils = require("devtools/shared/transport/stream-utils");
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@ function run_test() {
|
|||
/** * Tests ***/
|
||||
|
||||
var test_bulk_send_error = Task.async(function* (transportFactory) {
|
||||
let deferred = defer();
|
||||
let transport = yield transportFactory();
|
||||
|
||||
let client = new DebuggerClient(transport);
|
||||
|
|
@ -33,6 +32,5 @@ var test_bulk_send_error = Task.async(function* (transportFactory) {
|
|||
} catch (e) {
|
||||
do_check_true(true);
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
"use strict";
|
||||
|
||||
const { JSONPacket, BulkPacket } =
|
||||
require("devtools/shared/transport/packets");
|
||||
|
|
|
|||
|
|
@ -74,9 +74,9 @@ var test_bulk_transfer_transport = Task.async(function* (transportFactory) {
|
|||
|
||||
// Client
|
||||
transport.hooks = {
|
||||
onPacket: function (aPacket) {
|
||||
onPacket: function (packet) {
|
||||
// We've received the initial start up packet
|
||||
do_check_eq(aPacket.from, "root");
|
||||
do_check_eq(packet.from, "root");
|
||||
|
||||
// Server
|
||||
do_check_eq(Object.keys(DebuggerServer._connections).length, 1);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
"use strict";
|
||||
|
||||
const { RootActor } = require("devtools/server/actors/root");
|
||||
const { DebuggerServer } = require("devtools/server/main");
|
||||
|
|
@ -7,8 +8,8 @@ const { DebuggerServer } = require("devtools/server/main");
|
|||
/**
|
||||
* Root actor that doesn't have the bulk trait.
|
||||
*/
|
||||
function createRootActor(aConnection) {
|
||||
let root = new RootActor(aConnection, {
|
||||
function createRootActor(connection) {
|
||||
let root = new RootActor(connection, {
|
||||
globalActorFactories: DebuggerServer.globalActorFactories
|
||||
});
|
||||
root.applicationType = "xpcshell-tests";
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
"use strict";
|
||||
|
||||
const { ActorPool, appendExtraActors, createExtraActors } =
|
||||
require("devtools/server/actors/common");
|
||||
|
|
@ -9,8 +10,8 @@ const { DebuggerServer } = require("devtools/server/main");
|
|||
const promise = require("promise");
|
||||
|
||||
var gTestGlobals = [];
|
||||
DebuggerServer.addTestGlobal = function (aGlobal) {
|
||||
gTestGlobals.push(aGlobal);
|
||||
DebuggerServer.addTestGlobal = function (global) {
|
||||
gTestGlobals.push(global);
|
||||
};
|
||||
|
||||
// A mock tab list, for use by tests. This simply presents each global in
|
||||
|
|
@ -20,18 +21,18 @@ DebuggerServer.addTestGlobal = function (aGlobal) {
|
|||
// As implemented now, we consult gTestGlobals when we're constructed, not
|
||||
// when we're iterated over, so tests have to add their globals before the
|
||||
// root actor is created.
|
||||
function TestTabList(aConnection) {
|
||||
this.conn = aConnection;
|
||||
function TestTabList(connection) {
|
||||
this.conn = connection;
|
||||
|
||||
// An array of actors for each global added with
|
||||
// DebuggerServer.addTestGlobal.
|
||||
this._tabActors = [];
|
||||
|
||||
// A pool mapping those actors' names to the actors.
|
||||
this._tabActorPool = new ActorPool(aConnection);
|
||||
this._tabActorPool = new ActorPool(connection);
|
||||
|
||||
for (let global of gTestGlobals) {
|
||||
let actor = new TestTabActor(aConnection, global);
|
||||
let actor = new TestTabActor(connection, global);
|
||||
actor.selected = false;
|
||||
this._tabActors.push(actor);
|
||||
this._tabActorPool.addActor(actor);
|
||||
|
|
@ -40,7 +41,7 @@ function TestTabList(aConnection) {
|
|||
this._tabActors[0].selected = true;
|
||||
}
|
||||
|
||||
aConnection.addActorPool(this._tabActorPool);
|
||||
connection.addActorPool(this._tabActorPool);
|
||||
}
|
||||
|
||||
TestTabList.prototype = {
|
||||
|
|
@ -50,18 +51,18 @@ TestTabList.prototype = {
|
|||
}
|
||||
};
|
||||
|
||||
function createRootActor(aConnection) {
|
||||
let root = new RootActor(aConnection, {
|
||||
tabList: new TestTabList(aConnection),
|
||||
function createRootActor(connection) {
|
||||
let root = new RootActor(connection, {
|
||||
tabList: new TestTabList(connection),
|
||||
globalActorFactories: DebuggerServer.globalActorFactories
|
||||
});
|
||||
root.applicationType = "xpcshell-tests";
|
||||
return root;
|
||||
}
|
||||
|
||||
function TestTabActor(aConnection, aGlobal) {
|
||||
this.conn = aConnection;
|
||||
this._global = aGlobal;
|
||||
function TestTabActor(connection, global) {
|
||||
this.conn = connection;
|
||||
this._global = global;
|
||||
this._threadActor = new ThreadActor(this, this._global);
|
||||
this.conn.addActor(this._threadActor);
|
||||
this._attached = false;
|
||||
|
|
@ -96,7 +97,7 @@ TestTabActor.prototype = {
|
|||
return response;
|
||||
},
|
||||
|
||||
onAttach: function (aRequest) {
|
||||
onAttach: function (request) {
|
||||
this._attached = true;
|
||||
|
||||
let response = { type: "tabAttached", threadActor: this._threadActor.actorID };
|
||||
|
|
@ -105,9 +106,9 @@ TestTabActor.prototype = {
|
|||
return response;
|
||||
},
|
||||
|
||||
onDetach: function (aRequest) {
|
||||
onDetach: function (request) {
|
||||
if (!this._attached) {
|
||||
return { "error":"wrongState" };
|
||||
return { "error": "wrongState" };
|
||||
}
|
||||
return { type: "detached" };
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in a new issue