Bug 1446222 - Move DevTools service worker control script to worker actor dir. r=jdescottes draft
authorJ. Ryan Stinnett <jryans@gmail.com>
Mon, 19 Mar 2018 21:53:24 -0500
changeset 770149 ac798c62f0813110a1d0d21ab99dc96b7c4bbf99
parent 770148 3fcaeac7182d53cd7abfaa44eb31b9e12d88587f
child 770150 c8a6f9b9172598016637f49d450d37d728286393
push id103347
push userbmo:jryans@gmail.com
push dateTue, 20 Mar 2018 20:50:57 +0000
reviewersjdescottes
bugs1446222
milestone61.0a1
Bug 1446222 - Move DevTools service worker control script to worker actor dir. r=jdescottes The `service-worker-child.js` process script is used by actors to control service workers as needed. This moves it to helper directory near the actors that make use of it. MozReview-Commit-ID: LIq1zcU6fBc
devtools/server/actors/moz.build
devtools/server/actors/worker.js
devtools/server/actors/worker/moz.build
devtools/server/actors/worker/service-worker-process.js
devtools/server/moz.build
devtools/server/service-worker-child.js
--- a/devtools/server/actors/moz.build
+++ b/devtools/server/actors/moz.build
@@ -6,16 +6,17 @@
 
 DIRS += [
     'canvas',
     'emulation',
     'highlighters',
     'inspector',
     'utils',
     'webconsole',
+    'worker',
 ]
 
 DevToolsModules(
     'accessibility-parent.js',
     'accessibility.js',
     'actor-registry.js',
     'addon.js',
     'addons.js',
--- a/devtools/server/actors/worker.js
+++ b/devtools/server/actors/worker.js
@@ -237,17 +237,17 @@ let ServiceWorkerActor = protocol.ActorC
   },
 
   destroy() {
     protocol.Actor.prototype.destroy.call(this);
     this._worker = null;
   },
 });
 
-// Lazily load the service-worker-child.js process script only once.
+// Lazily load the service-worker-process.js process script only once.
 let _serviceWorkerProcessScriptLoaded = false;
 
 let ServiceWorkerRegistrationActor =
 protocol.ActorClassWithSpec(serviceWorkerRegistrationSpec, {
   /**
    * Create the ServiceWorkerRegistrationActor
    * @param DebuggerServerConnection conn
    *   The server connection.
@@ -346,17 +346,17 @@ protocol.ActorClassWithSpec(serviceWorke
         this.emit("push-subscription-modified");
         break;
     }
   },
 
   start() {
     if (!_serviceWorkerProcessScriptLoaded) {
       Services.ppmm.loadProcessScript(
-        "resource://devtools/server/service-worker-child.js", true);
+        "resource://devtools/server/actors/worker/service-worker-process.js", true);
       _serviceWorkerProcessScriptLoaded = true;
     }
 
     // XXX: Send the permissions down to the content process before starting
     // the service worker within the content process. As we don't know what
     // content process we're starting the service worker in (as we're using a
     // broadcast channel to talk to it), we just broadcast the permissions to
     // everyone as well.
new file mode 100644
--- /dev/null
+++ b/devtools/server/actors/worker/moz.build
@@ -0,0 +1,9 @@
+# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+DevToolsModules(
+    'service-worker-process.js',
+)
rename from devtools/server/service-worker-child.js
rename to devtools/server/actors/worker/service-worker-process.js
--- a/devtools/server/service-worker-child.js
+++ b/devtools/server/actors/worker/service-worker-process.js
@@ -1,16 +1,21 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /* global addMessageListener */
 
 "use strict";
 
+/*
+ * Process script used to control service workers via a DevTools actor.
+ * Loaded into content processes by the service worker actors.
+ */
+
 let swm = Cc["@mozilla.org/serviceworkers/manager;1"]
   .getService(Ci.nsIServiceWorkerManager);
 
 addMessageListener("serviceWorkerRegistration:start", message => {
   let { data } = message;
   let array = swm.getAllRegistrations();
 
   // Find the service worker registration with the desired scope.
--- a/devtools/server/moz.build
+++ b/devtools/server/moz.build
@@ -14,14 +14,13 @@ DIRS += [
 ]
 
 BROWSER_CHROME_MANIFESTS += ['tests/browser/browser.ini']
 MOCHITEST_CHROME_MANIFESTS += ['tests/mochitest/chrome.ini']
 XPCSHELL_TESTS_MANIFESTS += ['tests/unit/xpcshell.ini']
 
 DevToolsModules(
     'main.js',
-    'service-worker-child.js',
     'worker.js'
 )
 
 with Files('**'):
     BUG_COMPONENT = ('Firefox', 'Developer Tools')