зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1673328 - [devtools] Drop unused ThreadActor.detach method. r=nchevobbe,devtools-backward-compat-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D94956
This commit is contained in:
Родитель
e5dd1d7904
Коммит
fdb8f8c40d
|
@ -11,7 +11,6 @@
|
|||
const ThreadStateTypes = {
|
||||
paused: "paused",
|
||||
resumed: "attached",
|
||||
detached: "detached",
|
||||
running: "attached",
|
||||
};
|
||||
|
||||
|
|
|
@ -44,10 +44,8 @@ class ThreadFront extends FrontClassWithSpec(threadSpec) {
|
|||
this._state = "paused";
|
||||
this._beforePaused = this._beforePaused.bind(this);
|
||||
this._beforeResumed = this._beforeResumed.bind(this);
|
||||
this._beforeDetached = this._beforeDetached.bind(this);
|
||||
this.before("paused", this._beforePaused);
|
||||
this.before("resumed", this._beforeResumed);
|
||||
this.before("detached", this._beforeDetached);
|
||||
this.targetFront.on("will-navigate", this._onWillNavigate.bind(this));
|
||||
// Attribute name from which to retrieve the actorID out of the target actor's form
|
||||
this.formAttributeName = "threadActor";
|
||||
|
@ -202,16 +200,6 @@ class ThreadFront extends FrontClassWithSpec(threadSpec) {
|
|||
await onPaused;
|
||||
}
|
||||
|
||||
/**
|
||||
* Detach from the thread actor.
|
||||
*/
|
||||
async detach() {
|
||||
const onDetached = this.once("detached");
|
||||
await super.detach();
|
||||
await onDetached;
|
||||
await this.destroy();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a ObjectFront object for the given object grip.
|
||||
*
|
||||
|
@ -254,14 +242,6 @@ class ThreadFront extends FrontClassWithSpec(threadSpec) {
|
|||
this._clearObjectFronts("_pauseGrips");
|
||||
}
|
||||
|
||||
/**
|
||||
* Invalidate thread-lifetime grip clients and clear the list of current grip
|
||||
* clients.
|
||||
*/
|
||||
_clearThreadGrips() {
|
||||
this._clearObjectFronts("_threadGrips");
|
||||
}
|
||||
|
||||
_beforePaused(packet) {
|
||||
this._state = "paused";
|
||||
this._onThreadState(packet);
|
||||
|
@ -273,13 +253,6 @@ class ThreadFront extends FrontClassWithSpec(threadSpec) {
|
|||
this.unmanageChildren(FrameFront);
|
||||
}
|
||||
|
||||
_beforeDetached(packet) {
|
||||
this._state = "detached";
|
||||
this._onThreadState(packet);
|
||||
this._clearThreadGrips();
|
||||
this.unmanageChildren(FrameFront);
|
||||
}
|
||||
|
||||
_onWillNavigate() {
|
||||
this.unmanageChildren(SourceFront);
|
||||
}
|
||||
|
|
|
@ -96,8 +96,6 @@ When the user navigates away from a page, a `tabNavigated` event will be fired.
|
|||
|
||||
```javascript
|
||||
async function onTab() {
|
||||
// Detach from the previous thread.
|
||||
await client.activeThread.detach();
|
||||
// Detach from the previous tab.
|
||||
await targetFront.detach();
|
||||
// Start debugging the new tab.
|
||||
|
@ -121,7 +119,6 @@ client.attachThread(response.threadActor).then(function(threadFront) {
|
|||
// Attach listeners for thread events.
|
||||
threadFront.on("paused", onPause);
|
||||
threadFront.on("resumed", fooListener);
|
||||
threadFront.on("detached", fooListener);
|
||||
|
||||
// Resume the thread.
|
||||
threadFront.resume();
|
||||
|
@ -182,7 +179,6 @@ function debugTab() {
|
|||
// Attach listeners for thread events.
|
||||
threadFront.on("paused", onPause);
|
||||
threadFront.on("resumed", fooListener);
|
||||
threadFront.on("detached", fooListener);
|
||||
|
||||
// Resume the thread.
|
||||
threadFront.resume();
|
||||
|
@ -196,13 +192,10 @@ function debugTab() {
|
|||
* Handler for location changes.
|
||||
*/
|
||||
function onTab() {
|
||||
// Detach from the previous thread.
|
||||
client.activeThread.detach().then(() => {
|
||||
// Detach from the previous tab.
|
||||
client.detach().then(() => {
|
||||
// Start debugging the new tab.
|
||||
debugTab();
|
||||
});
|
||||
// Detach from the previous tab.
|
||||
client.detach().then(() => {
|
||||
// Start debugging the new tab.
|
||||
debugTab();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -778,16 +778,6 @@ const ThreadActor = ActorClassWithSpec(threadSpec, {
|
|||
}
|
||||
},
|
||||
|
||||
onDetach: function(request) {
|
||||
this.destroy();
|
||||
this._state = "detached";
|
||||
this._debuggerSourcesSeen = null;
|
||||
|
||||
dumpn("ThreadActor.prototype.onDetach: returning 'detached' packet");
|
||||
this.emit("detached");
|
||||
return {};
|
||||
},
|
||||
|
||||
onReconfigure: function(request) {
|
||||
if (this.state == "exited") {
|
||||
return { error: "wrongState" };
|
||||
|
@ -2213,7 +2203,6 @@ const ThreadActor = ActorClassWithSpec(threadSpec, {
|
|||
|
||||
Object.assign(ThreadActor.prototype.requestTypes, {
|
||||
attach: ThreadActor.prototype.onAttach,
|
||||
detach: ThreadActor.prototype.onDetach,
|
||||
reconfigure: ThreadActor.prototype.onReconfigure,
|
||||
resume: ThreadActor.prototype.onResume,
|
||||
interrupt: ThreadActor.prototype.onInterrupt,
|
||||
|
|
|
@ -60,8 +60,6 @@ add_task(async function test_webextension_addon_debugging_connect() {
|
|||
await threadFront.resume();
|
||||
is(threadFront.paused, false, "The addon threadActor has been resumed");
|
||||
|
||||
await threadFront.detach();
|
||||
|
||||
const waitTransportClosed = new Promise(resolve => {
|
||||
client._transport.once("close", resolve);
|
||||
});
|
||||
|
|
|
@ -1,20 +0,0 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* Test that reattaching to a previously detached thread works.
|
||||
*/
|
||||
|
||||
add_task(
|
||||
threadFrontTest(async ({ threadFront, debuggee, client, targetFront }) => {
|
||||
await threadFront.detach();
|
||||
Assert.equal(threadFront.state, "detached");
|
||||
const newThreadFront = await targetFront.attachThread({});
|
||||
Assert.notEqual(threadFront, newThreadFront);
|
||||
Assert.equal(newThreadFront.state, "paused");
|
||||
Assert.equal(targetFront.threadFront, newThreadFront);
|
||||
await newThreadFront.resume();
|
||||
})
|
||||
);
|
|
@ -52,7 +52,6 @@ support-files =
|
|||
[test_MemoryActor_saveHeapSnapshot_01.js]
|
||||
[test_MemoryActor_saveHeapSnapshot_02.js]
|
||||
[test_MemoryActor_saveHeapSnapshot_03.js]
|
||||
[test_reattach-thread.js]
|
||||
[test_blackboxing-01.js]
|
||||
[test_blackboxing-02.js]
|
||||
[test_blackboxing-03.js]
|
||||
|
|
|
@ -59,7 +59,6 @@ const threadSpec = generateActorSpec({
|
|||
error: Option(0, "nullable:json"),
|
||||
},
|
||||
resumed: {},
|
||||
detached: {},
|
||||
willInterrupt: {},
|
||||
newSource: {
|
||||
source: Option(0, "json"),
|
||||
|
@ -73,10 +72,6 @@ const threadSpec = generateActorSpec({
|
|||
},
|
||||
response: {},
|
||||
},
|
||||
detach: {
|
||||
request: {},
|
||||
response: {},
|
||||
},
|
||||
reconfigure: {
|
||||
request: {
|
||||
options: Arg(0, "json"),
|
||||
|
|
Загрузка…
Ссылка в новой задаче