Skip to content
This repository has been archived by the owner on Aug 4, 2022. It is now read-only.

Commit

Permalink
Bug 1564555 - Enable some more ESLint rules for layout. r=Standard8,d…
Browse files Browse the repository at this point in the history
…holbert

Differential Revision: https://phabricator.services.mozilla.com/D38007
  • Loading branch information
grlwholifts committed Jul 18, 2019
1 parent 7dc6e68 commit 20eba11
Show file tree
Hide file tree
Showing 21 changed files with 46 additions and 56 deletions.
5 changes: 0 additions & 5 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,23 +196,18 @@ 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-run-test": "off",
"mozilla/use-chromeutils-generateqi": "off",
"mozilla/use-chromeutils-import": "off",
"mozilla/use-default-preference-values": "off",
"mozilla/use-includes-instead-of-indexOf": "off",
"mozilla/use-services": "off",
"mozilla/use-ownerGlobal": "off",
"complexity": "off",
"consistent-return": "off",
"dot-notation": "off",
"no-array-constructor": "off",
"no-caller": "off",
"no-cond-assign": "off",
"no-extra-boolean-cast": "off",
"no-eval": "off",
"no-else-return": "off",
"no-func-assign": "off",
"no-global-assign": "off",
"no-implied-eval": "off",
Expand Down
4 changes: 2 additions & 2 deletions layout/base/tests/bug613807-1.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
return rval;
};
function addLoadEvent(func) {
var existing = window["onload"];
var existing = window.onload;
var regfunc = existing;
if (!(typeof(existing) == 'function'
&& typeof(existing.callStack) == "object"
Expand All @@ -34,7 +34,7 @@
if (typeof(existing) == 'function') {
regfunc.callStack.push(existing);
}
window["onload"] = regfunc;
window.onload = regfunc;
}
regfunc.callStack.push(func);
};
Expand Down
6 changes: 3 additions & 3 deletions layout/base/tests/selection-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ function dragSelectPointsWithData() {
var x2 = arguments[4];
var y2 = arguments[5];
dir = x2 > x1 ? 1 : -1;
event["type"] = "mousedown";
event.type = "mousedown";
synthesizeMouse(e, x1, y1, event);
event["type"] = "mousemove";
event.type = "mousemove";
synthesizeMouse(e, x1 + dir, y1, event);
for (var i = 6; i < arguments.length; ++i) {
synthesizeMouse(e, arguments[i], y1, event);
}
synthesizeMouse(e, x2 - dir, y2, event);
event["type"] = "mouseup";
event.type = "mouseup";
synthesizeMouse(e, x2, y2, event);
}

Expand Down
3 changes: 1 addition & 2 deletions layout/base/tests/test_bug399284.html
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,7 @@
{
var iframeDoc = SpecialPowers.wrap($(frame)).contentDocument;
var size = parseInt(iframeDoc.defaultView.
getComputedStyle(iframeDoc.getElementById("testPara"),
null).
getComputedStyle(iframeDoc.getElementById("testPara")).
getPropertyValue("font-size"));
ok(size > 0, "font size assigned for " + frame);
}
Expand Down
2 changes: 1 addition & 1 deletion layout/generic/test/test_bug344830.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

/** Test for Bug 344830 **/
function getSVG() {
var embed = document.embeds["svg1"];
var embed = document.embeds.svg1;
var svgDocument = embed.getSVGDocument();
var element = svgDocument.getElementById("g1");
ok(embed, "document.embeds[] works with SVG");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@
// and we'll probably want to remove this test function, along with the
// IsXULBoxFrame() check that this test function is targeting in
// ReflowInput::InitDynamicReflowRoot.
is(gFWindow.getComputedStyle(mozBox, "").display, "-moz-box",
is(gFWindow.getComputedStyle(mozBox).display, "-moz-box",
"'display:-moz-box' should be honored and show up in computed style");

let tweakFunc = function() {
Expand Down
10 changes: 4 additions & 6 deletions layout/mathml/tests/test_bug553917.html
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,11 @@
if (name != "MMultiscriptsErrors") {
var formatParams = g_errorInfo[name].args[idx];
if (formatParams.length > 0) {
return g_bundl.formatStringFromName(name,formatParams);
} else {
return g_bundl.GetStringFromName(name);
}
} else {
return g_bundl.GetStringFromName(g_errorInfo[name].args[idx]);
return g_bundl.formatStringFromName(name,formatParams);
}
return g_bundl.GetStringFromName(name);
}
return g_bundl.GetStringFromName(g_errorInfo[name].args[idx]);
}

/** Checks the roll call to see if all expected error messages were present. */
Expand Down
4 changes: 1 addition & 3 deletions layout/mathml/tests/test_bug827713-2.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,7 @@
if (name != "MMultiscriptsErrors") {
return g_bundl.formatStringFromName(name,g_errorInfo[name].args[idx]);
}
else {
return g_bundl.GetStringFromName(g_errorInfo[name].args[idx]);
}
return g_bundl.GetStringFromName(g_errorInfo[name].args[idx]);
}

/** Checks the roll call to see if all expected error messages were present. */
Expand Down
32 changes: 14 additions & 18 deletions layout/style/test/animation_utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -395,11 +395,10 @@ function runOMTATest(aTestFunction, aOnSkip, specialPowersForPrefs) {
}
if (next.done) {
return Promise.resolve(next.value);
} else {
return Promise.resolve(next.value).then(step, function(err) {
throw err;
});
}
return Promise.resolve(next.value).then(step, function(err) {
throw err;
});
}

