Skip to content

Commit

Permalink
Bug 1596160: Re-enable eslint rules within layout and address eslint …
Browse files Browse the repository at this point in the history
…failures in testcases r=dholbert

This patch was largely automated. It was generated by manually
editing .eslintrc.js and then running mach eslint layout --fix.

Additionally, this includes manual changes to test_bug533845.xhtml
and test_bug467442.xhtml that were necessary to appease eslint.

Differential Revision: https://phabricator.services.mozilla.com/D78615
  • Loading branch information
kenrick95 committed Jun 9, 2020
1 parent d15d1ec commit e19482b
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 34 deletions.
3 changes: 0 additions & 3 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,6 @@ module.exports = {
"mozilla/reject-importGlobalProperties": "off",
"mozilla/no-arbitrary-setTimeout": "off",
"mozilla/no-define-cc-etc": "off",
"mozilla/no-useless-parameters": "off",
"mozilla/no-useless-removeEventListener": "off",
"mozilla/use-chromeutils-generateqi": "off",
"mozilla/use-default-preference-values": "off",
"mozilla/use-includes-instead-of-indexOf": "off",
Expand All @@ -208,7 +206,6 @@ module.exports = {
"no-restricted-globals": "off",
"no-return-await": "off",
"no-sequences": "off",
"no-shadow": "off",
"no-throw-literal": "off",
"no-useless-concat": "off",
"no-undef": "off",
Expand Down
24 changes: 12 additions & 12 deletions layout/base/tests/chrome/test_bug420499.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -78,47 +78,47 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=420499
ok(!isCaretVisible(), "Caret shouldn't be visible");
$("text-input").focus();
ok(isCaretVisible(), "Caret should be visible when input focused");
window.addEventListener("popupshown", popupMenuShownHandler, false);
window.addEventListener("popupshown", popupMenuShownHandler);
$("menu").open = true;
}

function popupMenuShownHandler() {
window.removeEventListener("popupshown", popupMenuShownHandler, false);
window.removeEventListener("popupshown", popupMenuShownHandler);
ok(!isCaretVisible(), "Caret shouldn't be visible when menu open");
window.addEventListener("popuphidden", ensureParagraphFocused, false);
window.addEventListener("popuphidden", ensureParagraphFocused);
$("menu").open = false;
}

function ensureParagraphFocused() {
window.removeEventListener("popuphidden", ensureParagraphFocused, false);
window.removeEventListener("popuphidden", ensureParagraphFocused);
ok(isCaretVisible(), "Caret should have returned to previous focus");
window.addEventListener("popupshown", popupMenuShownHandler2, false);
window.addEventListener("popupshown", popupMenuShownHandler2);
$("contextmenu").openPopup($('text-input'), "topleft" , -1 , -1 , true, true);
}

function popupMenuShownHandler2() {
window.removeEventListener("popupshown", popupMenuShownHandler2, false);
window.removeEventListener("popupshown", popupMenuShownHandler2);
ok(isCaretVisible(), "Caret should be visible when context menu open");
window.addEventListener("popuphidden", ensureParagraphFocused2, false);
window.addEventListener("popuphidden", ensureParagraphFocused2);
document.getElementById("contextmenu").hidePopup();
}

function ensureParagraphFocused2() {
window.removeEventListener("popuphidden", ensureParagraphFocused2, false);
window.removeEventListener("popuphidden", ensureParagraphFocused2);
ok(isCaretVisible(), "Caret should still be visible");
window.addEventListener("popupshown", tooltipShownHandler, false);
window.addEventListener("popupshown", tooltipShownHandler);
$("tooltip").openPopup($('text-input'), "topleft" , -1 , -1 , false, true);
}

function tooltipShownHandler() {
window.removeEventListener("popupshown", tooltipShownHandler, false);
window.removeEventListener("popupshown", tooltipShownHandler);
ok(isCaretVisible(), "Caret should be visible when tooltip is visible");
window.addEventListener("popuphidden", ensureParagraphFocused3, false);
window.addEventListener("popuphidden", ensureParagraphFocused3);
document.getElementById("tooltip").hidePopup();
}

function ensureParagraphFocused3() {
window.removeEventListener("popuphidden", ensureParagraphFocused2, false);
window.removeEventListener("popuphidden", ensureParagraphFocused2);
ok(isCaretVisible(), "Caret should still be visible");
SimpleTest.finish();
}
Expand Down
6 changes: 2 additions & 4 deletions layout/base/tests/chrome/test_bug533845.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,12 @@ SimpleTest.waitForExplicitFinish();
function doTest() {
let panel = document.getElementById("panel");
panel.addEventListener("popupshown", function onpopupshown() {
panel.removeEventListener("popupshown", onpopupshown);
continueTest();
panel.addEventListener("popuphidden", function onpopuphidden() {
panel.removeEventListener("popuphidden", onpopuphidden);
SimpleTest.finish();
});
}, { once: true });
panel.hidePopup();
});
}, { once: true });
panel.openPopup();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
}

