2017-05-30 00:36:26 +03:00
|
|
|
/* 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";
|
|
|
|
|
2018-03-20 05:28:26 +03:00
|
|
|
/*
|
2020-02-17 13:28:24 +03:00
|
|
|
* Process script that listens for requests to start a `DevToolsServer` for an entire
|
2018-03-20 05:28:26 +03:00
|
|
|
* content process. Loaded into content processes by the main process during
|
2019-08-28 16:07:56 +03:00
|
|
|
* content-process-connector.js' `connectToContentProcess`.
|
2018-03-20 05:28:26 +03:00
|
|
|
*
|
|
|
|
* The actual server startup itself is in a JSM so that code can be cached.
|
|
|
|
*/
|
|
|
|
|
2019-01-17 21:18:31 +03:00
|
|
|
const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
2017-05-30 00:36:26 +03:00
|
|
|
|
|
|
|
function onInit(message) {
|
|
|
|
// Only reply if we are in a real content process
|
|
|
|
if (Services.appinfo.processType == Services.appinfo.PROCESS_TYPE_CONTENT) {
|
2020-10-22 13:02:47 +03:00
|
|
|
const { initContentProcessTarget } = ChromeUtils.import(
|
2019-01-17 21:18:31 +03:00
|
|
|
"resource://devtools/server/startup/content-process.jsm"
|
|
|
|
);
|
2020-10-22 13:02:47 +03:00
|
|
|
initContentProcessTarget(message);
|
2017-05-30 00:36:26 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
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);
|