gecko-dev/layout/style/test/test_bug635286.html
Rob Wu 4a6f84f91d Bug 1544834 - Replace deprecated generics in test code r=evilpie
- `Array.map` becomes `Array.from`
- Array copying via `Array.slice` becomes `Array.from`.
- `Array.forEach` that did not rely on closures becomes `for`-`of` loops.
- Anything else: `Array.X` becomes `Array.prototype.X`.

Complex cases:

dom/bindings/test/TestInterfaceJS.js and
dom/bindings/test/test_exception_options_from_jsimplemented.html
use `Array.indexOf` to generate an error with a specific error message.
Switched to `Array.prototype.forEach` to generate the same error.

js/src/jit-test/tests/basic/exception-column-number.js
In this test `Array.indexOf()` is used to generate an error. Since the
exact message doesn't matter, I switched to `Array.from()`.

Intentionally not changed:

editor/libeditor/tests/browserscope/lib/richtext/richtext/js/range.js
Did not modify because this is 3rd-party code and the code uses
feature detection as a fall back when Array generics are not used.

testing/talos/talos/tests/dromaeo/lib/mootools.js
Did not modify because mootools adds the `Array.slice` method to the
`Array` object.

Not changed because they check the implementation of Array generics:
js/src/jit-test/tests/basic/arrayNatives.js
js/src/jit-test/tests/basic/bug563243.js
js/src/jit-test/tests/basic/bug618853.js
js/src/jit-test/tests/basic/bug830967.js
js/src/jit-test/tests/jaeger/recompile/bug656753.js
js/src/jit-test/tests/self-hosting/alternate-static-and-instance-array-extras.js
js/src/tests/non262/Array/generics.js
js/src/tests/non262/Array/regress-415540.js
js/src/tests/non262/extensions/regress-355497.js
js/src/tests/non262/extensions/typedarray-set-neutering.js

Depends on D27802

Differential Revision: https://phabricator.services.mozilla.com/D27803

--HG--
extra : moz-landing-system : lando
2019-04-17 19:03:19 +00:00

53 lines
1.7 KiB
HTML

<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=635286
-->
<head>
<title>Test for Bug 635286</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
<style type="text/css">
div { background: transparent; }
:-moz-any(#case1.before) { background: gray; }
#case2:not(.after) { background: gray; }
:-moz-any(#case3:not(.after)) { background: gray; }
#case4:not(:-moz-any(.after)) { background: gray; }
</style>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=635286">Mozilla Bug 635286</a>
<div id="case1" class="before">case1, :-moz-any()</div>
<div id="case2" class="before">case2, :not()</div>
<div id="case3" class="before">case3, :not() in :-moz-any()</div>
<div id="case4" class="before">case4, :-moz-any() in :not()</div>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Bug 635286 **/
window.addEventListener("load", function() {
var cases = Array.from(document.getElementsByTagName("div"));
cases.forEach(function(aCase, aIndex) {
aCase.className = "after";
});
window.setTimeout(function() {
cases.forEach(function(aCase, aIndex) {
is(window.getComputedStyle(aCase)
.getPropertyValue("background-color"),
"rgba(0, 0, 0, 0)",
aCase.textContent);
});
SimpleTest.finish();
}, 1);
});
SimpleTest.waitForExplicitFinish();
SimpleTest.requestFlakyTimeout("untriaged");
</script>
</pre>
</body>
</html>