Bug 1459299 - 3. Clear parent process ChromeActor on window closing; r?jryans draft
authorJim Chen <nchen@mozilla.com>
Fri, 11 May 2018 10:25:04 -0400
changeset 794195 defd9f57d8e17c0afa19b5966cacc2cd64bd04f7
parent 794194 059c596960b890623d63414aa8459aceeb895bf5
child 794196 541ec5a4d7be1ecd692650a8ee0844b4c8849c76
push id109606
push userbmo:nchen@mozilla.com
push dateFri, 11 May 2018 14:25:53 +0000
reviewersjryans
bugs1459299
milestone62.0a1
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
devtools/server/actors/root.js
--- 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() };