зеркало из https://github.com/mozilla/gecko-dev.git
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 --HG-- rename : devtools/server/content-process-debugger-server.js => devtools/server/startup/content-process.js rename : devtools/server/content-server.jsm => devtools/server/startup/content-process.jsm extra : rebase_source : e077dd3dc915ec274f866d53d3539909f8440de1
This commit is contained in:
Родитель
1c5534b4d8
Коммит
0cee298854
|
@ -524,7 +524,7 @@ RootActor.prototype = {
|
|||
this._parameters.processList.onListChanged = null;
|
||||
},
|
||||
|
||||
onGetProcess: function(request) {
|
||||
async onGetProcess(request) {
|
||||
if (!DebuggerServer.allowChromeProcess) {
|
||||
return { error: "forbidden",
|
||||
message: "You are not allowed to debug chrome." };
|
||||
|
@ -559,10 +559,9 @@ RootActor.prototype = {
|
|||
let onDestroy = () => {
|
||||
this._processActors.delete(id);
|
||||
};
|
||||
return DebuggerServer.connectToContent(this.conn, mm, onDestroy).then(formResult => {
|
||||
this._processActors.set(id, formResult);
|
||||
return { form: formResult };
|
||||
});
|
||||
form = await DebuggerServer.connectToContentProcess(this.conn, mm, onDestroy);
|
||||
this._processActors.set(id, form);
|
||||
return { form };
|
||||
},
|
||||
|
||||
/* This is not in the spec, but it's used by tests. */
|
||||
|
|
|
@ -52,8 +52,8 @@ if (isWorker) {
|
|||
Services.prefs.getBoolPref(VERBOSE_PREF);
|
||||
}
|
||||
|
||||
const CONTENT_PROCESS_DBG_SERVER_SCRIPT =
|
||||
"resource://devtools/server/content-process-debugger-server.js";
|
||||
const CONTENT_PROCESS_SERVER_STARTUP_SCRIPT =
|
||||
"resource://devtools/server/startup/content-process.js";
|
||||
|
||||
function loadSubScript(url) {
|
||||
try {
|
||||
|
@ -127,14 +127,14 @@ function ModuleAPI() {
|
|||
};
|
||||
}
|
||||
|
||||
/** *
|
||||
/**
|
||||
* Public API
|
||||
*/
|
||||
var DebuggerServer = {
|
||||
_listeners: [],
|
||||
_initialized: false,
|
||||
// Flag to check if the content process debugger server script was already loaded.
|
||||
_contentProcessScriptLoaded: false,
|
||||
// Flag to check if the content process server startup script was already loaded.
|
||||
_contentProcessServerStartupScriptLoaded: false,
|
||||
// Map of global actor names to actor constructors provided by extensions.
|
||||
globalActorFactories: {},
|
||||
// Map of tab actor names to actor constructors provided by extensions.
|
||||
|
@ -699,7 +699,11 @@ var DebuggerServer = {
|
|||
return this._onConnection(transport, prefix, true);
|
||||
},
|
||||
|
||||
connectToContent(connection, mm, onDestroy) {
|
||||
/**
|
||||
* Start a DevTools server in a content process (representing the entire process, not
|
||||
* just a single frame) and add it as a child server for an active connection.
|
||||
*/
|
||||
connectToContentProcess(connection, mm, onDestroy) {
|
||||
return new Promise(resolve => {
|
||||
let prefix = connection.allocID("content-process");
|
||||
let actor, childTransport;
|
||||
|
@ -719,21 +723,21 @@ var DebuggerServer = {
|
|||
|
||||
connection.setForwarding(prefix, childTransport);
|
||||
|
||||
dumpn("establishing forwarding for process with prefix " + prefix);
|
||||
dumpn(`Start forwarding for process with prefix ${prefix}`);
|
||||
|
||||
actor = msg.json.actor;
|
||||
|
||||
resolve(actor);
|
||||
});
|
||||
|
||||
// Load the content process debugger server script only once.
|
||||
if (!this._contentProcessScriptLoaded) {
|
||||
// Load the content process server startup script only once.
|
||||
if (!this._contentProcessServerStartupScriptLoaded) {
|
||||
// Load the process script that will receive the debug:init-content-server message
|
||||
Services.ppmm.loadProcessScript(CONTENT_PROCESS_DBG_SERVER_SCRIPT, true);
|
||||
this._contentProcessScriptLoaded = true;
|
||||
Services.ppmm.loadProcessScript(CONTENT_PROCESS_SERVER_STARTUP_SCRIPT, true);
|
||||
this._contentProcessServerStartupScriptLoaded = true;
|
||||
}
|
||||
|
||||
// Send a message to the content process debugger server script to forward it the
|
||||
// Send a message to the content process server startup script to forward it the
|
||||
// prefix.
|
||||
mm.sendAsyncMessage("debug:init-content-server", {
|
||||
prefix: prefix
|
||||
|
@ -1346,12 +1350,12 @@ var DebuggerServer = {
|
|||
},
|
||||
|
||||
/**
|
||||
* Called when DevTools are unloaded to remove the contend process server script for the
|
||||
* list of scripts loaded for each new content process. Will also remove message
|
||||
* Called when DevTools are unloaded to remove the contend process server startup script
|
||||
* for the list of scripts loaded for each new content process. Will also remove message
|
||||
* listeners from already loaded scripts.
|
||||
*/
|
||||
removeContentServerScript() {
|
||||
Services.ppmm.removeDelayedProcessScript(CONTENT_PROCESS_DBG_SERVER_SCRIPT);
|
||||
Services.ppmm.removeDelayedProcessScript(CONTENT_PROCESS_SERVER_STARTUP_SCRIPT);
|
||||
try {
|
||||
Services.ppmm.broadcastAsyncMessage("debug:close-content-server");
|
||||
} catch (e) {
|
||||
|
|
|
@ -18,8 +18,6 @@ MOCHITEST_CHROME_MANIFESTS += ['tests/mochitest/chrome.ini']
|
|||
XPCSHELL_TESTS_MANIFESTS += ['tests/unit/xpcshell.ini']
|
||||
|
||||
DevToolsModules(
|
||||
'content-process-debugger-server.js',
|
||||
'content-server.jsm',
|
||||
'main.js',
|
||||
'service-worker-child.js',
|
||||
'worker.js'
|
||||
|
|
|
@ -6,12 +6,20 @@
|
|||
|
||||
"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/content-server.jsm", {});
|
||||
let {init} = ChromeUtils.import("resource://devtools/server/startup/content-process.jsm", {});
|
||||
init(message);
|
||||
}
|
||||
}
|
|
@ -4,6 +4,14 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
/*
|
||||
* Module that listens for requests to start a `DebuggerServer` for an entire content
|
||||
* process. Loaded into content processes by the main process during
|
||||
* `DebuggerServer.connectToContentProcess` via the process script `content-process.js`.
|
||||
*
|
||||
* The actual server startup itself is in this JSM so that code can be cached.
|
||||
*/
|
||||
|
||||
/* exported init */
|
||||
this.EXPORTED_SYMBOLS = ["init"];
|
||||
|
|
@ -5,5 +5,7 @@
|
|||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
DevToolsModules(
|
||||
'content-process.js',
|
||||
'content-process.jsm',
|
||||
'frame.js',
|
||||
)
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
"constants.js": ["WEAVE_VERSION", "SYNC_API_VERSION", "STORAGE_VERSION", "PREFS_BRANCH", "DEFAULT_KEYBUNDLE_NAME", "SYNC_KEY_ENCODED_LENGTH", "SYNC_KEY_DECODED_LENGTH", "NO_SYNC_NODE_INTERVAL", "MAX_ERROR_COUNT_BEFORE_BACKOFF", "MINIMUM_BACKOFF_INTERVAL", "MAXIMUM_BACKOFF_INTERVAL", "HMAC_EVENT_INTERVAL", "MASTER_PASSWORD_LOCKED_RETRY_INTERVAL", "DEFAULT_GUID_FETCH_BATCH_SIZE", "DEFAULT_DOWNLOAD_BATCH_SIZE", "SINGLE_USER_THRESHOLD", "MULTI_DEVICE_THRESHOLD", "SCORE_INCREMENT_SMALL", "SCORE_INCREMENT_MEDIUM", "SCORE_INCREMENT_XLARGE", "SCORE_UPDATE_DELAY", "IDLE_OBSERVER_BACK_DELAY", "URI_LENGTH_MAX", "MAX_HISTORY_UPLOAD", "MAX_HISTORY_DOWNLOAD", "STATUS_OK", "SYNC_FAILED", "LOGIN_FAILED", "SYNC_FAILED_PARTIAL", "CLIENT_NOT_CONFIGURED", "STATUS_DISABLED", "MASTER_PASSWORD_LOCKED", "LOGIN_SUCCEEDED", "SYNC_SUCCEEDED", "ENGINE_SUCCEEDED", "LOGIN_FAILED_NO_USERNAME", "LOGIN_FAILED_NO_PASSPHRASE", "LOGIN_FAILED_NETWORK_ERROR", "LOGIN_FAILED_SERVER_ERROR", "LOGIN_FAILED_INVALID_PASSPHRASE", "LOGIN_FAILED_LOGIN_REJECTED", "METARECORD_DOWNLOAD_FAIL", "VERSION_OUT_OF_DATE", "CREDENTIALS_CHANGED", "ABORT_SYNC_COMMAND", "NO_SYNC_NODE_FOUND", "OVER_QUOTA", "SERVER_MAINTENANCE", "RESPONSE_OVER_QUOTA", "ENGINE_UPLOAD_FAIL", "ENGINE_DOWNLOAD_FAIL", "ENGINE_UNKNOWN_FAIL", "ENGINE_APPLY_FAIL", "ENGINE_BATCH_INTERRUPTED", "kSyncMasterPasswordLocked", "kSyncWeaveDisabled", "kSyncNetworkOffline", "kSyncBackoffNotMet", "kFirstSyncChoiceNotMade", "kSyncNotConfigured", "kFirefoxShuttingDown", "DEVICE_TYPE_DESKTOP", "DEVICE_TYPE_MOBILE", "SQLITE_MAX_VARIABLE_NUMBER"],
|
||||
"Constants.jsm": ["Roles", "Events", "Relations", "Filters", "States", "Prefilters"],
|
||||
"ContactDB.jsm": ["ContactDB", "DB_NAME", "STORE_NAME", "SAVED_GETALL_STORE_NAME", "REVISION_STORE", "DB_VERSION"],
|
||||
"content-server.jsm": ["init"],
|
||||
"content.jsm": ["registerContentFrame"],
|
||||
"ContentCrashHandlers.jsm": ["TabCrashHandler", "PluginCrashReporter", "UnsubmittedCrashHandler"],
|
||||
"ContentObservers.js": [],
|
||||
|
|
Загрузка…
Ссылка в новой задаче