Bug 1378151 - Remove toolbox-process-window.js preprocessing and enable eslint. r=jdescottes draft
authorAlexandre Poirot <poirot.alex@gmail.com>
Tue, 04 Jul 2017 17:05:12 +0200
changeset 603781 b7f7edec79cfc1784d559057422a5a586c5ff654
parent 603741 5bed7af5695125fa7aca66239fe15698e0fd4a3c
child 635997 e3c8f4cab64a567fa278405cc2d75ca315c3f049
push id66858
push userbmo:poirot.alex@gmail.com
push dateTue, 04 Jul 2017 15:48:09 +0000
reviewersjdescottes
bugs1378151
milestone56.0a1
Bug 1378151 - Remove toolbox-process-window.js preprocessing and enable eslint. r=jdescottes MozReview-Commit-ID: 6qPg0jSsdsR
.eslintignore
devtools/client/framework/toolbox-process-window.js
devtools/client/jar.mn
--- a/.eslintignore
+++ b/.eslintignore
@@ -133,19 +133,16 @@ devtools/server/tests/browser/storage-*.
 devtools/server/tests/browser/stylesheets-nested-iframes.html
 devtools/server/tests/unit/xpcshell_debugging_script.js
 devtools/shared/platform/content/test/test_clipboard.html
 devtools/shared/qrcode/tests/mochitest/test_decode.html
 devtools/shared/tests/mochitest/*.html
 devtools/shared/webconsole/test/test_*.html
 
 # Ignore devtools pre-processed files
-devtools/client/framework/toolbox-process-window.js
-devtools/client/performance/system.js
-devtools/client/webide/webide-prefs.js
 devtools/client/preferences/**
 
 # Ignore devtools third-party libs
 devtools/shared/jsbeautify/*
 devtools/shared/acorn/*
 devtools/shared/gcli/source/*
 devtools/shared/node-properties/*
 devtools/shared/pretty-fast/*
--- a/devtools/client/framework/toolbox-process-window.js
+++ b/devtools/client/framework/toolbox-process-window.js
@@ -26,17 +26,17 @@ var { Task } = require("devtools/shared/
 var Prefs = new PrefsHelper("devtools.debugger", {
   chromeDebuggingHost: ["Char", "chrome-debugging-host"],
   chromeDebuggingPort: ["Int", "chrome-debugging-port"],
   chromeDebuggingWebSocket: ["Bool", "chrome-debugging-websocket"],
 });
 
 var gToolbox, gClient;
 
-var connect = Task.async(function*() {
+var connect = Task.async(function* () {
   window.removeEventListener("load", connect);
   // Initiate the connection
   let transport = yield DebuggerClient.socketConnect({
     host: Prefs.chromeDebuggingHost,
     port: Prefs.chromeDebuggingPort,
     webSocket: Prefs.chromeDebuggingWebSocket,
   });
   gClient = new DebuggerClient(transport);
@@ -63,17 +63,17 @@ function setPrefDefaults() {
   Services.prefs.setBoolPref("devtools.command-button-noautohide.enabled", true);
   Services.prefs.setBoolPref("devtools.scratchpad.enabled", true);
   // Bug 1225160 - Using source maps with browser debugging can lead to a crash
   Services.prefs.setBoolPref("devtools.debugger.source-maps-enabled", false);
   Services.prefs.setBoolPref("devtools.debugger.new-debugger-frontend", true);
   Services.prefs.setBoolPref("devtools.debugger.client-source-maps-enabled", true);
 }
 
-window.addEventListener("load", function() {
+window.addEventListener("load", function () {
   let cmdClose = document.getElementById("toolbox-cmd-close");
   cmdClose.addEventListener("command", onCloseCommand);
   setPrefDefaults();
   connect().catch(e => {
     let errorMessageContainer = document.getElementById("error-message-container");
     let errorMessage = document.getElementById("error-message");
     errorMessage.value = e.message || e;
     errorMessageContainer.hidden = false;
@@ -94,33 +94,34 @@ function openToolbox({ form, chrome, isT
   };
   TargetFactory.forRemoteTab(options).then(target => {
     let frame = document.getElementById("toolbox-iframe");
 
     // Remember the last panel that was used inside of this profile.
     // But if we are testing, then it should always open the debugger panel.
     let selectedTool =
       Services.prefs.getCharPref("devtools.browsertoolbox.panel",
-                                 Services.prefs.getCharPref("devtools.toolbox.selectedTool",
-                                                            "jsdebugger"));
+        Services.prefs.getCharPref("devtools.toolbox.selectedTool",
+                                   "jsdebugger"));
 
-    let options = { customIframe: frame };
+    options = { customIframe: frame };
     gDevTools.showToolbox(target,
                           selectedTool,
                           Toolbox.HostType.CUSTOM,
                           options)
              .then(onNewToolbox);
   });
 }
 
 function onNewToolbox(toolbox) {
   gToolbox = toolbox;
   bindToolboxHandlers();
   raise();
-  let env = Components.classes["@mozilla.org/process/environment;1"].getService(Components.interfaces.nsIEnvironment);
+  let env = Components.classes["@mozilla.org/process/environment;1"]
+    .getService(Components.interfaces.nsIEnvironment);
   let testScript = env.get("MOZ_TOOLBOX_TEST_SCRIPT");
   if (testScript) {
     // Only allow executing random chrome scripts when a special
     // test-only pref is set
     let prefName = "devtools.browser-toolbox.allow-unsafe-script";
     if (Services.prefs.getPrefType(prefName) == Services.prefs.PREF_BOOL &&
         Services.prefs.getBoolPref(prefName) === true) {
       evaluateTestScript(testScript, toolbox);
@@ -134,25 +135,26 @@ function evaluateTestScript(script, tool
   sandbox.toolbox = toolbox;
   Cu.evalInSandbox(script, sandbox);
 }
 
 function bindToolboxHandlers() {
   gToolbox.once("destroyed", quitApp);
   window.addEventListener("unload", onUnload);
 
-#ifdef XP_MACOSX
-  // Badge the dock icon to differentiate this process from the main application process.
-  updateBadgeText(false);
+  if (Services.appinfo.OS == "Darwin") {
+    // Badge the dock icon to differentiate this process from the main application
+    // process.
+    updateBadgeText(false);
 
-  // Once the debugger panel opens listen for thread pause / resume.
-  gToolbox.getPanelWhenReady("jsdebugger").then(panel => {
-    setupThreadListeners(panel);
-  });
-#endif
+    // Once the debugger panel opens listen for thread pause / resume.
+    gToolbox.getPanelWhenReady("jsdebugger").then(panel => {
+      setupThreadListeners(panel);
+    });
+  }
 }
 
 function setupThreadListeners(panel) {
   updateBadgeText(panel._selectors.getPause(panel._getState()));
 
   let onPaused = updateBadgeText.bind(null, true);
   let onResumed = updateBadgeText.bind(null, false);
   gToolbox.target.on("thread-paused", onPaused);
@@ -160,17 +162,18 @@ function setupThreadListeners(panel) {
 
   panel.once("destroyed", () => {
     gToolbox.target.off("thread-paused", onPaused);
     gToolbox.target.off("thread-resumed", onResumed);
   });
 }
 
 function updateBadgeText(paused) {
-  let dockSupport = Cc["@mozilla.org/widget/macdocksupport;1"].getService(Ci.nsIMacDockSupport);
+  let dockSupport = Cc["@mozilla.org/widget/macdocksupport;1"]
+    .getService(Ci.nsIMacDockSupport);
   dockSupport.badgeText = paused ? "▐▐ " : " ▶";
 }
 
 function onUnload() {
   window.removeEventListener("unload", onUnload);
   window.removeEventListener("message", onMessage);
   let cmdClose = document.getElementById("toolbox-cmd-close");
   cmdClose.removeEventListener("command", onCloseCommand);
@@ -183,17 +186,19 @@ function onMessage(event) {
     switch (json.name) {
       case "toolbox-raise":
         raise();
         break;
       case "toolbox-title":
         setTitle(json.data.value);
         break;
     }
-  } catch(e) { console.error(e); }
+  } catch (e) {
+    console.error(e);
+  }
 }
 
 window.addEventListener("message", onMessage);
 
 function raise() {
   window.focus();
 }
 
@@ -207,14 +212,14 @@ function quitApp() {
   Services.obs.notifyObservers(quit, "quit-application-requested");
 
   let shouldProceed = !quit.data;
   if (shouldProceed) {
     Services.startup.quit(Ci.nsIAppStartup.eForceQuit);
   }
 }
 
-function getParameterByName (name) {
+function getParameterByName(name) {
   name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
   let regex = new RegExp("[\\?&]" + name + "=([^&#]*)");
   let results = regex.exec(window.location.search);
   return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
 }
--- a/devtools/client/jar.mn
+++ b/devtools/client/jar.mn
@@ -79,17 +79,17 @@ devtools.jar:
     content/commandline/commandlineoutput.xhtml (commandline/commandlineoutput.xhtml)
     content/commandline/commandlinetooltip.xhtml (commandline/commandlinetooltip.xhtml)
     content/framework/toolbox-window.xul (framework/toolbox-window.xul)
     content/framework/toolbox-options.xhtml (framework/toolbox-options.xhtml)
     content/framework/toolbox.xul (framework/toolbox.xul)
     content/framework/toolbox-init.js (framework/toolbox-init.js)
     content/framework/options-panel.css (framework/options-panel.css)
     content/framework/toolbox-process-window.xul (framework/toolbox-process-window.xul)
-*   content/framework/toolbox-process-window.js (framework/toolbox-process-window.js)
+    content/framework/toolbox-process-window.js (framework/toolbox-process-window.js)
     content/framework/dev-edition-promo/dev-edition-promo.xul (framework/dev-edition-promo/dev-edition-promo.xul)
 *   content/framework/dev-edition-promo/dev-edition-promo.css (framework/dev-edition-promo/dev-edition-promo.css)
     content/framework/dev-edition-promo/dev-edition-logo.png (framework/dev-edition-promo/dev-edition-logo.png)
     content/inspector/inspector.xhtml (inspector/inspector.xhtml)
     content/framework/connect/connect.xhtml (framework/connect/connect.xhtml)
     content/framework/connect/connect.css (framework/connect/connect.css)
     content/framework/connect/connect.js (framework/connect/connect.js)
     content/shared/widgets/graphs-frame.xhtml (shared/widgets/graphs-frame.xhtml)