Bug 1370925 - Fix missing DebuggingServer.removeContentServerScript. draft
authorLuca Greco <lgreco@mozilla.com>
Wed, 07 Jun 2017 17:27:29 +0200
changeset 590308 6cd6d1665ace6558df6b6181f7c43f002b3d01cb
parent 590258 fb40bcb6155bd1e3ac5468ff4575cce171efbc12
child 632182 e435aa5128caf60988bfb698a875345498026923
push id62694
push userluca.greco@alcacoop.it
push dateWed, 07 Jun 2017 15:41:03 +0000
bugs1370925
milestone55.0a1
Bug 1370925 - Fix missing DebuggingServer.removeContentServerScript. MozReview-Commit-ID: F1elUP3b7OD
devtools/server/main.js
--- a/devtools/server/main.js
+++ b/devtools/server/main.js
@@ -1378,16 +1378,30 @@ var DebuggerServer = {
         for (let connID of Object.getOwnPropertyNames(this._connections)) {
           this._connections[connID].rootActor.removeActorByName(name);
         }
       }
     }
   },
 
   /**
+   * Called when DevTools are unloaded to remove the contend process server script for the
+   * list of scripts loaded for each new content process. Will also remove message
+   * listeners from already loaded scripts.
+   */
+  removeContentServerScript() {
+    Services.ppmm.removeDelayedProcessScript(CONTENT_PROCESS_DBG_SERVER_SCRIPT);
+    try {
+      Services.ppmm.broadcastAsyncMessage("debug:close-content-server");
+    } catch (e) {
+      // Nothing to do
+    }
+  },
+
+  /**
    * Searches all active connections for an actor matching an ID.
    *
    * ⚠ TO BE USED ONLY FROM SERVER CODE OR TESTING ONLY! ⚠`
    *
    * This is helpful for some tests which depend on reaching into the server to check some
    * properties of an actor, and it is also used by the actors related to the
    * DevTools WebExtensions API to be able to interact with the actors created for the
    * panels natively provided by the DevTools Toolbox.