Bug 1459299 - 3. Clear parent process ChromeActor on window closing; r?jryans
To represent the parent process, we use a ChromeActor/TabActor that
targets a random chrome window. However, if that chrome window later
closes, the ChromeActor will stop working. In that case, we should clear
the cached ChromeActor and create a new one that targets a different
chrome window.
MozReview-Commit-ID: AP8AXEXEgAl
--- a/devtools/server/actors/root.js
+++ b/devtools/server/actors/root.js
@@ -507,16 +507,21 @@ RootActor.prototype = {
}
if (("id" in request) && typeof (request.id) != "number") {
return { error: "wrongParameter",
message: "getProcess requires a valid `id` attribute." };
}
// If the request doesn't contains id parameter or id is 0
// (id == 0, based on onListProcesses implementation)
if ((!("id" in request)) || request.id === 0) {
+ if (this._chromeActor && (!this._chromeActor.docShell ||
+ this._chromeActor.docShell.isBeingDestroyed)) {
+ this._globalActorPool.removeActor(this._chromeActor);
+ this._chromeActor = null;
+ }
if (!this._chromeActor) {
// Create a ChromeActor for the parent process
let { ChromeActor } = require("devtools/server/actors/chrome");
this._chromeActor = new ChromeActor(this.conn);
this._globalActorPool.addActor(this._chromeActor);
}
return { form: this._chromeActor.form() };