Files
firefox/devtools/server/startup/content-process.js
T
J. Ryan Stinnett eb6c5c216b Bug 1446222 - Move DevTools content process startup to new dir. r=jdescottes
Move and rename the server's process script (and accompanying JSM) that starts
DevTools for an entire content process from `content-process-debugger-server.js`
to `startup/content-process.js`.  `connectToContent` also becomes the more
specific `connectToContentProcess`.

These code paths will likely change more as Site Isolation work continues, but
for now, we have this light cleanup to gather startup-related paths together.

MozReview-Commit-ID: 1evbZMB8T7r
2018-03-19 21:28:26 -05:00

34 lines
1.2 KiB
JavaScript

/* 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, removeMessageListener */
"use strict";
/*
* Process script that listens for requests to start a `DebuggerServer` for an entire
* content process. Loaded into content processes by the main process during
* `DebuggerServer.connectToContentProcess`.
*
* The actual server startup itself is in a JSM so that code can be cached.
*/
const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm", {});
function onInit(message) {
// Only reply if we are in a real content process
if (Services.appinfo.processType == Services.appinfo.PROCESS_TYPE_CONTENT) {
let {init} = ChromeUtils.import("resource://devtools/server/startup/content-process.jsm", {});
init(message);
}
}
function onClose() {
removeMessageListener("debug:init-content-server", onInit);
removeMessageListener("debug:close-content-server", onClose);
}
addMessageListener("debug:init-content-server", onInit);
addMessageListener("debug:close-content-server", onClose);