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
--- 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')