Bug 1287005 - Normalize line endings in devtools/; r=fitzgen

MozReview-Commit-ID: 9Wxx2WUa0Aj

--HG--
extra : rebase_source : 9f1c884dcd1bb037cccfeac7f57eb068e52a9af1
This commit is contained in:
Gregory Szorc 2016-07-14 17:38:50 -07:00
Родитель 73ec204121
Коммит 854bc387ee
6 изменённых файлов: 280 добавлений и 280 удалений

Просмотреть файл

@ -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);
}

Просмотреть файл

@ -2,57 +2,57 @@
/* 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);
});
}

Просмотреть файл

@ -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;
});

Просмотреть файл

@ -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");
}

Просмотреть файл

@ -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"
}
}
}
]
};

Просмотреть файл

@ -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);
}