From 841b8e961ce43ac9199051d13afa476b8d611e86 Mon Sep 17 00:00:00 2001 From: Alexandre Poirot Date: Thu, 18 Nov 2021 10:57:01 +0000 Subject: [PATCH] Bug 1740292 - [devtools] Remove target actor's attach method entirely. r=nchevobbe,devtools-backward-compat-reviewers (except for the special edgecase of worker's hybrid descriptor/target) Differential Revision: https://phabricator.services.mozilla.com/D130914 --- .../server/actors/targets/window-global.js | 21 ++----------------- devtools/server/tests/xpcshell/testactors.js | 10 --------- 2 files changed, 2 insertions(+), 29 deletions(-) diff --git a/devtools/server/actors/targets/window-global.js b/devtools/server/actors/targets/window-global.js index e9972ab45d11..d3d42a8e5cad 100644 --- a/devtools/server/actors/targets/window-global.js +++ b/devtools/server/actors/targets/window-global.js @@ -141,13 +141,8 @@ const windowGlobalTargetPrototype = { * * ### Main requests: * - * `attach`/`detach` requests: - * - start/stop document watching: - * Starts watching for new documents and emits `tabNavigated` and - * `frameUpdate` over RDP. - * - retrieve the thread actor: - * Instantiates a ThreadActor that can be later attached to in order to - * debug JS sources in the document. + * `detach`: + * Stop document watching and cleanup everything that the target and its children actors created. * `switchToFrame`: * Change the targeted document of the whole actor, and its child target-scoped actors * to an iframe or back to its original document. @@ -1152,18 +1147,6 @@ const windowGlobalTargetPrototype = { // Protocol Request Handlers - attach(request) { - if (this.isDestroyed()) { - throw { - error: "destroyed", - }; - } - - return { - threadActor: this.threadActor.actorID, - }; - }, - detach(request) { if (!this._detach()) { throw { diff --git a/devtools/server/tests/xpcshell/testactors.js b/devtools/server/tests/xpcshell/testactors.js index cf6df1c3440d..2d9f4abdd25c 100644 --- a/devtools/server/tests/xpcshell/testactors.js +++ b/devtools/server/tests/xpcshell/testactors.js @@ -154,7 +154,6 @@ const TestTargetActor = protocol.ActorClassWithSpec(windowGlobalTargetSpec, { this._global.wrappedJSObject = global; this.threadActor = new ThreadActor(this, this._global); this.conn.addActor(this.threadActor); - this._attached = false; this._extraActors = {}; // This is a hack in order to enable threadActor to be accessed from getFront this._extraActors.threadActor = this.threadActor; @@ -210,16 +209,7 @@ const TestTargetActor = protocol.ActorClassWithSpec(windowGlobalTargetSpec, { return { ...response, ...actors }; }, - attach: function(request) { - this._attached = true; - - return { threadActor: this.threadActor.actorID }; - }, - detach: function(request) { - if (!this._attached) { - return { error: "wrongState" }; - } this.threadActor.destroy(); return { type: "detached" }; },