Bug 1297113 - Fix eslint errors in toolbox.js;r=ochameau

MozReview-Commit-ID: 3q53J5L1bOk

--HG--
extra : rebase_source : 9a453e8484092df3eb52ff350e3289b339e8c6c7
This commit is contained in:
Julian Descottes 2016-09-12 16:51:40 +02:00
parent 8913fa4956
commit 48ae3f1a79
2 changed files with 41 additions and 31 deletions

View file

@ -80,6 +80,7 @@ devtools/client/debugger/**
devtools/client/eyedropper/**
devtools/client/framework/**
!devtools/client/framework/selection.js
!devtools/client/framework/toolbox.js
devtools/client/jsonview/lib/**
devtools/client/memory/**
devtools/client/netmonitor/test/**

View file

@ -14,7 +14,7 @@ const SCREENSIZE_HISTOGRAM = "DEVTOOLS_SCREEN_RESOLUTION_ENUMERATED_PER_USER";
const HTML_NS = "http://www.w3.org/1999/xhtml";
const { SourceMapService } = require("./source-map-service");
var {Cc, Ci, Cu} = require("chrome");
var {Ci, Cu} = require("chrome");
var promise = require("promise");
var defer = require("devtools/shared/defer");
var Services = require("Services");
@ -235,8 +235,8 @@ Toolbox.prototype = {
if (panel) {
deferred.resolve(panel);
} else {
this.on(id + "-ready", (e, panel) => {
deferred.resolve(panel);
this.on(id + "-ready", (e, initializedPanel) => {
deferred.resolve(initializedPanel);
});
}
@ -406,7 +406,7 @@ Toolbox.prototype = {
this.textboxContextMenuPopup.addEventListener("popupshowing",
this._updateTextboxMenuItems, true);
var shortcuts = new KeyShortcuts({
let shortcuts = new KeyShortcuts({
window: this.doc.defaultView
});
this._buildDockButtons();
@ -502,7 +502,8 @@ Toolbox.prototype = {
this._telemetry.logOncePerBrowserVersion(OS_HISTOGRAM, system.getOSCPU());
this._telemetry.logOncePerBrowserVersion(OS_IS_64_BITS,
Services.appinfo.is64Bit ? 1 : 0);
this._telemetry.logOncePerBrowserVersion(SCREENSIZE_HISTOGRAM, system.getScreenDimensions());
this._telemetry.logOncePerBrowserVersion(SCREENSIZE_HISTOGRAM,
system.getScreenDimensions());
this._telemetry.log(HOST_HISTOGRAM, this._getTelemetryHostId());
},
@ -976,10 +977,10 @@ Toolbox.prototype = {
this._requisition = requisition;
const spec = CommandUtils.getCommandbarSpec("devtools.toolbox.toolbarSpec");
return CommandUtils.createButtons(spec, this.target, this.doc,
requisition).then(buttons => {
return CommandUtils.createButtons(spec, this.target, this.doc, requisition)
.then(buttons => {
let container = this.doc.getElementById("toolbox-buttons");
buttons.forEach(button=> {
buttons.forEach(button => {
if (button) {
container.appendChild(button);
}
@ -996,7 +997,8 @@ Toolbox.prototype = {
_buildPickerButton: function () {
this._pickerButton = this.doc.createElementNS(HTML_NS, "button");
this._pickerButton.id = "command-button-pick";
this._pickerButton.className = "command-button command-button-invertable devtools-button";
this._pickerButton.className =
"command-button command-button-invertable devtools-button";
this._pickerButton.setAttribute("title", L10N.getStr("pickButton.tooltip"));
this._pickerButton.setAttribute("hidden", "true");
@ -1082,7 +1084,9 @@ Toolbox.prototype = {
let on = true;
try {
on = Services.prefs.getBoolPref(visibilityswitch);
} catch (ex) { }
} catch (ex) {
// Do nothing.
}
on = on && isTargetSupported(this.target);
@ -1226,8 +1230,8 @@ Toolbox.prototype = {
if (panel) {
deferred.resolve(panel);
} else {
this.once(id + "-ready", panel => {
deferred.resolve(panel);
this.once(id + "-ready", initializedPanel => {
deferred.resolve(initializedPanel);
});
}
return deferred.promise;
@ -1598,7 +1602,7 @@ Toolbox.prototype = {
// Returns an instance of the preference actor
get _preferenceFront() {
return this.target.root.then(rootForm => {
return new getPreferenceFront(this.target.client, rootForm);
return getPreferenceFront(this.target.client, rootForm);
});
},
@ -1950,9 +1954,9 @@ Toolbox.prototype = {
if (!this._initInspector) {
this._initInspector = Task.spawn(function* () {
this._inspector = InspectorFront(this._target.client, this._target.form);
this._walker = yield this._inspector.getWalker(
{showAllAnonymousContent: Services.prefs.getBoolPref("devtools.inspector.showAllAnonymousContent")}
);
let pref = "devtools.inspector.showAllAnonymousContent";
let showAllAnonymousContent = Services.prefs.getBoolPref(pref);
this._walker = yield this._inspector.getWalker({ showAllAnonymousContent });
this._selection = new Selection(this._walker);
if (this.highlighterUtils.isRemoteHighlightable()) {
@ -1976,7 +1980,7 @@ Toolbox.prototype = {
return this._destroyingInspector;
}
return this._destroyingInspector = Task.spawn(function* () {
this._destroyingInspector = Task.spawn(function* () {
if (!this._inspector) {
return;
}
@ -1988,7 +1992,9 @@ Toolbox.prototype = {
if (this._walker && !this.walker.traits.autoReleased) {
try {
yield this._walker.release();
} catch (e) {}
} catch (e) {
// Do nothing;
}
}
yield this.highlighterUtils.stopPicker();
@ -2018,6 +2024,7 @@ Toolbox.prototype = {
this._selection = null;
this._walker = null;
}.bind(this));
return this._destroyingInspector;
},
/**
@ -2233,7 +2240,7 @@ Toolbox.prototype = {
// If target does not have profiler actor (addons), do not
// even register the shared performance connection.
if (!this.target.hasActor("profiler")) {
return;
return promise.resolve();
}
if (this._performanceFrontConnection) {
@ -2272,10 +2279,11 @@ Toolbox.prototype = {
}),
/**
* Called when any event comes from the PerformanceFront. If the performance tool is already
* loaded when the first event comes in, immediately unbind this handler, as this is
* only used to queue up observed recordings before the performance tool can handle them,
* which will only occur when `console.profile()` recordings are started before the tool loads.
* Called when any event comes from the PerformanceFront. If the performance tool is
* already loaded when the first event comes in, immediately unbind this handler, as
* this is only used to queue up observed recordings before the performance tool can
* handle them, which will only occur when `console.profile()` recordings are started
* before the tool loads.
*/
_onPerformanceFrontEvent: Task.async(function* (eventName, recording) {
if (this.getPanel("performance")) {
@ -2283,7 +2291,8 @@ Toolbox.prototype = {
return;
}
let recordings = this._performanceQueuedRecordings = this._performanceQueuedRecordings || [];
this._performanceQueuedRecordings = this._performanceQueuedRecordings || [];
let recordings = this._performanceQueuedRecordings;
// Before any console recordings, we'll get a `console-profile-start` event
// warning us that a recording will come later (via `recording-started`), so