Bug 1242689 - Fix eslint errors in devtools/client/*.js and un-ignore the files; r=tromey

This commit is contained in:
Patrick Brosset 2016-01-26 10:53:45 +01:00
parent 0dcc222163
commit 35eb2d7cb8
4 changed files with 49 additions and 41 deletions

View File

@ -85,7 +85,6 @@ browser/extensions/loop/**
# devtools/ exclusions
devtools/*.js
devtools/client/*.js
devtools/client/aboutdebugging/**
devtools/client/animationinspector/**
devtools/client/canvasdebugger/**

View File

@ -4,7 +4,7 @@
"use strict";
const {Cc, Ci, Cu} = require("chrome");
const {Cc, Ci} = require("chrome");
const { Services } = require("resource://gre/modules/Services.jsm");
@ -41,7 +41,7 @@ const scratchpadProps = "chrome://devtools/locale/scratchpad.properties";
const memoryProps = "chrome://devtools/locale/memory.properties";
loader.lazyGetter(this, "toolboxStrings", () => Services.strings.createBundle(toolboxProps));
loader.lazyGetter(this, "performanceStrings",() => Services.strings.createBundle(performanceProps));
loader.lazyGetter(this, "performanceStrings", () => Services.strings.createBundle(performanceProps));
loader.lazyGetter(this, "webConsoleStrings", () => Services.strings.createBundle(webConsoleProps));
loader.lazyGetter(this, "debuggerStrings", () => Services.strings.createBundle(debuggerProps));
loader.lazyGetter(this, "styleEditorStrings", () => Services.strings.createBundle(styleEditorProps));
@ -71,14 +71,14 @@ Tools.options = {
tooltip: l10n("optionsButton.tooltip", toolboxStrings),
inMenu: false,
isTargetSupported: function(target) {
isTargetSupported: function() {
return true;
},
build: function(iframeWindow, toolbox) {
return new OptionsPanel(iframeWindow, toolbox);
}
}
};
Tools.inspector = {
id: "inspector",
@ -93,7 +93,7 @@ Tools.inspector = {
panelLabel: l10n("inspector.panelLabel", inspectorStrings),
get tooltip() {
return l10n("inspector.tooltip2", inspectorStrings,
( osString == "Darwin" ? "Cmd+Opt+" : "Ctrl+Shift+" ) + this.key);
(osString == "Darwin" ? "Cmd+Opt+" : "Ctrl+Shift+") + this.key);
},
inMenu: true,
commands: [
@ -127,20 +127,21 @@ Tools.webConsole = {
panelLabel: l10n("ToolboxWebConsole.panelLabel", webConsoleStrings),
get tooltip() {
return l10n("ToolboxWebconsole.tooltip2", webConsoleStrings,
( osString == "Darwin" ? "Cmd+Opt+" : "Ctrl+Shift+" ) + this.key);
(osString == "Darwin" ? "Cmd+Opt+" : "Ctrl+Shift+") + this.key);
},
inMenu: true,
commands: "devtools/client/webconsole/console-commands",
preventClosingOnKey: true,
onkey: function(panel, toolbox) {
if (toolbox.splitConsole)
if (toolbox.splitConsole) {
return toolbox.focusConsoleInput();
}
panel.focusInput();
},
isTargetSupported: function(target) {
isTargetSupported: function() {
return true;
},
@ -163,12 +164,12 @@ Tools.jsdebugger = {
panelLabel: l10n("ToolboxDebugger.panelLabel", debuggerStrings),
get tooltip() {
return l10n("ToolboxDebugger.tooltip2", debuggerStrings,
( osString == "Darwin" ? "Cmd+Opt+" : "Ctrl+Shift+" ) + this.key);
(osString == "Darwin" ? "Cmd+Opt+" : "Ctrl+Shift+") + this.key);
},
inMenu: true,
commands: "devtools/client/debugger/debugger-commands",
isTargetSupported: function(target) {
isTargetSupported: function() {
return true;
},
@ -241,7 +242,7 @@ Tools.canvasDebugger = {
return target.hasActor("canvas") && !target.chrome;
},
build: function (iframeWindow, toolbox) {
build: function(iframeWindow, toolbox) {
return new CanvasDebuggerPanel(iframeWindow, toolbox);
}
};
@ -265,11 +266,11 @@ Tools.performance = {
modifiers: "shift",
inMenu: true,
isTargetSupported: function (target) {
isTargetSupported: function(target) {
return target.hasActor("profiler");
},
build: function (frame, target) {
build: function(frame, target) {
return new PerformancePanel(frame, target);
}
};
@ -286,11 +287,11 @@ Tools.memory = {
panelLabel: l10n("memory.panelLabel", memoryStrings),
tooltip: l10n("memory.tooltip", memoryStrings),
isTargetSupported: function (target) {
isTargetSupported: function(target) {
return target.getTrait("heapSnapshots");
},
build: function (frame, target) {
build: function(frame, target) {
return new MemoryPanel(frame, target);
}
};
@ -309,7 +310,7 @@ Tools.netMonitor = {
panelLabel: l10n("netmonitor.panelLabel", netMonitorStrings),
get tooltip() {
return l10n("netmonitor.tooltip2", netMonitorStrings,
( osString == "Darwin" ? "Cmd+Opt+" : "Ctrl+Shift+" ) + this.key);
(osString == "Darwin" ? "Cmd+Opt+" : "Ctrl+Shift+") + this.key);
},
inMenu: true,
@ -343,8 +344,7 @@ Tools.storage = {
isTargetSupported: function(target) {
return target.isLocalTab ||
( target.hasActor("storage") &&
target.getTrait("storageInspector") );
(target.hasActor("storage") && target.getTrait("storageInspector"));
},
build: function(iframeWindow, toolbox) {
@ -442,8 +442,7 @@ exports.defaultThemes = [
* The key to lookup.
* @returns A localized version of the given key.
*/
function l10n(name, bundle, arg)
{
function l10n(name, bundle, arg) {
try {
return arg ? bundle.formatStringFromName(name, [arg], 1)
: bundle.GetStringFromName(name);
@ -453,7 +452,6 @@ function l10n(name, bundle, arg)
}
}
function functionkey(shortkey)
{
function functionkey(shortkey) {
return shortkey.split("_")[1];
}

View File

@ -2,7 +2,13 @@
* 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/. */
const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
/* FIXME: remove this globals comment and replace with import-globals-from when
bug 1242893 is fixed */
/* globals BrowserToolboxProcess */
"use strict";
const { interfaces: Ci, utils: Cu } = Components;
const kDebuggerPrefs = [
"devtools.debugger.remote-enabled",
"devtools.chrome.enabled"
@ -10,8 +16,8 @@ const kDebuggerPrefs = [
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Services", "resource://gre/modules/Services.jsm");
function devtoolsCommandlineHandler() {
}
function devtoolsCommandlineHandler() {}
devtoolsCommandlineHandler.prototype = {
handle: function(cmdLine) {
let consoleFlag = cmdLine.handleFlag("jsconsole", false);
@ -31,7 +37,7 @@ devtoolsCommandlineHandler.prototype = {
try {
debuggerServerFlag =
cmdLine.handleFlagWithParam("start-debugger-server", false);
} catch(e) {
} catch (e) {
// We get an error if the option is given but not followed by a value.
// By catching and trying again, the value is effectively optional.
debuggerServerFlag = cmdLine.handleFlag("start-debugger-server", false);
@ -51,7 +57,8 @@ devtoolsCommandlineHandler.prototype = {
let { console } = Cu.import("resource://gre/modules/Console.jsm", {});
hudservice.toggleBrowserConsole().then(null, console.error);
} else {
window.focus(); // the Browser Console was already open
// the Browser Console was already open
window.focus();
}
if (cmdLine.state == Ci.nsICommandLine.STATE_REMOTE_AUTO) {
@ -62,7 +69,8 @@ devtoolsCommandlineHandler.prototype = {
// Open the toolbox on the selected tab once the browser starts up.
handleDevToolsFlag: function() {
Services.obs.addObserver(function onStartup(window) {
Services.obs.removeObserver(onStartup, "browser-delayed-startup-finished");
Services.obs.removeObserver(onStartup,
"browser-delayed-startup-finished");
const {gDevTools} = Cu.import("resource://devtools/client/framework/gDevTools.jsm", {});
const {devtools} = Cu.import("resource://devtools/shared/Loader.jsm", {});
let target = devtools.TargetFactory.forTab(window.gBrowser.selectedTab);
@ -73,14 +81,16 @@ devtoolsCommandlineHandler.prototype = {
_isRemoteDebuggingEnabled() {
let remoteDebuggingEnabled = false;
try {
remoteDebuggingEnabled = kDebuggerPrefs.every((pref) => Services.prefs.getBoolPref(pref));
remoteDebuggingEnabled = kDebuggerPrefs.every(pref => {
return Services.prefs.getBoolPref(pref);
});
} catch (ex) {
Cu.reportError(ex);
return false;
}
if (!remoteDebuggingEnabled) {
let errorMsg = "Could not run chrome debugger! You need the following prefs " +
"to be set to true: " + kDebuggerPrefs.join(", ");
let errorMsg = "Could not run chrome debugger! You need the following " +
"prefs to be set to true: " + kDebuggerPrefs.join(", ");
Cu.reportError(errorMsg);
// Dump as well, as we're doing this from a commandline, make sure people
// don't miss it:
@ -131,7 +141,7 @@ devtoolsCommandlineHandler.prototype = {
listener.portOrPath = portOrPath;
listener.open();
dump("Started debugger server on " + portOrPath + "\n");
} catch(e) {
} catch (e) {
dump("Unable to start debugger server on " + portOrPath + ": " + e);
}
@ -140,15 +150,16 @@ devtoolsCommandlineHandler.prototype = {
}
},
helpInfo : " --jsconsole Open the Browser Console.\n" +
" --jsdebugger Open the Browser Toolbox.\n" +
" --devtools Open DevTools on initial load.\n" +
" --start-debugger-server [port|path] " +
"Start the debugger server on a TCP port or " +
"Unix domain socket path. Defaults to TCP port 6000.\n",
helpInfo: " --jsconsole Open the Browser Console.\n" +
" --jsdebugger Open the Browser Toolbox.\n" +
" --devtools Open DevTools on initial load.\n" +
" --start-debugger-server [port|path] " +
"Start the debugger server on a TCP port or " +
"Unix domain socket path. Defaults to TCP port 6000.\n",
classID: Components.ID("{9e9a9283-0ce9-4e4a-8f1c-ba129a032c32}"),
QueryInterface: XPCOMUtils.generateQI([Ci.nsICommandLineHandler]),
};
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([devtoolsCommandlineHandler]);
this.NSGetFactory = XPCOMUtils.generateNSGetFactory(
[devtoolsCommandlineHandler]);

View File

@ -27,7 +27,7 @@ Object.defineProperty(exports, "TargetFactory", {
});
const unloadObserver = {
observe: function(subject, topic, data) {
observe: function(subject) {
if (subject.wrappedJSObject === require("@loader/unload")) {
Services.obs.removeObserver(unloadObserver, "sdk:loader:destroy");
for (let definition of gDevTools.getToolDefinitionArray()) {