function setupWindow() {
win.addEventListener("load", doTest, false);
win.addEventListener("load", doTest);
win.focus();
}

Expand Down
6 changes: 3 additions & 3 deletions layout/generic/test/test_bug469774.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function snapShot() {
}

function doTest() {
window.removeEventListener("focus", doTest, false);
window.removeEventListener("focus", doTest);

var before = snapShot();

Expand All @@ -61,11 +61,11 @@ function doTest() {

popup.hidePopup();
SimpleTest.finish();
}, false);
});
}

SimpleTest.waitForExplicitFinish();
window.addEventListener("focus", doTest, false);
window.addEventListener("focus", doTest);

]]></script>

Expand Down
2 changes: 1 addition & 1 deletion layout/style/test/chrome/test_bug535806.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=535806

window.addEventListener("load", function() {
$("f").setAttribute("src", "bug535806-html.html");
}, false);
});

function htmlLoaded() {
$("f").setAttribute("src", "bug535806-xul.xhtml");
Expand Down
6 changes: 2 additions & 4 deletions layout/xul/test/test_bug467442.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,14 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=467442
let anchor = document.getElementById("anchor");

panel.addEventListener("popupshown", function onpopupshown() {
panel.removeEventListener("popupshown", onpopupshown);
let panelRect = panel.getBoundingClientRect();
let anchorRect = anchor.getBoundingClientRect();
is(panelRect.left, anchorRect.left, "Panel should be anchored to the button");
panel.addEventListener("popuphidden", function onpopuphidden() {
panel.removeEventListener("popuphidden", onpopuphidden);
SimpleTest.finish();
});
}, { once: true });
panel.hidePopup();
});
}, { once: true });

panel.openPopup(anchor, "after_start", 0, 0, false, false);
}
Expand Down
8 changes: 4 additions & 4 deletions layout/xul/test/test_submenuClose.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1181560
mainMenu = document.getElementById("menu");
menuB = document.getElementById("b");
menuC = document.getElementById("c");
menuB.menupopup.addEventListener("popupshown", handleBOpens, false);
menuB.menupopup.addEventListener("popuphidden", handleBCloses, false);
menuC.menupopup.addEventListener("popupshown", handleCOpens, false);
menuC.menupopup.addEventListener("popuphidden", handleCCloses, false);
menuB.menupopup.addEventListener("popupshown", handleBOpens);
menuB.menupopup.addEventListener("popuphidden", handleBCloses);
menuC.menupopup.addEventListener("popupshown", handleCOpens);
menuC.menupopup.addEventListener("popuphidden", handleCCloses);
mainMenu.addEventListener("popupshown", ev => {
synthesizeMouseAtCenter(menuB, {}, window);
});
Expand Down
4 changes: 2 additions & 2 deletions layout/xul/test/test_windowminmaxsize.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,8 @@ function titledPanelWindowOpened(panelwindow)
{
var panel = panelwindow.document.documentElement.firstChild;
panel.openPopup();
panel.addEventListener("popupshown", () => doTitledPanelTest(panel), false);
panel.addEventListener("popuphidden", () => done(panelwindow), false);
panel.addEventListener("popupshown", () => doTitledPanelTest(panel));
panel.addEventListener("popuphidden", () => done(panelwindow));
}

function doTitledPanelTest(panel)
Expand Down

0 comments on commit e19482b

Please sign in to comment.