--- a/devtools/server/actors/addon.js
+++ b/devtools/server/actors/addon.js
@@ -65,17 +65,16 @@ BrowserAddonActor.prototype = {
get sources() {
if (!this._sources) {
assert(this.threadActor, "threadActor should exist when creating sources.");
this._sources = new TabSources(this.threadActor, this._allowSource);
}
return this._sources;
},
-
form: function BAA_form() {
assert(this.actorID, "addon should have an actorID.");
if (!this._consoleActor) {
this._consoleActor = new AddonConsoleActor(this._addon, this.conn, this);
this._contextPool.addActor(this._consoleActor);
}
return {
@@ -90,17 +89,17 @@ BrowserAddonActor.prototype = {
traits: {
highlightable: false,
networkMonitor: false,
},
};
},
- disconnect: function BAA_disconnect() {
+ destroy() {
this.conn.removeActorPool(this._contextPool);
this._contextPool = null;
this._consoleActor = null;
this._addon = null;
this._global = null;
AddonManager.removeAddonListener(this);
},
@@ -135,17 +134,17 @@ BrowserAddonActor.prototype = {
if (this.attached) {
this.onDetach();
// The BrowserAddonActor is not a TabActor and it has to send
// "tabDetached" directly to close the devtools toolbox window.
this.conn.send({ from: this.actorID, type: "tabDetached" });
}
- this.disconnect();
+ this.destroy();
},
onAttach: function BAA_onAttach() {
if (this.exited) {
return { type: "exited" };
}
if (!this.attached) {
@@ -304,19 +303,18 @@ update(AddonConsoleActor.prototype, {
*/
get window() {
return this.parentActor.global;
},
/**
* Destroy the current AddonConsoleActor instance.
*/
- disconnect: function ACA_disconnect()
- {
- WebConsoleActor.prototype.disconnect.call(this);
+ destroy() {
+ WebConsoleActor.prototype.destroy.call(this);
this.addon = null;
},
/**
* Handler for the "startListeners" request.
*
* @param object aRequest
* The JSON request object received from the Web Console client.
--- a/devtools/server/actors/animation.js
+++ b/devtools/server/actors/animation.js
@@ -493,24 +493,16 @@ var AnimationsActor = exports.Animations
events.off(this.tabActor, "will-navigate", this.onWillNavigate);
events.off(this.tabActor, "navigate", this.onNavigate);
this.stopAnimationPlayerUpdates();
this.tabActor = this.observer = this.actors = this.walker = null;
},
/**
- * Since AnimationsActor doesn't have a protocol.js parent actor that takes
- * care of its lifetime, implementing disconnect is required to cleanup.
- */
- disconnect: function () {
- this.destroy();
- },
-
- /**
* Clients can optionally call this with a reference to their WalkerActor.
* If they do, then AnimationPlayerActor's forms are going to also include
* NodeActor IDs when the corresponding NodeActors do exist.
* This, in turns, is helpful for clients to avoid having to go back once more
* to the server to get a NodeActor for a particular animation.
* @param {WalkerActor} walker
*/
setWalkerActor: function (walker) {
--- a/devtools/server/actors/breakpoint.js
+++ b/devtools/server/actors/breakpoint.js
@@ -49,17 +49,17 @@ let BreakpointActor = ActorClassWithSpec
this.scripts = new Set();
this.threadActor = threadActor;
this.originalLocation = originalLocation;
this.condition = null;
this.isPending = true;
},
- disconnect: function () {
+ destroy: function () {
this.removeScripts();
},
hasScript: function (script) {
return this.scripts.has(script);
},
/**
--- a/devtools/server/actors/child-process.js
+++ b/devtools/server/actors/child-process.js
@@ -116,17 +116,17 @@ ChildProcessActor.prototype = {
});
},
_onWorkerListChanged: function () {
this.conn.send({ from: this.actorID, type: "workerListChanged" });
this._workerList.onListChanged = null;
},
- disconnect: function () {
+ destroy: function () {
this.conn.removeActorPool(this._contextPool);
this._contextPool = null;
// Tell the live lists we aren't watching any more.
if (this._workerList) {
this._workerList.onListChanged = null;
}
},
--- a/devtools/server/actors/common.js
+++ b/devtools/server/actors/common.js
@@ -249,23 +249,27 @@ ActorPool.prototype = {
delete aActor.registeredPool._actors[aActor.actorID];
}
aActor.registeredPool = this;
this._actors[aActor.actorID] = aActor;
},
/**
- * Remove an actor from the pool. If the actor has a disconnect method, call
- * it.
+ * Remove an actor from the pool. If the actor has a destroy method, call it.
*/
- removeActor: function AP_remove(aActor) {
- delete this._actors[aActor.actorID];
- if (aActor.disconnect) {
- aActor.disconnect();
+ removeActor(actor) {
+ delete this._actors[actor.actorID];
+ if (actor.destroy) {
+ actor.destroy();
+ return;
+ }
+ // Obsolete destruction method name (might still be used by custom actors)
+ if (actor.disconnect) {
+ actor.disconnect();
}
},
get: function AP_get(aActorID) {
return this._actors[aActorID] || undefined;
},
has: function AP_has(aActorID) {
--- a/devtools/server/actors/emulation.js
+++ b/devtools/server/actors/emulation.js
@@ -26,20 +26,16 @@ let EmulationActor = protocol.ActorClass
initialize(conn, tabActor) {
protocol.Actor.prototype.initialize.call(this, conn);
this.tabActor = tabActor;
this.docShell = tabActor.docShell;
this.simulatorCore = new SimulatorCore(tabActor.chromeEventHandler);
},
- disconnect() {
- this.destroy();
- },
-
destroy() {
this.clearDPPXOverride();
this.clearNetworkThrottling();
this.clearTouchEventsOverride();
this.clearUserAgentOverride();
this.tabActor = null;
this.docShell = null;
this.simulatorCore = null;
--- a/devtools/server/actors/frame.js
+++ b/devtools/server/actors/frame.js
@@ -39,17 +39,17 @@ let FrameActor = ActorClassWithSpec(fram
}
return this._frameLifetimePool;
},
/**
* Finalization handler that is called when the actor is being evicted from
* the pool.
*/
- disconnect: function () {
+ destroy: function () {
this.conn.removeActorPool(this._frameLifetimePool);
this._frameLifetimePool = null;
},
/**
* Returns a frame form for use in a protocol message.
*/
form: function () {
--- a/devtools/server/actors/gcli.js
+++ b/devtools/server/actors/gcli.js
@@ -20,20 +20,16 @@ const GcliActor = ActorClassWithSpec(gcl
Actor.prototype.initialize.call(this, conn);
this._commandsChanged = this._commandsChanged.bind(this);
this._tabActor = tabActor;
this._requisitionPromise = undefined; // see _getRequisition()
},
- disconnect: function () {
- return this.destroy();
- },
-
destroy: function () {
Actor.prototype.destroy.call(this);
// If _getRequisition has not been called, just bail quickly
if (this._requisitionPromise == null) {
this._commandsChanged = undefined;
this._tabActor = undefined;
return Promise.resolve();
--- a/devtools/server/actors/inspector.js
+++ b/devtools/server/actors/inspector.js
@@ -2636,22 +2636,16 @@ exports.InspectorActor = protocol.ActorC
this._highlighterPromise = null;
this._pageStylePromise = null;
this._walkerPromise = null;
this.walker = null;
this.tabActor = null;
},
- // Forces destruction of the actor and all its children
- // like highlighter, walker and style actors.
- disconnect: function () {
- this.destroy();
- },
-
get window() {
return this.tabActor.window;
},
getWalker: function (options = {}) {
if (this._walkerPromise) {
return this._walkerPromise;
}
--- a/devtools/server/actors/monitor.js
+++ b/devtools/server/actors/monitor.js
@@ -43,17 +43,17 @@ MonitorActor.prototype = {
this._agents.forEach(agent => agent.stop());
Services.obs.notifyObservers(null, "devtools-monitor-stop", "");
Services.obs.removeObserver(this, "devtools-monitor-update");
this._started = false;
}
return {};
},
- disconnect: function () {
+ destroy: function () {
this.stop();
},
// nsIObserver.
observe: function (subject, topic, data) {
if (topic == "devtools-monitor-update") {
try {
--- a/devtools/server/actors/object.js
+++ b/devtools/server/actors/object.js
@@ -2076,19 +2076,19 @@ function makeDebuggeeValueIfNeeded(obj,
function LongStringActor(string) {
this.string = string;
this.stringLength = string.length;
}
LongStringActor.prototype = {
actorPrefix: "longString",
- disconnect: function () {
+ destroy: function () {
// Because longStringActors is not a weak map, we won't automatically leave
- // it so we need to manually leave on disconnect so that we don't leak
+ // it so we need to manually leave on destroy so that we don't leak
// memory.
this._releaseActor();
},
/**
* Returns a grip for this actor for returning in a protocol message.
*/
grip: function () {
--- a/devtools/server/actors/performance-entries.js
+++ b/devtools/server/actors/performance-entries.js
@@ -37,20 +37,16 @@ var PerformanceEntriesActor = ActorClass
*/
stop: function () {
if (this.listenerAdded) {
this.window.removeEventListener("performanceentry", this.onPerformanceEntry, true);
this.listenerAdded = false;
}
},
- disconnect: function () {
- this.destroy();
- },
-
destroy: function () {
this.stop();
Actor.prototype.destroy.call(this);
},
onPerformanceEntry: function (e) {
let emitDetail = {
type: e.entryType,
--- a/devtools/server/actors/performance.js
+++ b/devtools/server/actors/performance.js
@@ -48,24 +48,16 @@ var PerformanceActor = ActorClassWithSpe
initialize: function (conn, tabActor) {
Actor.prototype.initialize.call(this, conn);
this._onRecorderEvent = this._onRecorderEvent.bind(this);
this.bridge = new PerformanceRecorder(conn, tabActor);
events.on(this.bridge, "*", this._onRecorderEvent);
},
- /**
- * `disconnect` method required to call destroy, since this
- * actor is not managed by a parent actor.
- */
- disconnect: function () {
- this.destroy();
- },
-
destroy: function () {
events.off(this.bridge, "*", this._onRecorderEvent);
this.bridge.destroy();
Actor.prototype.destroy.call(this);
},
connect: function (config) {
this.bridge.connect({ systemClient: config.systemClient });
--- a/devtools/server/actors/profiler.js
+++ b/devtools/server/actors/profiler.js
@@ -20,24 +20,16 @@ var ProfilerActor = exports.ProfilerActo
initialize: function (conn) {
Actor.prototype.initialize.call(this, conn);
this._onProfilerEvent = this._onProfilerEvent.bind(this);
this.bridge = new Profiler();
events.on(this.bridge, "*", this._onProfilerEvent);
},
- /**
- * `disconnect` method required to call destroy, since this
- * actor is not managed by a parent actor.
- */
- disconnect: function () {
- this.destroy();
- },
-
destroy: function () {
events.off(this.bridge, "*", this._onProfilerEvent);
this.bridge.destroy();
Actor.prototype.destroy.call(this);
},
startProfiler: actorBridgeWithSpec("start"),
stopProfiler: actorBridgeWithSpec("stop"),
--- a/devtools/server/actors/reflow.js
+++ b/devtools/server/actors/reflow.js
@@ -41,25 +41,16 @@ var ReflowActor = exports.ReflowActor =
protocol.Actor.prototype.initialize.call(this, conn);
this.tabActor = tabActor;
this._onReflow = this._onReflow.bind(this);
this.observer = getLayoutChangesObserver(tabActor);
this._isStarted = false;
},
- /**
- * The reflow actor is the first (and last) in its hierarchy to use
- * protocol.js so it doesn't have a parent protocol actor that takes care of
- * its lifetime. So it needs a disconnect method to cleanup.
- */
- disconnect: function () {
- this.destroy();
- },
-
destroy: function () {
this.stop();
releaseLayoutChangesObserver(this.tabActor);
this.observer = null;
this.tabActor = null;
protocol.Actor.prototype.destroy.call(this);
},
--- a/devtools/server/actors/root.js
+++ b/devtools/server/actors/root.js
@@ -42,17 +42,17 @@ loader.lazyGetter(this, "ppmm", () => {
*
* - globalActorFactories: an object |A| describing further actors to
* attach to the 'listTabs' reply. This is the type accumulated by
* DebuggerServer.addGlobalActor. For each own property |P| of |A|,
* the root actor adds a property named |P| to the 'listTabs'
* reply whose value is the name of an actor constructed by
* |A[P]|.
*
- * - onShutdown: a function to call when the root actor is disconnected.
+ * - onShutdown: a function to call when the root actor is destroyed.
*
* Instance properties:
*
* - applicationType: the string the root actor will include as the
* "applicationType" property in the greeting packet. By default, this
* is "browser".
*
* Live lists:
@@ -75,17 +75,17 @@ loader.lazyGetter(this, "ppmm", () => {
* When the list changes, the list implementation should ensure that any
* actors yielded in previous iterations whose referents (tabs) still exist
* get yielded again in subsequent iterations. If the underlying referent
* is the same, the same actor should be presented for it.
*
* The root actor registers an 'onListChanged' handler on the appropriate
* list when it may need to send the client 'tabListChanged' notifications,
* and is careful to remove the handler whenever it does not need to send
- * such notifications (including when it is disconnected). This means that
+ * such notifications (including when it is destroyed). This means that
* live list implementations can use the state of the handler property (set
* or null) to install and remove observers and event listeners.
*
* Note that, as the only way for the root actor to see the members of the
* live list is to begin an iteration over the list, the live list need not
* actually produce any actors until they are reached in the course of
* iteration: alliterative lazy live lists.
*/
@@ -200,19 +200,19 @@ RootActor.prototype = {
return {
from: this.actorID,
type: "forwardingCancelled",
prefix,
};
},
/**
- * Disconnects the actor from the browser window.
+ * Destroys the actor from the browser window.
*/
- disconnect: function () {
+ destroy: function () {
/* Tell the live lists we aren't watching any more. */
if (this._parameters.tabList) {
this._parameters.tabList.onListChanged = null;
}
if (this._parameters.addonList) {
this._parameters.addonList.onListChanged = null;
}
if (this._parameters.workerList) {
--- a/devtools/server/actors/script.js
+++ b/devtools/server/actors/script.js
@@ -556,18 +556,18 @@ const ThreadActor = ActorClassWithSpec(t
this.conn.send({
from: this.actorID,
type: "newGlobal",
// TODO: after bug 801084 lands see if we need to JSONify this.
hostAnnotations: aGlobal.hostAnnotations
});
},
- disconnect: function () {
- dumpn("in ThreadActor.prototype.disconnect");
+ destroy: function () {
+ dumpn("in ThreadActor.prototype.destroy");
if (this._state == "paused") {
this.onResume();
}
// Blow away our source actor ID store because those IDs are only
// valid for this connection. This is ok because we never keep
// things like breakpoints across connections.
this._sourceActorStore = null;
@@ -587,20 +587,20 @@ const ThreadActor = ActorClassWithSpec(t
if (!this._dbg) {
return;
}
this._dbg.enabled = false;
this._dbg = null;
},
/**
- * Disconnect the debugger and put the actor in the exited state.
+ * destroy the debugger and put the actor in the exited state.
*/
exit: function () {
- this.disconnect();
+ this.destroy();
this._state = "exited";
},
// Request handlers
onAttach: function (aRequest) {
if (this.state === "exited") {
return { type: "exited" };
}
@@ -649,17 +649,17 @@ const ThreadActor = ActorClassWithSpec(t
return null;
} catch (e) {
reportError(e);
return { error: "notAttached", message: e.toString() };
}
},
onDetach: function (aRequest) {
- this.disconnect();
+ this.destroy();
this._state = "detached";
this._debuggerSourcesSeen = null;
dumpn("ThreadActor.prototype.onDetach: returning 'detached' packet");
return {
type: "detached"
};
},
--- a/devtools/server/actors/source.js
+++ b/devtools/server/actors/source.js
@@ -221,17 +221,17 @@ let SourceActor = ActorClassWithSpec(sou
isPrettyPrinted: this.threadActor.sources.isPrettyPrinted(this.url),
isSourceMapped: this.isSourceMapped,
sourceMapURL: source ? source.sourceMapURL : null,
introductionUrl: introductionUrl ? introductionUrl.split(" -> ").pop() : null,
introductionType: source ? source.introductionType : null
};
},
- disconnect: function () {
+ destroy: function () {
if (this.registeredPool && this.registeredPool.sourceActors) {
delete this.registeredPool.sourceActors[this.actorID];
}
},
_mapSourceToAddon: function () {
try {
var nsuri = Services.io.newURI(this.url.split(" -> ").pop(), null, null);
--- a/devtools/server/actors/stylesheets.js
+++ b/devtools/server/actors/stylesheets.js
@@ -253,24 +253,16 @@ var StyleSheetActor = protocol.ActorClas
destroy: function () {
if (this._transitionTimeout) {
this.window.clearTimeout(this._transitionTimeout);
removePseudoClassLock(
this.document.documentElement, TRANSITION_PSEUDO_CLASS);
}
},
- /**
- * Since StyleSheetActor doesn't have a protocol.js parent actor that take
- * care of its lifetime, implementing disconnect is required to cleanup.
- */
- disconnect: function () {
- this.destroy();
- },
-
initialize: function (aStyleSheet, aParentActor, aWindow) {
protocol.Actor.prototype.initialize.call(this, null);
this.rawSheet = aStyleSheet;
this.parentActor = aParentActor;
this.conn = this.parentActor.conn;
this._window = aWindow;
--- a/devtools/server/actors/timeline.js
+++ b/devtools/server/actors/timeline.js
@@ -35,25 +35,16 @@ var TimelineActor = exports.TimelineActo
this.tabActor = tabActor;
this.bridge = new Timeline(tabActor);
this._onTimelineEvent = this._onTimelineEvent.bind(this);
events.on(this.bridge, "*", this._onTimelineEvent);
},
/**
- * The timeline actor is the first (and last) in its hierarchy to use
- * protocol.js so it doesn't have a parent protocol actor that takes care of
- * its lifetime. So it needs a disconnect method to cleanup.
- */
- disconnect: function () {
- this.destroy();
- },
-
- /**
* Destroys this actor, stopping recording first.
*/
destroy: function () {
events.off(this.bridge, "*", this._onTimelineEvent);
this.bridge.destroy();
this.bridge = null;
this.tabActor = null;
protocol.Actor.prototype.destroy.call(this);
--- a/devtools/server/actors/webbrowser.js
+++ b/devtools/server/actors/webbrowser.js
@@ -479,18 +479,17 @@ BrowserTabList.prototype._handleActorClo
this._notifyListChanged();
this._checkListening();
};
/**
* Make sure we are listening or not listening for activity elsewhere in
* the browser, as appropriate. Other than setting up newly created XUL
- * windows, all listener / observer connection and disconnection should
- * happen here.
+ * windows, all listener / observer management should happen here.
*/
BrowserTabList.prototype._checkListening = function () {
/*
* If we have an onListChanged handler that we haven't sent an announcement
* to since the last iteration, we need to watch for tab creation as well as
* change of the currently selected tab and tab title changes of tabs in
* parent process via TabAttrModified (tabs oop uses DOMTitleChanges).
*
@@ -882,17 +881,17 @@ function TabActor(connection) {
noTabReconfigureOnClose: true
};
this._workerActorList = null;
this._workerActorPool = null;
this._onWorkerActorListChanged = this._onWorkerActorListChanged.bind(this);
}
-// XXX (bug 710213): TabActor attach/detach/exit/disconnect is a
+// XXX (bug 710213): TabActor attach/detach/exit/destroy is a
// *complete* mess, needs to be rethought asap.
TabActor.prototype = {
traits: null,
// Optional console API listener options (e.g. used by the WebExtensionActor to
// filter console messages by addonID), set to an empty (no options) object by default.
consoleAPIListenerOptions: {},
@@ -1132,17 +1131,17 @@ TabActor.prototype = {
this._appendExtraActors(response);
return response;
},
/**
* Called when the actor is removed from the connection.
*/
- disconnect() {
+ destroy() {
this.exit();
},
/**
* Called by the root actor when the underlying tab is closed.
*/
exit() {
if (this.exited) {
--- a/devtools/server/actors/webconsole.js
+++ b/devtools/server/actors/webconsole.js
@@ -331,18 +331,17 @@ WebConsoleActor.prototype =
},
_findProtoChain: ThreadActor.prototype._findProtoChain,
_removeFromProtoChain: ThreadActor.prototype._removeFromProtoChain,
/**
* Destroy the current WebConsoleActor instance.
*/
- disconnect: function WCA_disconnect()
- {
+ destroy() {
if (this.consoleServiceListener) {
this.consoleServiceListener.destroy();
this.consoleServiceListener = null;
}
if (this.consoleAPIListener) {
this.consoleAPIListener.destroy();
this.consoleAPIListener = null;
}
--- a/devtools/server/actors/worker.js
+++ b/devtools/server/actors/worker.js
@@ -118,20 +118,16 @@ let WorkerActor = protocol.ActorClassWit
destroy() {
protocol.Actor.prototype.destroy.call(this);
if (this._attached) {
this._detach();
}
},
- disconnect() {
- this.destroy();
- },
-
connect(options) {
if (!this._attached) {
return { error: "wrongState" };
}
if (this._threadActor !== null) {
return {
type: "connected",
@@ -441,20 +437,16 @@ protocol.ActorClassWithSpec(serviceWorke
this._waitingWorker.destroy();
this._activeWorker.destroy();
this._installingWorker = null;
this._waitingWorker = null;
this._activeWorker = null;
},
- disconnect() {
- this.destroy();
- },
-
/**
* Standard observer interface to listen to push messages and changes.
*/
observe(subject, topic, data) {
let scope = this._registration.scope;
if (data !== scope) {
// This event doesn't concern us, pretend nothing happened.
return;
--- a/devtools/server/main.js
+++ b/devtools/server/main.js
@@ -1485,33 +1485,33 @@ DebuggerServerConnection.prototype = {
},
/**
* Remove a previously-added pool of actors to the connection.
*
* @param ActorPool actorPool
* The ActorPool instance you want to remove.
* @param boolean noCleanup [optional]
- * True if you don't want to disconnect each actor from the pool, false
+ * True if you don't want to destroy each actor from the pool, false
* otherwise.
*/
removeActorPool(actorPool, noCleanup) {
// When a connection is closed, it removes each of its actor pools. When an
- // actor pool is removed, it calls the disconnect method on each of its
+ // actor pool is removed, it calls the destroy method on each of its
// actors. Some actors, such as ThreadActor, manage their own actor pools.
- // When the disconnect method is called on these actors, they manually
+ // When the destroy method is called on these actors, they manually
// remove their actor pools. Consequently, this method is reentrant.
//
// In addition, some actors, such as ThreadActor, perform asynchronous work
// (in the case of ThreadActor, because they need to resume), before they
// remove each of their actor pools. Since we don't wait for this work to
// be completed, we can end up in this function recursively after the
// connection already set this._extraPools to null.
//
- // This is a bug: if the disconnect method can perform asynchronous work,
+ // This is a bug: if the destroy method can perform asynchronous work,
// then we should wait for that work to be completed before setting this.
// _extraPools to null. As a temporary solution, it should be acceptable
// to just return early (if this._extraPools has been set to null, all
// actors pools for this connection should already have been removed).
if (this._extraPools === null) {
return;
}
let index = this._extraPools.lastIndexOf(actorPool);
--- a/devtools/server/tests/mochitest/test_connectToChild.html
+++ b/devtools/server/tests/mochitest/test_connectToChild.html
@@ -37,31 +37,31 @@ function runTests() {
// Create a minimal iframe with a message manager
let iframe = document.createElement("iframe");
iframe.mozbrowser = true;
document.body.appendChild(iframe);
let mm = iframe.QueryInterface(Ci.nsIFrameLoaderOwner).frameLoader.messageManager;
// Register a test actor in the child process so that we can know if and when
- // this fake actor is disconnected.
+ // this fake actor is destroyed.
mm.loadFrameScript("data:text/javascript,new " + function FrameScriptScope() {
const { require } = Cu.import("resource://devtools/shared/Loader.jsm", {});
const { DebuggerServer } = require("devtools/server/main");
if (!DebuggerServer.initialized) {
DebuggerServer.init();
}
function TestActor() {dump("instanciate test actor\n");}
TestActor.prototype = {
actorPrefix: "test",
- disconnect: function () {
- sendAsyncMessage("test-actor-disconnected", null);
+ destroy: function () {
+ sendAsyncMessage("test-actor-destroyed", null);
},
hello: function () {
return {msg:"world"};
}
};
TestActor.prototype.requestTypes = {
"hello": TestActor.prototype.hello
};
@@ -80,30 +80,30 @@ function runTests() {
// Fake a first connection to an iframe
let transport = DebuggerServer.connectPipe();
let conn = transport._serverConnection;
let client = new DebuggerClient(transport);
DebuggerServer.connectToChild(conn, iframe).then(actor => {
ok(actor.testActor, "Got the test actor");
// Ensure sending at least one request to our actor,
- // otherwise it won't be instanciated, nor be disconnected...
+ // otherwise it won't be instanciated, nor be destroyed...
client.request({
to: actor.testActor,
type: "hello",
}, function (response) {
// Then close the client. That should end up cleaning our test actor
client.close();
// Ensure that our test actor got cleaned up;
- // its disconnect method should be called
- mm.addMessageListener("test-actor-disconnected", function listener() {
- mm.removeMessageListener("test-actor-disconnected", listener);
- ok(true, "Actor is cleaned up");
+ // its destroy method should be called
+ mm.addMessageListener("test-actor-destroyed", function listener() {
+ mm.removeMessageListener("test-actor-destroyed", listener);
+ ok(true, "Actor is cleaned up");
secondClient(actor.testActor);
});
});
});
}
function secondClient(firstActor) {
--- a/devtools/server/tests/unit/test_longstringactor.js
+++ b/devtools/server/tests/unit/test_longstringactor.js
@@ -2,17 +2,17 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
const { LongStringActor } = require("devtools/server/actors/object");
function run_test() {
- test_LSA_disconnect();
+ test_LSA_destroy();
test_LSA_grip();
test_LSA_onSubstring();
}
const TEST_STRING = "This is a very long string!";
function makeMockLongStringActor()
{
@@ -22,22 +22,22 @@ function makeMockLongStringActor()
actor.registeredPool = {
longStringActors: {
[string]: actor
}
};
return actor;
}
-function test_LSA_disconnect()
+function test_LSA_destroy()
{
let actor = makeMockLongStringActor();
do_check_eq(actor.registeredPool.longStringActors[TEST_STRING], actor);
- actor.disconnect();
+ actor.destroy();
do_check_eq(actor.registeredPool.longStringActors[TEST_STRING], void 0);
}
function test_LSA_substring()
{
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));