// Put refresh driver under test control
Expand Down Expand Up @@ -695,9 +694,8 @@ const ExpectComparisonTo = {
return convertArrayTo3dMatrix(matrixLike);
} else if (typeof matrixLike == "object") {
return convertObjectTo3dMatrix(matrixLike);
} else {
return null;
}
return null;
};

// In future most of these methods should be able to be replaced
Expand Down Expand Up @@ -747,9 +745,8 @@ const ExpectComparisonTo = {
array.slice(8, 12),
array.slice(12, 16),
];
} else {
return null;
}
return null;
}

// Return the first defined value in args.
Expand Down Expand Up @@ -797,17 +794,16 @@ const ExpectComparisonTo = {
].join(", ") +
")"
);
} else {
return (
"matrix3d(" +
matrix
.reduce(function(outer, inner) {
return outer.concat(inner);
})
.join(", ") +
")"
);
}
return (
"matrix3d(" +
matrix
.reduce(function(outer, inner) {
return outer.concat(inner);
})
.join(", ") +
")"
);
}

function is2d(matrix) {
Expand Down
2 changes: 1 addition & 1 deletion layout/style/test/bug1382568-iframe.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
window.addEventListener('load', function(){
window[0].document.body.innerText;
window.parent.postMessage({ result: "ok" }, "*");
}, false);
});
</script>
1 change: 1 addition & 0 deletions layout/style/test/property_database.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* eslint-disable dot-notation */
/* vim: set ts=2 sw=2 sts=2 et: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
Expand Down
2 changes: 1 addition & 1 deletion layout/style/test/test_flexbox_order.html
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@

// Initial sanity-check: should be in expected document order
let initialSnapshot = snapshotWindow(window, false);
complainIfSnapshotsDiffer(initialSnapshot, gRefSnapshots["abc"],
complainIfSnapshotsDiffer(initialSnapshot, gRefSnapshots.abc,
"initial flex container rendering, " +
"no 'order' value yet");

Expand Down
2 changes: 1 addition & 1 deletion layout/style/test/test_flexbox_order_abspos.html
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@

// Initial sanity-check: should be in expected document order
let initialSnapshot = snapshotWindow(window, false);
complainIfSnapshotsDiffer(initialSnapshot, gRefSnapshots["abc"],
complainIfSnapshotsDiffer(initialSnapshot, gRefSnapshots.abc,
"initial flex container rendering, " +
"no 'order' value yet");

Expand Down
2 changes: 1 addition & 1 deletion layout/style/test/test_flexbox_order_table.html
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@

// Initial sanity-check: should be in expected document order
let initialSnapshot = snapshotWindow(window, false);
complainIfSnapshotsDiffer(initialSnapshot, gRefSnapshots["abc"],
complainIfSnapshotsDiffer(initialSnapshot, gRefSnapshots.abc,
"initial flex container rendering, " +
"no 'order' value yet");

Expand Down
2 changes: 2 additions & 0 deletions layout/style/test/test_garbage_at_end_of_declarations.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@
<pre id="test">
<script class="testbody" type="text/javascript">

/* eslint-disable dot-notation */
/** Test for correct ExpectEndProperty calls in CSS parser **/


