content-process.js (1145B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 5 "use strict"; 6 7 /* 8 * Process script that listens for requests to start a `DevToolsServer` for an entire 9 * content process. Loaded into content processes by the main process during 10 * content-process-connector.js' `connectToContentProcess`. 11 * 12 * The actual server startup itself is in a JSM so that code can be cached. 13 */ 14 15 function onInit(message) { 16 // Only reply if we are in a real content process 17 if (Services.appinfo.processType == Services.appinfo.PROCESS_TYPE_CONTENT) { 18 const { initContentProcessTarget } = ChromeUtils.importESModule( 19 "resource://devtools/server/startup/content-process.sys.mjs" 20 ); 21 initContentProcessTarget(message); 22 } 23 } 24 25 function onClose() { 26 removeMessageListener("debug:init-content-server", onInit); 27 removeMessageListener("debug:close-content-server", onClose); 28 } 29 30 addMessageListener("debug:init-content-server", onInit); 31 addMessageListener("debug:close-content-server", onClose);