mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-10 09:19:28 +00:00
Bug 1397295 - Use environment variables instead of query string for params to Browser Toolbox;r=jryans
This allows data like screen position to be persisted in the xul store for the document MozReview-Commit-ID: 4vdbkneckXh --HG-- extra : rebase_source : b8ae9f50bcbd152e9ee9d9462a81a56661da40cb
This commit is contained in:
parent
d2df571ab4
commit
9d3ff53d29
@ -249,18 +249,22 @@ BrowserToolboxProcess.prototype = {
|
||||
|
||||
let command = Services.dirsvc.get("XREExeF", Ci.nsIFile).path;
|
||||
|
||||
let xulURI = `${DBG_XUL}?port=${this.port}`;
|
||||
if (this._options.addonID) {
|
||||
xulURI += `&addonID=${this._options.addonID}`;
|
||||
}
|
||||
|
||||
dumpn("Running chrome debugging process.");
|
||||
let args = [
|
||||
"-no-remote",
|
||||
"-foreground",
|
||||
"-profile", this._dbgProfilePath,
|
||||
"-chrome", xulURI
|
||||
"-chrome", DBG_XUL
|
||||
];
|
||||
let environment = {
|
||||
// Disable safe mode for the new process in case this was opened via the
|
||||
// keyboard shortcut.
|
||||
MOZ_DISABLE_SAFE_MODE_KEY: "1",
|
||||
MOZ_BROWSER_TOOLBOX_PORT: String(this.port),
|
||||
};
|
||||
if (this._options.addonID) {
|
||||
environment.MOZ_BROWSER_TOOLBOX_ADDONID = String(this._options.addonID);
|
||||
}
|
||||
|
||||
// During local development, incremental builds can trigger the main process
|
||||
// to clear its startup cache with the "flag file" .purgecaches, but this
|
||||
@ -278,11 +282,7 @@ BrowserToolboxProcess.prototype = {
|
||||
arguments: args,
|
||||
environmentAppend: true,
|
||||
stderr: "stdout",
|
||||
environment: {
|
||||
// Disable safe mode for the new process in case this was opened via the
|
||||
// keyboard shortcut.
|
||||
MOZ_DISABLE_SAFE_MODE_KEY: "1",
|
||||
},
|
||||
environment,
|
||||
}).then(proc => {
|
||||
this._dbgProcess = proc;
|
||||
|
||||
|
@ -34,22 +34,25 @@ var connect = Task.async(function* () {
|
||||
window.removeEventListener("load", connect);
|
||||
|
||||
// Initiate the connection
|
||||
const params = new URLSearchParams(window.location.search);
|
||||
let env = Components.classes["@mozilla.org/process/environment;1"]
|
||||
.getService(Components.interfaces.nsIEnvironment);
|
||||
let port = env.get("MOZ_BROWSER_TOOLBOX_PORT");
|
||||
let addonID = env.get("MOZ_BROWSER_TOOLBOX_ADDONID");
|
||||
|
||||
// A port needs to be passed in from the query string, for instance:
|
||||
// `./mach run -chrome chrome://devtools/content/framework/toolbox-process-window.xul?port=6080`
|
||||
if (!params.get("port")) {
|
||||
throw new Error("Must specify a port on the query string");
|
||||
// A port needs to be passed in from the environment, for instance:
|
||||
// MOZ_BROWSER_TOOLBOX_PORT=6080 ./mach run -chrome \
|
||||
// chrome://devtools/content/framework/toolbox-process-window.xul
|
||||
if (!port) {
|
||||
throw new Error("Must pass a port in an env variable with MOZ_BROWSER_TOOLBOX_PORT");
|
||||
}
|
||||
|
||||
let transport = yield DebuggerClient.socketConnect({
|
||||
host: Prefs.chromeDebuggingHost,
|
||||
port: params.get("port"),
|
||||
port,
|
||||
webSocket: Prefs.chromeDebuggingWebSocket,
|
||||
});
|
||||
gClient = new DebuggerClient(transport);
|
||||
yield gClient.connect();
|
||||
let addonID = params.get("addonID");
|
||||
|
||||
if (addonID) {
|
||||
let { addons } = yield gClient.listAddons();
|
||||
|
Loading…
x
Reference in New Issue
Block a user