dom/base/test/test_e4x_for_each.html
author Nicholas Nethercote <nnethercote@mozilla.com>
Mon, 05 Oct 2015 16:59:32 -0700
changeset 301715 3897da20e42dec0bcf73987af1eaac4f8ce950b8
parent 126759 178bc511dec97ec9d828f02fc15aa38ab6898961
child 370844 933d53cdb6fe0c6b5bd141e4345735c12aca6bf9
permissions -rw-r--r--
Bug 1211324 (part 3) - Remove GraphicsFilter::FILTER_FAST and replace it with FILTER_BEST. r=mattwoodrow. This may sound like an odd change but it's what the current code effectively already does due to the way ToFilter() and ThebesFilter() are defined.

<!DOCTYPE html>
<html>
<head><meta charset=utf-8>
  <title>Test for E4X "for each" syntax</title>
  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<p id="display"></p>
<div id="content" style="display: none">

</div>
<div id="template" style="display: none">
function runTest(i) {
  var t = tests[i];
  count++;
  try {
    Function("for each (var a in []) {}");
    ok(t.enabled, "JavaScript" + ("version" in t ? " " + t.version : "") + " supports for-each-in");
  } catch (e) {
    ok(!t.enabled, "JavaScript" + ("version" in t ? " " + t.version : "") + " does NOT support for-each-in");
  }
}
</div>
<pre id="test">
<script class="testbody">

var tests = [
  {enabled: false},
  {version: "1.0", enabled: false},
  {version: "1.1", enabled: false},
  {version: "1.2", enabled: false},
  {version: "1.3", enabled: false},
  {version: "1.4", enabled: false},
  {version: "1.5", enabled: false},
  {version: "1.6", enabled: true},
  {version: "1.7", enabled: true},
  {version: "1.8", enabled: true},
];

var count = 0;
for (var i = 0; i < tests.length; i++) {
  var t = tests[i];
  var script = document.createElement("script");
  script.type = "application/javascript" + ("version" in t ? ";version=" + t.version : "");
  script.textContent = document.getElementById("template").textContent + "\n" + "runTest(" + i + ");";
  document.body.appendChild(script);
}
script = document.createElement("script");
script.textContent = 'is(count, tests.length, "runTest() call count");';
document.body.appendChild(script);
</script>
</pre>
</body>
</html>