зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1620248 - [devtools] Ensure destroying ContentProcess target when the target is destroyed before process shutdown. r=nchevobbe,jdescottes
For now, we were emitting the "tabDetached" event on message-manager-close (=process shutdown), or when the DevToolsServerConnection closes (=client closes the connection). But not when the target is being destroyed by the frontend when calling ResourceWatcher.unwatchTargets, which is calling process-helper's destroyTargets. This was introducing test failure (browser_target_list_watchTargets.js) with never resolving RDP requests. Differential Revision: https://phabricator.services.mozilla.com/D91559
This commit is contained in:
Родитель
49c488db1c
Коммит
e1aa84044b
|
@ -595,6 +595,12 @@ function TargetMixin(parentClass) {
|
||||||
_addListeners() {
|
_addListeners() {
|
||||||
this.client.on("closed", this.destroy);
|
this.client.on("closed", this.destroy);
|
||||||
|
|
||||||
|
// `tabDetached` is sent by all target targets types: frame, process and workers.
|
||||||
|
// This is sent when the target is destroyed:
|
||||||
|
// * the target context destroys itself (the tab closes for ex, or the worker shuts down)
|
||||||
|
// in this case, it may be the connector that send this event in the name of the target actor
|
||||||
|
// * the target actor is destroyed, but the target context stays up and running (for ex, when we call Watcher.unwatchTargets)
|
||||||
|
// * the DevToolsServerConnection closes (client closes the connection)
|
||||||
this.on("tabDetached", this.destroy);
|
this.on("tabDetached", this.destroy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -198,6 +198,11 @@ const ContentProcessTargetActor = ActorClassWithSpec(contentProcessTargetSpec, {
|
||||||
if (this.isDestroyed()) {
|
if (this.isDestroyed()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Notify the client that this target is being destroyed.
|
||||||
|
// So that we can destroy the target front and all its children.
|
||||||
|
this.emit("tabDetached");
|
||||||
|
|
||||||
Actor.prototype.destroy.call(this);
|
Actor.prototype.destroy.call(this);
|
||||||
|
|
||||||
// Tell the live lists we aren't watching any more.
|
// Tell the live lists we aren't watching any more.
|
||||||
|
|
Загрузка…
Ссылка в новой задаче