Bug 1287005 - Normalize line endings in devtools/; r?fitzgen draft
authorGregory Szorc <gps@mozilla.com>
Thu, 14 Jul 2016 17:38:50 -0700
changeset 567448 ef88dea7c0da01f2d99dd26426de24210749903b
parent 567425 abdcc8dfc28397b95338245390e12c56658ad182
child 625649 c7c0d9dd9d1bb2b03c414a591e197567530dc7d9
push id55573
push usergszorc@mozilla.com
push dateTue, 25 Apr 2017 01:15:02 +0000
reviewersfitzgen
bugs1287005
milestone55.0a1
Bug 1287005 - Normalize line endings in devtools/; r?fitzgen MozReview-Commit-ID: 9Wxx2WUa0Aj
devtools/client/commandline/test/browser_cmd_qsa.js
devtools/client/debugger/test/mochitest/browser_dbg_variables-view-edit-cancel.js
devtools/client/debugger/test/mochitest/browser_dbg_variables-view-popup-17.js
devtools/shared/acorn/tests/unit/test_import_acorn.js
devtools/shared/acorn/tests/unit/test_lenient_parser.js
devtools/shared/acorn/tests/unit/test_same_ast.js
--- a/devtools/client/commandline/test/browser_cmd_qsa.js
+++ b/devtools/client/commandline/test/browser_cmd_qsa.js
@@ -1,33 +1,33 @@
-/* Any copyright is dedicated to the Public Domain.
-* http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-// Tests that the qsa commands work as they should.
-
-const TEST_URI = "data:text/html;charset=utf-8,<body></body>";
-
-function test() {
-  helpers.addTabWithToolbar(TEST_URI, function (options) {
-    return helpers.audit(options, [
-      {
-        setup: "qsa",
-        check: {
-          input:  "qsa",
-          hints:  " [query]",
-          markup: "VVV",
-          status: "VALID"
-        }
-      },
-      {
-        setup: "qsa body",
-        check: {
-          input:  "qsa body",
-          hints:  "",
-          markup: "VVVVVVVV",
-          status: "VALID"
-        }
-      }
-    ]);
-  }).then(finish, helpers.handleError);
-}
+/* Any copyright is dedicated to the Public Domain.
+* http://creativecommons.org/publicdomain/zero/1.0/ */
+
+"use strict";
+
+// Tests that the qsa commands work as they should.
+
+const TEST_URI = "data:text/html;charset=utf-8,<body></body>";
+
+function test() {
+  helpers.addTabWithToolbar(TEST_URI, function (options) {
+    return helpers.audit(options, [
+      {
+        setup: "qsa",
+        check: {
+          input:  "qsa",
+          hints:  " [query]",
+          markup: "VVV",
+          status: "VALID"
+        }
+      },
+      {
+        setup: "qsa body",
+        check: {
+          input:  "qsa body",
+          hints:  "",
+          markup: "VVVVVVVV",
+          status: "VALID"
+        }
+      }
+    ]);
+  }).then(finish, helpers.handleError);
+}
--- a/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-edit-cancel.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-edit-cancel.js
@@ -1,58 +1,58 @@
 /* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
 /* vim: set ft=javascript ts=2 et sw=2 tw=80: */
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Make sure that canceling a name change correctly unhides the separator and
- * value elements.
- */
-
-const TAB_URL = EXAMPLE_URL + "doc_watch-expressions.html";
-
-function test() {
-  Task.spawn(function* () {
+
+/**
+ * Make sure that canceling a name change correctly unhides the separator and
+ * value elements.
+ */
+
+const TAB_URL = EXAMPLE_URL + "doc_watch-expressions.html";
+
+function test() {
+  Task.spawn(function* () {
     let options = {
       source: TAB_URL,
       line: 1
     };
-    let [tab,, panel] = yield initDebugger(TAB_URL, options);
-    let win = panel.panelWin;
-    let vars = win.DebuggerView.Variables;
-
-    win.DebuggerView.WatchExpressions.addExpression("this");
-
-    callInTab(tab, "ermahgerd");
-    yield waitForDebuggerEvents(panel, win.EVENTS.FETCHED_WATCH_EXPRESSIONS);
-
-    let exprScope = vars.getScopeAtIndex(0);
-    let {target} = exprScope.get("this");
-
-    let name = target.querySelector(".title > .name");
-    let separator = target.querySelector(".separator");
-    let value = target.querySelector(".value");
-
-    is(separator.hidden, false,
-      "The separator element should not be hidden.");
-    is(value.hidden, false,
-      "The value element should not be hidden.");
-
-    for (let key of ["ESCAPE", "RETURN"]) {
-      EventUtils.sendMouseEvent({ type: "dblclick" }, name, win);
-
-      is(separator.hidden, true,
-        "The separator element should be hidden.");
-      is(value.hidden, true,
-        "The value element should be hidden.");
-
-      EventUtils.sendKey(key, win);
-
-      is(separator.hidden, false,
-        "The separator element should not be hidden.");
-      is(value.hidden, false,
-        "The value element should not be hidden.");
-    }
-
-    yield resumeDebuggerThenCloseAndFinish(panel);
-  });
-}
+    let [tab,, panel] = yield initDebugger(TAB_URL, options);
+    let win = panel.panelWin;
+    let vars = win.DebuggerView.Variables;
+
+    win.DebuggerView.WatchExpressions.addExpression("this");
+
+    callInTab(tab, "ermahgerd");
+    yield waitForDebuggerEvents(panel, win.EVENTS.FETCHED_WATCH_EXPRESSIONS);
+
+    let exprScope = vars.getScopeAtIndex(0);
+    let {target} = exprScope.get("this");
+
+    let name = target.querySelector(".title > .name");
+    let separator = target.querySelector(".separator");
+    let value = target.querySelector(".value");
+
+    is(separator.hidden, false,
+      "The separator element should not be hidden.");
+    is(value.hidden, false,
+      "The value element should not be hidden.");
+
+    for (let key of ["ESCAPE", "RETURN"]) {
+      EventUtils.sendMouseEvent({ type: "dblclick" }, name, win);
+
+      is(separator.hidden, true,
+        "The separator element should be hidden.");
+      is(value.hidden, true,
+        "The value element should be hidden.");
+
+      EventUtils.sendKey(key, win);
+
+      is(separator.hidden, false,
+        "The separator element should not be hidden.");
+      is(value.hidden, false,
+        "The value element should not be hidden.");
+    }
+
+    yield resumeDebuggerThenCloseAndFinish(panel);
+  });
+}
--- a/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-popup-17.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg_variables-view-popup-17.js
@@ -1,80 +1,80 @@
-/* Any copyright is dedicated to the Public Domain.
-   http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Tests opening the variable inspection popup while stopped at a debugger statement,
- * clicking "step in" and verifying that the popup is gone.
- */
-
-const TAB_URL = EXAMPLE_URL + "doc_with-frame.html";
-
-let gTab, gPanel, gDebugger;
-let actions, gSources, gVariables;
-
-function test() {
-  let options = {
-    source: TAB_URL,
-    line: 1
-  };
-  initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {
-    gTab = aTab;
-    gPanel = aPanel;
-    gDebugger = gPanel.panelWin;
-    actions = bindActionCreators(gPanel);
-    gSources = gDebugger.DebuggerView.Sources;
-    gVariables = gDebugger.DebuggerView.Variables;
-    let bubble = gDebugger.DebuggerView.VariableBubble;
-    let tooltip = bubble._tooltip.panel;
-    let testPopupHiding = Task.async(function* () {
-      yield addBreakpoint();
-      yield ensureThreadClientState(gPanel, "resumed");
-      yield pauseDebuggee();
-      yield openVarPopup(gPanel, { line: 20, ch: 17 });
-      is(tooltip.querySelectorAll(".devtools-tooltip-simple-text").length, 1,
-          "The popup should be open with a simple text entry");
-      // Now we're stopped at a breakpoint with an open popup
-      // we'll send a keypress and check if the popup closes
-      executeSoon(() => EventUtils.synthesizeKey("VK_F11", {}));
-      // The keypress should cause one resumed event and one paused event
-      yield waitForThreadEvents(gPanel, "resumed");
-      yield waitForThreadEvents(gPanel, "paused");
-      // Here's the state we're actually interested in checking..
-      checkVariablePopupClosed(bubble);
-      yield resumeDebuggerThenCloseAndFinish(gPanel);
-    });
-    testPopupHiding();
-  });
-}
-
-function addBreakpoint() {
-  return actions.addBreakpoint({ actor: gSources.selectedValue, line: 21 });
-}
-
-function pauseDebuggee() {
-  generateMouseClickInTab(gTab, "content.document.querySelector('button')");
-
-  // The first 'with' scope should be expanded by default, but the
-  // variables haven't been fetched yet. This is how 'with' scopes work.
-  return promise.all([
-    waitForDebuggerEvents(gPanel, gDebugger.EVENTS.FETCHED_SCOPES),
-    waitForDebuggerEvents(gPanel, gDebugger.EVENTS.FETCHED_VARIABLES)
-  ]);
-}
-
-function checkVariablePopupClosed(bubble) {
-  ok(!bubble.contentsShown(),
-    "When stepping, popup should close and be hidden.");
-  ok(bubble._tooltip.isEmpty(),
-    "The variable inspection popup should now be empty.");
-  ok(!bubble._markedText,
-    "The marked text in the editor was removed.");
-}
-
-registerCleanupFunction(function () {
-  gTab = null;
-  gPanel = null;
-  gDebugger = null;
-  actions = null;
-  gSources = null;
-  gVariables = null;
-});
+/* Any copyright is dedicated to the Public Domain.
+   http://creativecommons.org/publicdomain/zero/1.0/ */
+
+/**
+ * Tests opening the variable inspection popup while stopped at a debugger statement,
+ * clicking "step in" and verifying that the popup is gone.
+ */
+
+const TAB_URL = EXAMPLE_URL + "doc_with-frame.html";
+
+let gTab, gPanel, gDebugger;
+let actions, gSources, gVariables;
+
+function test() {
+  let options = {
+    source: TAB_URL,
+    line: 1
+  };
+  initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {
+    gTab = aTab;
+    gPanel = aPanel;
+    gDebugger = gPanel.panelWin;
+    actions = bindActionCreators(gPanel);
+    gSources = gDebugger.DebuggerView.Sources;
+    gVariables = gDebugger.DebuggerView.Variables;
+    let bubble = gDebugger.DebuggerView.VariableBubble;
+    let tooltip = bubble._tooltip.panel;
+    let testPopupHiding = Task.async(function* () {
+      yield addBreakpoint();
+      yield ensureThreadClientState(gPanel, "resumed");
+      yield pauseDebuggee();
+      yield openVarPopup(gPanel, { line: 20, ch: 17 });
+      is(tooltip.querySelectorAll(".devtools-tooltip-simple-text").length, 1,
+          "The popup should be open with a simple text entry");
+      // Now we're stopped at a breakpoint with an open popup
+      // we'll send a keypress and check if the popup closes
+      executeSoon(() => EventUtils.synthesizeKey("VK_F11", {}));
+      // The keypress should cause one resumed event and one paused event
+      yield waitForThreadEvents(gPanel, "resumed");
+      yield waitForThreadEvents(gPanel, "paused");
+      // Here's the state we're actually interested in checking..
+      checkVariablePopupClosed(bubble);
+      yield resumeDebuggerThenCloseAndFinish(gPanel);
+    });
+    testPopupHiding();
+  });
+}
+
+function addBreakpoint() {
+  return actions.addBreakpoint({ actor: gSources.selectedValue, line: 21 });
+}
+
+function pauseDebuggee() {
+  generateMouseClickInTab(gTab, "content.document.querySelector('button')");
+
+  // The first 'with' scope should be expanded by default, but the
+  // variables haven't been fetched yet. This is how 'with' scopes work.
+  return promise.all([
+    waitForDebuggerEvents(gPanel, gDebugger.EVENTS.FETCHED_SCOPES),
+    waitForDebuggerEvents(gPanel, gDebugger.EVENTS.FETCHED_VARIABLES)
+  ]);
+}
+
+function checkVariablePopupClosed(bubble) {
+  ok(!bubble.contentsShown(),
+    "When stepping, popup should close and be hidden.");
+  ok(bubble._tooltip.isEmpty(),
+    "The variable inspection popup should now be empty.");
+  ok(!bubble._markedText,
+    "The marked text in the editor was removed.");
+}
+
+registerCleanupFunction(function () {
+  gTab = null;
+  gPanel = null;
+  gDebugger = null;
+  actions = null;
+  gSources = null;
+  gVariables = null;
+});
--- a/devtools/shared/acorn/tests/unit/test_import_acorn.js
+++ b/devtools/shared/acorn/tests/unit/test_import_acorn.js
@@ -1,18 +1,18 @@
-/* Any copyright is dedicated to the Public Domain.
-   http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Test that we can require acorn.
- */
-
-function run_test() {
-  const acorn = require("acorn/acorn");
-  const acorn_loose = require("acorn/acorn_loose");
-  const walk = require("acorn/util/walk");
-  do_check_true(isObject(acorn));
-  do_check_true(isObject(acorn_loose));
-  do_check_true(isObject(walk));
-  do_check_eq(typeof acorn.parse, "function");
-  do_check_eq(typeof acorn_loose.parse_dammit, "function");
-  do_check_eq(typeof walk.simple, "function");
-}
+/* Any copyright is dedicated to the Public Domain.
+   http://creativecommons.org/publicdomain/zero/1.0/ */
+
+/**
+ * Test that we can require acorn.
+ */
+
+function run_test() {
+  const acorn = require("acorn/acorn");
+  const acorn_loose = require("acorn/acorn_loose");
+  const walk = require("acorn/util/walk");
+  do_check_true(isObject(acorn));
+  do_check_true(isObject(acorn_loose));
+  do_check_true(isObject(walk));
+  do_check_eq(typeof acorn.parse, "function");
+  do_check_eq(typeof acorn_loose.parse_dammit, "function");
+  do_check_eq(typeof walk.simple, "function");
+}
--- a/devtools/shared/acorn/tests/unit/test_lenient_parser.js
+++ b/devtools/shared/acorn/tests/unit/test_lenient_parser.js
@@ -1,62 +1,62 @@
-/* Any copyright is dedicated to the Public Domain.
-   http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Test that acorn's lenient parser gives something usable.
- */
-
-const acorn_loose = require("acorn/acorn_loose");
-
-function run_test() {
-  let actualAST = acorn_loose.parse_dammit("let x = 10", {});
-
-  do_print("Actual AST:");
-  do_print(JSON.stringify(actualAST, null, 2));
-  do_print("Expected AST:");
-  do_print(JSON.stringify(expectedAST, null, 2));
-
-  checkEquivalentASTs(expectedAST, actualAST);
-}
-
-const expectedAST = {
-  "type": "Program",
-  "start": 0,
-  "end": 10,
-  "body": [
-    {
-      "type": "ExpressionStatement",
-      "start": 0,
-      "end": 3,
-      "expression": {
-        "type": "Identifier",
-        "start": 0,
-        "end": 3,
-        "name": "let"
-      }
-    },
-    {
-      "type": "ExpressionStatement",
-      "start": 4,
-      "end": 10,
-      "expression": {
-        "type": "AssignmentExpression",
-        "start": 4,
-        "end": 10,
-        "operator": "=",
-        "left": {
-          "type": "Identifier",
-          "start": 4,
-          "end": 5,
-          "name": "x"
-        },
-        "right": {
-          "type": "Literal",
-          "start": 8,
-          "end": 10,
-          "value": 10,
-          "raw": "10"
-        }
-      }
-    }
-  ]
-};
+/* Any copyright is dedicated to the Public Domain.
+   http://creativecommons.org/publicdomain/zero/1.0/ */
+
+/**
+ * Test that acorn's lenient parser gives something usable.
+ */
+
+const acorn_loose = require("acorn/acorn_loose");
+
+function run_test() {
+  let actualAST = acorn_loose.parse_dammit("let x = 10", {});
+
+  do_print("Actual AST:");
+  do_print(JSON.stringify(actualAST, null, 2));
+  do_print("Expected AST:");
+  do_print(JSON.stringify(expectedAST, null, 2));
+
+  checkEquivalentASTs(expectedAST, actualAST);
+}
+
+const expectedAST = {
+  "type": "Program",
+  "start": 0,
+  "end": 10,
+  "body": [
+    {
+      "type": "ExpressionStatement",
+      "start": 0,
+      "end": 3,
+      "expression": {
+        "type": "Identifier",
+        "start": 0,
+        "end": 3,
+        "name": "let"
+      }
+    },
+    {
+      "type": "ExpressionStatement",
+      "start": 4,
+      "end": 10,
+      "expression": {
+        "type": "AssignmentExpression",
+        "start": 4,
+        "end": 10,
+        "operator": "=",
+        "left": {
+          "type": "Identifier",
+          "start": 4,
+          "end": 5,
+          "name": "x"
+        },
+        "right": {
+          "type": "Literal",
+          "start": 8,
+          "end": 10,
+          "value": 10,
+          "raw": "10"
+        }
+      }
+    }
+  ]
+};
--- a/devtools/shared/acorn/tests/unit/test_same_ast.js
+++ b/devtools/shared/acorn/tests/unit/test_same_ast.js
@@ -1,37 +1,37 @@
-/* Any copyright is dedicated to the Public Domain.
-   http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Test that Reflect and acorn create the same AST for ES5.
- */
-
-const acorn = require("acorn/acorn");
-const { Reflect } = require("resource://gre/modules/reflect.jsm");
-
-const testCode = "" + function main () {
-  function makeAcc(n) {
-    return function () {
-      return ++n;
-    };
-  }
-
-  var acc = makeAcc(10);
-
-  for (var i = 0; i < 10; i++) {
-    acc();
-  }
-
-  console.log(acc());
-};
-
-function run_test() {
-  const reflectAST = Reflect.parse(testCode);
-  const acornAST = acorn.parse(testCode);
-
-  do_print("Reflect AST:");
-  do_print(JSON.stringify(reflectAST, null, 2));
-  do_print("acorn AST:");
-  do_print(JSON.stringify(acornAST, null, 2));
-
-  checkEquivalentASTs(reflectAST, acornAST);
-}
+/* Any copyright is dedicated to the Public Domain.
+   http://creativecommons.org/publicdomain/zero/1.0/ */
+
+/**
+ * Test that Reflect and acorn create the same AST for ES5.
+ */
+
+const acorn = require("acorn/acorn");
+const { Reflect } = require("resource://gre/modules/reflect.jsm");
+
+const testCode = "" + function main () {
+  function makeAcc(n) {
+    return function () {
+      return ++n;
+    };
+  }
+
+  var acc = makeAcc(10);
+
+  for (var i = 0; i < 10; i++) {
+    acc();
+  }
+
+  console.log(acc());
+};
+
+function run_test() {
+  const reflectAST = Reflect.parse(testCode);
+  const acornAST = acorn.parse(testCode);
+
+  do_print("Reflect AST:");
+  do_print(JSON.stringify(reflectAST, null, 2));
+  do_print("acorn AST:");
+  do_print(JSON.stringify(acornAST, null, 2));
+
+  checkEquivalentASTs(reflectAST, acornAST);
+}