forked from mirrors/gecko-dev
Bug 1275078 - Fix ESLint issues in toolbox and target files. r=ochameau
MozReview-Commit-ID: 8SoQ2JnTib3 --HG-- extra : rebase_source : 2e987c465c21150265b1d1f1a3a218e71db9bcae
This commit is contained in:
parent
c396116b69
commit
9896e105b8
9 changed files with 102 additions and 93 deletions
|
|
@ -82,7 +82,8 @@ devtools/client/commandline/**
|
||||||
devtools/client/debugger/**
|
devtools/client/debugger/**
|
||||||
devtools/client/framework/**
|
devtools/client/framework/**
|
||||||
!devtools/client/framework/selection.js
|
!devtools/client/framework/selection.js
|
||||||
!devtools/client/framework/toolbox.js
|
!devtools/client/framework/target*
|
||||||
|
!devtools/client/framework/toolbox*
|
||||||
devtools/client/netmonitor/test/**
|
devtools/client/netmonitor/test/**
|
||||||
devtools/client/netmonitor/har/test/**
|
devtools/client/netmonitor/har/test/**
|
||||||
devtools/client/projecteditor/**
|
devtools/client/projecteditor/**
|
||||||
|
|
|
||||||
|
|
@ -30,14 +30,14 @@ var processes = new Set();
|
||||||
/**
|
/**
|
||||||
* Constructor for creating a process that will hold a chrome toolbox.
|
* Constructor for creating a process that will hold a chrome toolbox.
|
||||||
*
|
*
|
||||||
* @param function aOnClose [optional]
|
* @param function onClose [optional]
|
||||||
* A function called when the process stops running.
|
* A function called when the process stops running.
|
||||||
* @param function aOnRun [optional]
|
* @param function onRun [optional]
|
||||||
* A function called when the process starts running.
|
* A function called when the process starts running.
|
||||||
* @param object aOptions [optional]
|
* @param object options [optional]
|
||||||
* An object with properties for configuring BrowserToolboxProcess.
|
* An object with properties for configuring BrowserToolboxProcess.
|
||||||
*/
|
*/
|
||||||
this.BrowserToolboxProcess = function BrowserToolboxProcess(aOnClose, aOnRun, aOptions) {
|
this.BrowserToolboxProcess = function BrowserToolboxProcess(onClose, onRun, options) {
|
||||||
let emitter = new EventEmitter();
|
let emitter = new EventEmitter();
|
||||||
this.on = emitter.on.bind(emitter);
|
this.on = emitter.on.bind(emitter);
|
||||||
this.off = emitter.off.bind(emitter);
|
this.off = emitter.off.bind(emitter);
|
||||||
|
|
@ -50,22 +50,22 @@ this.BrowserToolboxProcess = function BrowserToolboxProcess(aOnClose, aOnRun, aO
|
||||||
|
|
||||||
// If first argument is an object, use those properties instead of
|
// If first argument is an object, use those properties instead of
|
||||||
// all three arguments
|
// all three arguments
|
||||||
if (typeof aOnClose === "object") {
|
if (typeof onClose === "object") {
|
||||||
if (aOnClose.onClose) {
|
if (onClose.onClose) {
|
||||||
this.once("close", aOnClose.onClose);
|
this.once("close", onClose.onClose);
|
||||||
}
|
}
|
||||||
if (aOnClose.onRun) {
|
if (onClose.onRun) {
|
||||||
this.once("run", aOnClose.onRun);
|
this.once("run", onClose.onRun);
|
||||||
}
|
}
|
||||||
this._options = aOnClose;
|
this._options = onClose;
|
||||||
} else {
|
} else {
|
||||||
if (aOnClose) {
|
if (onClose) {
|
||||||
this.once("close", aOnClose);
|
this.once("close", onClose);
|
||||||
}
|
}
|
||||||
if (aOnRun) {
|
if (onRun) {
|
||||||
this.once("run", aOnRun);
|
this.once("run", onRun);
|
||||||
}
|
}
|
||||||
this._options = aOptions || {};
|
this._options = options || {};
|
||||||
}
|
}
|
||||||
|
|
||||||
this._telemetry = new Telemetry();
|
this._telemetry = new Telemetry();
|
||||||
|
|
@ -85,24 +85,24 @@ EventEmitter.decorate(BrowserToolboxProcess);
|
||||||
* Initializes and starts a chrome toolbox process.
|
* Initializes and starts a chrome toolbox process.
|
||||||
* @return object
|
* @return object
|
||||||
*/
|
*/
|
||||||
BrowserToolboxProcess.init = function (aOnClose, aOnRun, aOptions) {
|
BrowserToolboxProcess.init = function (onClose, onRun, options) {
|
||||||
return new BrowserToolboxProcess(aOnClose, aOnRun, aOptions);
|
return new BrowserToolboxProcess(onClose, onRun, options);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Passes a set of options to the BrowserAddonActors for the given ID.
|
* Passes a set of options to the BrowserAddonActors for the given ID.
|
||||||
*
|
*
|
||||||
* @param aId string
|
* @param id string
|
||||||
* The ID of the add-on to pass the options to
|
* The ID of the add-on to pass the options to
|
||||||
* @param aOptions object
|
* @param options object
|
||||||
* The options.
|
* The options.
|
||||||
* @return a promise that will be resolved when complete.
|
* @return a promise that will be resolved when complete.
|
||||||
*/
|
*/
|
||||||
BrowserToolboxProcess.setAddonOptions = function DSC_setAddonOptions(aId, aOptions) {
|
BrowserToolboxProcess.setAddonOptions = function (id, options) {
|
||||||
let promises = [];
|
let promises = [];
|
||||||
|
|
||||||
for (let process of processes.values()) {
|
for (let process of processes.values()) {
|
||||||
promises.push(process.debuggerServer.setAddonOptions(aId, aOptions));
|
promises.push(process.debuggerServer.setAddonOptions(id, options));
|
||||||
}
|
}
|
||||||
|
|
||||||
return promise.all(promises);
|
return promise.all(promises);
|
||||||
|
|
@ -190,7 +190,8 @@ BrowserToolboxProcess.prototype = {
|
||||||
// always works:
|
// always works:
|
||||||
Services.prefs.savePrefFile(prefsFile);
|
Services.prefs.savePrefFile(prefsFile);
|
||||||
|
|
||||||
dumpn("Finished creating the chrome toolbox user profile at: " + this._dbgProfilePath);
|
dumpn("Finished creating the chrome toolbox user profile at: " +
|
||||||
|
this._dbgProfilePath);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -198,7 +199,8 @@ BrowserToolboxProcess.prototype = {
|
||||||
*/
|
*/
|
||||||
_create: function () {
|
_create: function () {
|
||||||
dumpn("Initializing chrome debugging process.");
|
dumpn("Initializing chrome debugging process.");
|
||||||
let process = this._dbgProcess = Cc["@mozilla.org/process/util;1"].createInstance(Ci.nsIProcess);
|
let process = Cc["@mozilla.org/process/util;1"].createInstance(Ci.nsIProcess);
|
||||||
|
this._dbgProcess = process;
|
||||||
process.init(Services.dirsvc.get("XREExeF", Ci.nsIFile));
|
process.init(Services.dirsvc.get("XREExeF", Ci.nsIFile));
|
||||||
|
|
||||||
let xulURI = DBG_XUL;
|
let xulURI = DBG_XUL;
|
||||||
|
|
@ -208,7 +210,12 @@ BrowserToolboxProcess.prototype = {
|
||||||
}
|
}
|
||||||
|
|
||||||
dumpn("Running chrome debugging process.");
|
dumpn("Running chrome debugging process.");
|
||||||
let args = ["-no-remote", "-foreground", "-profile", this._dbgProfilePath, "-chrome", xulURI];
|
let args = [
|
||||||
|
"-no-remote",
|
||||||
|
"-foreground",
|
||||||
|
"-profile", this._dbgProfilePath,
|
||||||
|
"-chrome", xulURI
|
||||||
|
];
|
||||||
|
|
||||||
// During local development, incremental builds can trigger the main process
|
// During local development, incremental builds can trigger the main process
|
||||||
// to clear its startup cache with the "flag file" .purgecaches, but this
|
// to clear its startup cache with the "flag file" .purgecaches, but this
|
||||||
|
|
@ -223,7 +230,8 @@ BrowserToolboxProcess.prototype = {
|
||||||
|
|
||||||
// Disable safe mode for the new process in case this was opened via the
|
// Disable safe mode for the new process in case this was opened via the
|
||||||
// keyboard shortcut.
|
// keyboard shortcut.
|
||||||
let nsIEnvironment = Components.classes["@mozilla.org/process/environment;1"].getService(Components.interfaces.nsIEnvironment);
|
let nsIEnvironment = Cc["@mozilla.org/process/environment;1"]
|
||||||
|
.getService(Ci.nsIEnvironment);
|
||||||
let originalValue = nsIEnvironment.get("MOZ_DISABLE_SAFE_MODE_KEY");
|
let originalValue = nsIEnvironment.get("MOZ_DISABLE_SAFE_MODE_KEY");
|
||||||
nsIEnvironment.set("MOZ_DISABLE_SAFE_MODE_KEY", "1");
|
nsIEnvironment.set("MOZ_DISABLE_SAFE_MODE_KEY", "1");
|
||||||
|
|
||||||
|
|
@ -288,7 +296,9 @@ function dumpn(str) {
|
||||||
var wantLogging = Services.prefs.getBoolPref("devtools.debugger.log");
|
var wantLogging = Services.prefs.getBoolPref("devtools.debugger.log");
|
||||||
|
|
||||||
Services.prefs.addObserver("devtools.debugger.log", {
|
Services.prefs.addObserver("devtools.debugger.log", {
|
||||||
observe: (...args) => wantLogging = Services.prefs.getBoolPref(args.pop())
|
observe: (...args) => {
|
||||||
|
wantLogging = Services.prefs.getBoolPref(args.pop());
|
||||||
|
}
|
||||||
}, false);
|
}, false);
|
||||||
|
|
||||||
Services.obs.notifyObservers(null, "ToolboxProcessLoaded", null);
|
Services.obs.notifyObservers(null, "ToolboxProcessLoaded", null);
|
||||||
|
|
|
||||||
|
|
@ -62,16 +62,16 @@ exports.targetFromURL = Task.async(function* (url) {
|
||||||
let form, isTabActor;
|
let form, isTabActor;
|
||||||
if (type === "tab") {
|
if (type === "tab") {
|
||||||
// Fetch target for a remote tab
|
// Fetch target for a remote tab
|
||||||
id = parseInt(id);
|
id = parseInt(id, 10);
|
||||||
if (isNaN(id)) {
|
if (isNaN(id)) {
|
||||||
throw new Error("targetFromURL, wrong tab id:'" + id + "', should be a number");
|
throw new Error(`targetFromURL, wrong tab id '${id}', should be a number`);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
let response = yield client.getTab({ outerWindowID: id });
|
let response = yield client.getTab({ outerWindowID: id });
|
||||||
form = response.tab;
|
form = response.tab;
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
if (ex.error == "noTab") {
|
if (ex.error == "noTab") {
|
||||||
throw new Error("targetFromURL, tab with outerWindowID:'" + id + "' doesn't exist");
|
throw new Error(`targetFromURL, tab with outerWindowID '${id}' doesn't exist`);
|
||||||
}
|
}
|
||||||
throw ex;
|
throw ex;
|
||||||
}
|
}
|
||||||
|
|
@ -79,7 +79,7 @@ exports.targetFromURL = Task.async(function* (url) {
|
||||||
// Fetch target for a remote chrome actor
|
// Fetch target for a remote chrome actor
|
||||||
DebuggerServer.allowChromeProcess = true;
|
DebuggerServer.allowChromeProcess = true;
|
||||||
try {
|
try {
|
||||||
id = parseInt(id);
|
id = parseInt(id, 10);
|
||||||
if (isNaN(id)) {
|
if (isNaN(id)) {
|
||||||
id = 0;
|
id = 0;
|
||||||
}
|
}
|
||||||
|
|
@ -92,7 +92,7 @@ exports.targetFromURL = Task.async(function* (url) {
|
||||||
}
|
}
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
if (ex.error == "noProcess") {
|
if (ex.error == "noProcess") {
|
||||||
throw new Error("targetFromURL, process with id:'" + id + "' doesn't exist");
|
throw new Error(`targetFromURL, process with id '${id}' doesn't exist`);
|
||||||
}
|
}
|
||||||
throw ex;
|
throw ex;
|
||||||
}
|
}
|
||||||
|
|
@ -111,13 +111,12 @@ exports.targetFromURL = Task.async(function* (url) {
|
||||||
chrome = true;
|
chrome = true;
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
if (ex.error == "notFound") {
|
if (ex.error == "notFound") {
|
||||||
throw new Error(`targetFromURL, window with id:'${id}' ` +
|
throw new Error(`targetFromURL, window with id '${id}' doesn't exist`);
|
||||||
"doesn't exist");
|
|
||||||
}
|
}
|
||||||
throw ex;
|
throw ex;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new Error("targetFromURL, unsupported type='" + type + "' parameter");
|
throw new Error(`targetFromURL, unsupported type '${type}' parameter`);
|
||||||
}
|
}
|
||||||
|
|
||||||
return TargetFactory.forRemoteTab({ client, form, chrome, isTabActor });
|
return TargetFactory.forRemoteTab({ client, form, chrome, isTabActor });
|
||||||
|
|
@ -137,7 +136,7 @@ function* createClient(params) {
|
||||||
DebuggerServer.init();
|
DebuggerServer.init();
|
||||||
DebuggerServer.addBrowserActors();
|
DebuggerServer.addBrowserActors();
|
||||||
}
|
}
|
||||||
transport = DebuggerServer.connectPipe()
|
transport = DebuggerServer.connectPipe();
|
||||||
}
|
}
|
||||||
return new DebuggerClient(transport);
|
return new DebuggerClient(transport);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const { Ci } = require("chrome");
|
const { Ci } = require("chrome");
|
||||||
const promise = require("promise");
|
|
||||||
const defer = require("devtools/shared/defer");
|
const defer = require("devtools/shared/defer");
|
||||||
const EventEmitter = require("devtools/shared/event-emitter");
|
const EventEmitter = require("devtools/shared/event-emitter");
|
||||||
const Services = require("Services");
|
const Services = require("Services");
|
||||||
|
|
@ -486,30 +485,30 @@ TabTarget.prototype = {
|
||||||
_setupRemoteListeners: function () {
|
_setupRemoteListeners: function () {
|
||||||
this.client.addListener("closed", this.destroy);
|
this.client.addListener("closed", this.destroy);
|
||||||
|
|
||||||
this._onTabDetached = (aType, aPacket) => {
|
this._onTabDetached = (type, packet) => {
|
||||||
// We have to filter message to ensure that this detach is for this tab
|
// We have to filter message to ensure that this detach is for this tab
|
||||||
if (aPacket.from == this._form.actor) {
|
if (packet.from == this._form.actor) {
|
||||||
this.destroy();
|
this.destroy();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
this.client.addListener("tabDetached", this._onTabDetached);
|
this.client.addListener("tabDetached", this._onTabDetached);
|
||||||
|
|
||||||
this._onTabNavigated = (aType, aPacket) => {
|
this._onTabNavigated = (type, packet) => {
|
||||||
let event = Object.create(null);
|
let event = Object.create(null);
|
||||||
event.url = aPacket.url;
|
event.url = packet.url;
|
||||||
event.title = aPacket.title;
|
event.title = packet.title;
|
||||||
event.nativeConsoleAPI = aPacket.nativeConsoleAPI;
|
event.nativeConsoleAPI = packet.nativeConsoleAPI;
|
||||||
event.isFrameSwitching = aPacket.isFrameSwitching;
|
event.isFrameSwitching = packet.isFrameSwitching;
|
||||||
|
|
||||||
if (!aPacket.isFrameSwitching) {
|
if (!packet.isFrameSwitching) {
|
||||||
// Update the title and url unless this is a frame switch.
|
// Update the title and url unless this is a frame switch.
|
||||||
this._url = aPacket.url;
|
this._url = packet.url;
|
||||||
this._title = aPacket.title;
|
this._title = packet.title;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send any stored event payload (DOMWindow or nsIRequest) for backwards
|
// Send any stored event payload (DOMWindow or nsIRequest) for backwards
|
||||||
// compatibility with non-remotable tools.
|
// compatibility with non-remotable tools.
|
||||||
if (aPacket.state == "start") {
|
if (packet.state == "start") {
|
||||||
event._navPayload = this._navRequest;
|
event._navPayload = this._navRequest;
|
||||||
this.emit("will-navigate", event);
|
this.emit("will-navigate", event);
|
||||||
this._navRequest = null;
|
this._navRequest = null;
|
||||||
|
|
@ -521,8 +520,8 @@ TabTarget.prototype = {
|
||||||
};
|
};
|
||||||
this.client.addListener("tabNavigated", this._onTabNavigated);
|
this.client.addListener("tabNavigated", this._onTabNavigated);
|
||||||
|
|
||||||
this._onFrameUpdate = (aType, aPacket) => {
|
this._onFrameUpdate = (type, packet) => {
|
||||||
this.emit("frame-update", aPacket);
|
this.emit("frame-update", packet);
|
||||||
};
|
};
|
||||||
this.client.addListener("frameUpdate", this._onFrameUpdate);
|
this.client.addListener("frameUpdate", this._onFrameUpdate);
|
||||||
|
|
||||||
|
|
@ -565,9 +564,11 @@ TabTarget.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// Automatically respawn the toolbox when the tab changes between being
|
/**
|
||||||
// loaded within the parent process and loaded from a content process.
|
* Automatically respawn the toolbox when the tab changes between being
|
||||||
// Process change can go in both ways.
|
* loaded within the parent process and loaded from a content process.
|
||||||
|
* Process change can go in both ways.
|
||||||
|
*/
|
||||||
onRemotenessChange: function () {
|
onRemotenessChange: function () {
|
||||||
// Responsive design do a crazy dance around tabs and triggers
|
// Responsive design do a crazy dance around tabs and triggers
|
||||||
// remotenesschange events. But we should ignore them as at the end
|
// remotenesschange events. But we should ignore them as at the end
|
||||||
|
|
@ -687,11 +688,11 @@ TabTarget.prototype = {
|
||||||
/**
|
/**
|
||||||
* WebProgressListener for TabTarget.
|
* WebProgressListener for TabTarget.
|
||||||
*
|
*
|
||||||
* @param object aTarget
|
* @param object target
|
||||||
* The TabTarget instance to work with.
|
* The TabTarget instance to work with.
|
||||||
*/
|
*/
|
||||||
function TabWebProgressListener(aTarget) {
|
function TabWebProgressListener(target) {
|
||||||
this.target = aTarget;
|
this.target = target;
|
||||||
}
|
}
|
||||||
|
|
||||||
TabWebProgressListener.prototype = {
|
TabWebProgressListener.prototype = {
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ add_task(function* () {
|
||||||
yield targetFromURL(new URL("http://foo?type=x"));
|
yield targetFromURL(new URL("http://foo?type=x"));
|
||||||
ok(false, "Shouldn't pass");
|
ok(false, "Shouldn't pass");
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
is(e.message, "targetFromURL, unsupported type='x' parameter");
|
is(e.message, "targetFromURL, unsupported type 'x' parameter");
|
||||||
}
|
}
|
||||||
|
|
||||||
info("Test browser window");
|
info("Test browser window");
|
||||||
|
|
@ -61,7 +61,7 @@ add_task(function* () {
|
||||||
yield targetFromURL(new URL("http://foo?type=tab&id=10000"));
|
yield targetFromURL(new URL("http://foo?type=tab&id=10000"));
|
||||||
ok(false, "Shouldn't pass");
|
ok(false, "Shouldn't pass");
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
is(e.message, "targetFromURL, tab with outerWindowID:'10000' doesn't exist");
|
is(e.message, "targetFromURL, tab with outerWindowID '10000' doesn't exist");
|
||||||
}
|
}
|
||||||
|
|
||||||
info("Test parent process");
|
info("Test parent process");
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
|
||||||
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
|
|
||||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
/* 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
|
* 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/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
@ -33,7 +31,6 @@ const flags = require("devtools/shared/flags");
|
||||||
exports.getHighlighterUtils = function (toolbox) {
|
exports.getHighlighterUtils = function (toolbox) {
|
||||||
if (!toolbox || !toolbox.target) {
|
if (!toolbox || !toolbox.target) {
|
||||||
throw new Error("Missing or invalid toolbox passed to getHighlighterUtils");
|
throw new Error("Missing or invalid toolbox passed to getHighlighterUtils");
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Exported API properties will go here
|
// Exported API properties will go here
|
||||||
|
|
@ -97,12 +94,11 @@ exports.getHighlighterUtils = function (toolbox) {
|
||||||
* activated.
|
* activated.
|
||||||
* @return A promise that resolves when done
|
* @return A promise that resolves when done
|
||||||
*/
|
*/
|
||||||
let togglePicker = exported.togglePicker = function (doFocus) {
|
exported.togglePicker = function (doFocus) {
|
||||||
if (isPicking) {
|
if (isPicking) {
|
||||||
return cancelPicker();
|
return cancelPicker();
|
||||||
} else {
|
|
||||||
return startPicker(doFocus);
|
|
||||||
}
|
}
|
||||||
|
return startPicker(doFocus);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -250,8 +246,7 @@ exports.getHighlighterUtils = function (toolbox) {
|
||||||
* highlightNodeFront, so it has the same signature.
|
* highlightNodeFront, so it has the same signature.
|
||||||
* @see highlightNodeFront
|
* @see highlightNodeFront
|
||||||
*/
|
*/
|
||||||
let highlightDomValueGrip = exported.highlightDomValueGrip = requireInspector(
|
exported.highlightDomValueGrip = requireInspector(function* (valueGrip, options = {}) {
|
||||||
function* (valueGrip, options = {}) {
|
|
||||||
let nodeFront = yield gripToNodeFront(valueGrip);
|
let nodeFront = yield gripToNodeFront(valueGrip);
|
||||||
if (nodeFront) {
|
if (nodeFront) {
|
||||||
yield highlightNodeFront(nodeFront, options);
|
yield highlightNodeFront(nodeFront, options);
|
||||||
|
|
@ -279,13 +274,13 @@ exports.getHighlighterUtils = function (toolbox) {
|
||||||
* markup view, which is when this param is passed to true
|
* markup view, which is when this param is passed to true
|
||||||
* @return a promise that resolves when the highlighter is hidden
|
* @return a promise that resolves when the highlighter is hidden
|
||||||
*/
|
*/
|
||||||
let unhighlight = exported.unhighlight = Task.async(
|
exported.unhighlight = Task.async(function* (forceHide = false) {
|
||||||
function* (forceHide = false) {
|
|
||||||
forceHide = forceHide || !flags.testing;
|
forceHide = forceHide || !flags.testing;
|
||||||
|
|
||||||
// Note that if isRemoteHighlightable is true, there's no need to hide the
|
// Note that if isRemoteHighlightable is true, there's no need to hide the
|
||||||
// highlighter as the walker uses setTimeout to hide it after some time
|
// highlighter as the walker uses setTimeout to hide it after some time
|
||||||
if (isNodeFrontHighlighted && forceHide && toolbox.highlighter && isRemoteHighlightable()) {
|
if (isNodeFrontHighlighted && forceHide && toolbox.highlighter &&
|
||||||
|
isRemoteHighlightable()) {
|
||||||
isNodeFrontHighlighted = false;
|
isNodeFrontHighlighted = false;
|
||||||
yield toolbox.highlighter.hideBoxModel();
|
yield toolbox.highlighter.hideBoxModel();
|
||||||
}
|
}
|
||||||
|
|
@ -306,8 +301,7 @@ exports.getHighlighterUtils = function (toolbox) {
|
||||||
* methods and needs to be released by the consumer when not needed anymore.
|
* methods and needs to be released by the consumer when not needed anymore.
|
||||||
* @return a promise that resolves to the highlighter
|
* @return a promise that resolves to the highlighter
|
||||||
*/
|
*/
|
||||||
let getHighlighterByType = exported.getHighlighterByType = requireInspector(
|
exported.getHighlighterByType = requireInspector(function* (typeName) {
|
||||||
function* (typeName) {
|
|
||||||
let highlighter = null;
|
let highlighter = null;
|
||||||
|
|
||||||
if (supportsCustomHighlighters()) {
|
if (supportsCustomHighlighters()) {
|
||||||
|
|
@ -316,7 +310,6 @@ exports.getHighlighterUtils = function (toolbox) {
|
||||||
|
|
||||||
return highlighter || promise.reject("The target doesn't support " +
|
return highlighter || promise.reject("The target doesn't support " +
|
||||||
`creating highlighters by types or ${typeName} is unknown`);
|
`creating highlighters by types or ${typeName} is unknown`);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Return the public API
|
// Return the public API
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,10 @@
|
||||||
|
/* 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/. */
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
const Services = require("Services");
|
const Services = require("Services");
|
||||||
const {Ci} = require("chrome");
|
|
||||||
const {LocalizationHelper} = require("devtools/shared/l10n");
|
const {LocalizationHelper} = require("devtools/shared/l10n");
|
||||||
const L10N = new LocalizationHelper("devtools/client/locales/toolbox.properties");
|
const L10N = new LocalizationHelper("devtools/client/locales/toolbox.properties");
|
||||||
const DevToolsUtils = require("devtools/shared/DevToolsUtils");
|
const DevToolsUtils = require("devtools/shared/DevToolsUtils");
|
||||||
|
|
@ -67,10 +72,13 @@ ToolboxHostManager.prototype = {
|
||||||
// We have to listen on capture as no event fires on bubble
|
// We have to listen on capture as no event fires on bubble
|
||||||
this.host.frame.addEventListener("unload", this, true);
|
this.host.frame.addEventListener("unload", this, true);
|
||||||
|
|
||||||
let toolbox = new Toolbox(this.target, toolId, this.host.type, this.host.frame.contentWindow, this.frameId);
|
let toolbox = new Toolbox(this.target, toolId, this.host.type,
|
||||||
|
this.host.frame.contentWindow, this.frameId);
|
||||||
|
|
||||||
// Prevent reloading the toolbox when loading the tools in a tab (e.g. from about:debugging)
|
// Prevent reloading the toolbox when loading the tools in a tab
|
||||||
if (!this.host.frame.contentWindow.location.href.startsWith("about:devtools-toolbox")) {
|
// (e.g. from about:debugging)
|
||||||
|
let location = this.host.frame.contentWindow.location;
|
||||||
|
if (!location.href.startsWith("about:devtools-toolbox")) {
|
||||||
this.host.frame.setAttribute("src", "about:devtools-toolbox");
|
this.host.frame.setAttribute("src", "about:devtools-toolbox");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -78,7 +86,7 @@ ToolboxHostManager.prototype = {
|
||||||
}),
|
}),
|
||||||
|
|
||||||
handleEvent(event) {
|
handleEvent(event) {
|
||||||
switch(event.type) {
|
switch (event.type) {
|
||||||
case "message":
|
case "message":
|
||||||
this.onMessage(event);
|
this.onMessage(event);
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
/* eslint-env browser */
|
/* eslint-env browser */
|
||||||
|
/* global XPCNativeWrapper */
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
|
||||||
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
|
|
||||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
/* 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
|
* 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/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
@ -69,8 +67,7 @@ function OptionsPanel(iframeWindow, toolbox) {
|
||||||
this._themeUnregistered = this._themeUnregistered.bind(this);
|
this._themeUnregistered = this._themeUnregistered.bind(this);
|
||||||
this._disableJSClicked = this._disableJSClicked.bind(this);
|
this._disableJSClicked = this._disableJSClicked.bind(this);
|
||||||
|
|
||||||
this.disableJSNode = this.panelDoc.getElementById(
|
this.disableJSNode = this.panelDoc.getElementById("devtools-disable-javascript");
|
||||||
"devtools-disable-javascript");
|
|
||||||
|
|
||||||
this._addListeners();
|
this._addListeners();
|
||||||
|
|
||||||
|
|
@ -116,9 +113,8 @@ OptionsPanel.prototype = {
|
||||||
|
|
||||||
_prefChanged: function (subject, topic, prefName) {
|
_prefChanged: function (subject, topic, prefName) {
|
||||||
if (prefName === "devtools.cache.disabled") {
|
if (prefName === "devtools.cache.disabled") {
|
||||||
let cacheDisabled = data.newValue;
|
let cacheDisabled = GetPref(prefName);
|
||||||
let cbx = this.panelDoc.getElementById("devtools-disable-cache");
|
let cbx = this.panelDoc.getElementById("devtools-disable-cache");
|
||||||
|
|
||||||
cbx.checked = cacheDisabled;
|
cbx.checked = cacheDisabled;
|
||||||
} else if (prefName === "devtools.theme") {
|
} else if (prefName === "devtools.theme") {
|
||||||
this.updateCurrentTheme();
|
this.updateCurrentTheme();
|
||||||
|
|
@ -359,7 +355,7 @@ OptionsPanel.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
populatePreferences: function () {
|
populatePreferences: Task.async(function* () {
|
||||||
let prefCheckboxes = this.panelDoc.querySelectorAll(
|
let prefCheckboxes = this.panelDoc.querySelectorAll(
|
||||||
"input[type=checkbox][data-pref]");
|
"input[type=checkbox][data-pref]");
|
||||||
for (let prefCheckbox of prefCheckboxes) {
|
for (let prefCheckbox of prefCheckboxes) {
|
||||||
|
|
@ -399,6 +395,7 @@ OptionsPanel.prototype = {
|
||||||
prefSelect.selectedIndex = options.indexOf(option);
|
prefSelect.selectedIndex = options.indexOf(option);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
prefSelect.addEventListener("change", function (e) {
|
prefSelect.addEventListener("change", function (e) {
|
||||||
|
|
@ -409,16 +406,15 @@ OptionsPanel.prototype = {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.target.activeTab) {
|
if (this.target.activeTab) {
|
||||||
return this.target.client.attachTab(this.target.activeTab._actor)
|
let [ response ] = yield this.target.client.attachTab(this.target.activeTab._actor);
|
||||||
.then(([response, client]) => {
|
this._origJavascriptEnabled = !response.javascriptEnabled;
|
||||||
this._origJavascriptEnabled = !response.javascriptEnabled;
|
this.disableJSNode.checked = this._origJavascriptEnabled;
|
||||||
this.disableJSNode.checked = this._origJavascriptEnabled;
|
this.disableJSNode.addEventListener("click", this._disableJSClicked);
|
||||||
this.disableJSNode.addEventListener("click",
|
} else {
|
||||||
this._disableJSClicked);
|
// Hide the checkbox and label
|
||||||
});
|
this.disableJSNode.parentNode.style.display = "none";
|
||||||
}
|
}
|
||||||
this.disableJSNode.hidden = true;
|
}),
|
||||||
},
|
|
||||||
|
|
||||||
updateCurrentTheme: function () {
|
updateCurrentTheme: function () {
|
||||||
let currentTheme = GetPref("devtools.theme");
|
let currentTheme = GetPref("devtools.theme");
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue