зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1740292 - [devtools] Remove all notion of "attached" in target actors. r=nchevobbe
This might make the leftover "detach" method a bit more special. But ideally we would get rid of it and convert it to a call to target actor's destroy method. Differential Revision: https://phabricator.services.mozilla.com/D130915
This commit is contained in:
Родитель
841b8e961c
Коммит
71f51e2a2f
|
@ -144,8 +144,8 @@ Observable.prototype = {
|
|||
}
|
||||
this.isObserving = false;
|
||||
|
||||
if (this.targetActor.attached && this.targetActor.docShell) {
|
||||
// It's only worth stopping if the targetActor is still attached
|
||||
if (!this.targetActor.isDestroyed() && this.targetActor.docShell) {
|
||||
// It's only worth stopping if the targetActor is still active
|
||||
this._stopListeners(this.targetActor.windows);
|
||||
}
|
||||
},
|
||||
|
|
|
@ -124,7 +124,7 @@ Object.defineProperty(parentProcessTargetPrototype, "docShells", {
|
|||
|
||||
parentProcessTargetPrototype.observe = function(subject, topic, data) {
|
||||
WindowGlobalTargetActor.prototype.observe.call(this, subject, topic, data);
|
||||
if (!this.attached) {
|
||||
if (this.isDestroyed()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -138,7 +138,7 @@ parentProcessTargetPrototype.observe = function(subject, topic, data) {
|
|||
};
|
||||
|
||||
parentProcessTargetPrototype._detach = function() {
|
||||
if (!this.attached) {
|
||||
if (this.isDestroyed()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -234,8 +234,8 @@ webExtensionTargetPrototype._onDocShellDestroy = function(docShell) {
|
|||
this._notifyDocShellDestroy(webProgress);
|
||||
|
||||
// If the destroyed docShell was the current docShell and the actor is
|
||||
// currently attached, switch to the fallback window
|
||||
if (this.attached && docShell == this.docShell) {
|
||||
// not destroyed, switch to the fallback window
|
||||
if (!this.isDestroyed() && docShell == this.docShell) {
|
||||
this._changeTopLevelDocument(this._searchForExtensionWindow());
|
||||
}
|
||||
};
|
||||
|
|
|
@ -338,8 +338,6 @@ const windowGlobalTargetPrototype = {
|
|||
// (This is also probably meant to disappear once EFT is the only supported codepath)
|
||||
this._docShellsObserved = false;
|
||||
DevToolsUtils.executeSoon(() => this._watchDocshells());
|
||||
|
||||
this._attached = true;
|
||||
},
|
||||
|
||||
// Optional console API listener options (e.g. used by the WebExtensionActor to
|
||||
|
@ -352,10 +350,6 @@ const windowGlobalTargetPrototype = {
|
|||
return true;
|
||||
},
|
||||
|
||||
get attached() {
|
||||
return !!this._attached;
|
||||
},
|
||||
|
||||
/*
|
||||
* Return a Debugger instance or create one if there is none yet
|
||||
*/
|
||||
|
@ -663,10 +657,8 @@ const windowGlobalTargetPrototype = {
|
|||
}
|
||||
// Tell the thread actor that the window global is closed, so that it may terminate
|
||||
// instead of resuming the debuggee script.
|
||||
if (this._attached) {
|
||||
// TODO: Bug 997119: Remove this coupling with thread actor
|
||||
this.threadActor._parentClosed = true;
|
||||
}
|
||||
// TODO: Bug 997119: Remove this coupling with thread actor
|
||||
this.threadActor._parentClosed = true;
|
||||
|
||||
if (this._touchSimulator) {
|
||||
this._touchSimulator.stop();
|
||||
|
@ -806,12 +798,6 @@ const windowGlobalTargetPrototype = {
|
|||
},
|
||||
|
||||
listWorkers(request) {
|
||||
if (!this.attached) {
|
||||
throw {
|
||||
error: "wrongState",
|
||||
};
|
||||
}
|
||||
|
||||
return this.ensureWorkerDescriptorActorList()
|
||||
.getList()
|
||||
.then(actors => {
|
||||
|
@ -882,7 +868,7 @@ const windowGlobalTargetPrototype = {
|
|||
observe(subject, topic, data) {
|
||||
// Ignore any event that comes before/after the actor is attached.
|
||||
// That typically happens during Firefox shutdown.
|
||||
if (!this.attached) {
|
||||
if (this.isDestroyed()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1090,7 +1076,7 @@ const windowGlobalTargetPrototype = {
|
|||
* @returns false if the actor wasn't attached or true of detaching succeeds.
|
||||
*/
|
||||
_detach({ isTargetSwitching } = {}) {
|
||||
if (!this.attached) {
|
||||
if (this.isDestroyed()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1133,8 +1119,6 @@ const windowGlobalTargetPrototype = {
|
|||
this._dbg = null;
|
||||
}
|
||||
|
||||
this._attached = false;
|
||||
|
||||
// When the target actor acts as a WindowGlobalTarget, the actor will be destroyed
|
||||
// without having to send an RDP event. The parent process will receive a window-global-destroyed
|
||||
// and report the target actor as destroyed via the Watcher actor.
|
||||
|
@ -1428,9 +1412,9 @@ const windowGlobalTargetPrototype = {
|
|||
this._setWindow(window);
|
||||
|
||||
DevToolsUtils.executeSoon(() => {
|
||||
// No need to do anything more if the actor is not attached anymore
|
||||
// No need to do anything more if the actor is destroyed.
|
||||
// e.g. the client has been closed and the actors destroyed in the meantime.
|
||||
if (!this.attached) {
|
||||
if (this.isDestroyed()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1822,7 +1806,7 @@ DebuggerProgressListener.prototype = {
|
|||
},
|
||||
|
||||
onWindowCreated: DevToolsUtils.makeInfallible(function(evt) {
|
||||
if (!this._targetActor.attached) {
|
||||
if (this._targetActor.isDestroyed()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1860,7 +1844,7 @@ DebuggerProgressListener.prototype = {
|
|||
}, "DebuggerProgressListener.prototype.onWindowCreated"),
|
||||
|
||||
onWindowHidden: DevToolsUtils.makeInfallible(function(evt) {
|
||||
if (!this._targetActor.attached) {
|
||||
if (this._targetActor.isDestroyed()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1890,7 +1874,7 @@ DebuggerProgressListener.prototype = {
|
|||
}, "DebuggerProgressListener.prototype.onWindowHidden"),
|
||||
|
||||
observe: DevToolsUtils.makeInfallible(function(subject, topic) {
|
||||
if (!this._targetActor.attached) {
|
||||
if (this._targetActor.isDestroyed()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1927,7 +1911,7 @@ DebuggerProgressListener.prototype = {
|
|||
flag,
|
||||
status
|
||||
) {
|
||||
if (!this._targetActor.attached) {
|
||||
if (this._targetActor.isDestroyed()) {
|
||||
return;
|
||||
}
|
||||
progress.QueryInterface(Ci.nsIDocShell);
|
||||
|
|
Загрузка…
Ссылка в новой задаче