/*
* Inspired by review comments on bug 378217.
*
Expand Down
2 changes: 1 addition & 1 deletion layout/style/test/test_position_float_display.html
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
}
}

var displayInfo = gCSSProperties["display"];
var displayInfo = gCSSProperties.display;
displayInfo.initial_values.forEach(test_display_value);
displayInfo.other_values.forEach(test_display_value);

Expand Down
2 changes: 1 addition & 1 deletion layout/style/test/test_root_node_display.html
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
}
}

var displayInfo = gCSSProperties["display"];
var displayInfo = gCSSProperties.display;
displayInfo.initial_values.forEach(test_display_value);
displayInfo.other_values.forEach(test_display_value);

Expand Down
4 changes: 2 additions & 2 deletions layout/style/test/test_transitions.html
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@
var values = {};
values["text-indent"] = [ 50, 150 ];
values["letter-spacing"] = [ 10, 5 ];
let tf = timingFunctions["ease"];
let tf = timingFunctions.ease;

var time = px_to_num(earlyrefcs.textIndent) / REF_PX_PER_SEC;

Expand Down Expand Up @@ -721,7 +721,7 @@

function check_number_tests()
{
let tf = timingFunctions["ease"];
let tf = timingFunctions.ease;
for (let d in number_tests) {
let test = number_tests[d];
let p = test.node;
Expand Down
4 changes: 2 additions & 2 deletions layout/style/test/test_transitions_events.html
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@
did_finish_five = true;
}
$("five").style.transitionProperty = "margin-left";
}, false);
});

$("six").addEventListener("transitionstart", function() {
if (cs("six").color == "rgb(0, 255, 0)") {
Expand All @@ -252,7 +252,7 @@
$("six").style.transitionDuration = "0s";
$("six").style.transitionDelay = "0s";
$("six").style.color = "blue";
}, false);
});

function poll_start_reversal() {
if (cs("four").color != "rgb(0, 0, 255)") {
Expand Down
9 changes: 5 additions & 4 deletions layout/style/test/test_transitions_per_property.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
<script type="application/javascript">

/* eslint no-shadow: ["error", {"allow": ["prop", "div"]}] */
/* eslint-disable dot-notation */


/** Test for Bug 435441 **/

Expand Down Expand Up @@ -1830,10 +1832,9 @@
if (expectedList.length == 0) {
if (computedValStr == "") {
return true;
} else {
ok(false, "expected basic shape");
return false;
}
}
ok(false, "expected basic shape");
return false;
}

// The regular expression does not filter out the last parenthesis.
Expand Down
2 changes: 1 addition & 1 deletion layout/xul/test/test_bug381167.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function closeit() {

setTimeout(finish, 200);
}
window.addEventListener('load', closeit, false);
window.addEventListener('load', closeit);

function finish()
{
Expand Down

0 comments on commit 20eba11

Please sign in to comment.