dom/base/test/test_e4x_for_each.html

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     1 <!DOCTYPE html>
     2 <html>
     3 <head><meta charset=utf-8>
     4   <title>Test for E4X "for each" syntax</title>
     5   <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
     6   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
     7 </head>
     8 <body>
     9 <p id="display"></p>
    10 <div id="content" style="display: none">
    12 </div>
    13 <div id="template" style="display: none">
    14 function runTest(i) {
    15   var t = tests[i];
    16   count++;
    17   try {
    18     Function("for each (var a in []) {}");
    19     ok(t.enabled, "JavaScript" + ("version" in t ? " " + t.version : "") + " supports for-each-in");
    20   } catch (e) {
    21     ok(!t.enabled, "JavaScript" + ("version" in t ? " " + t.version : "") + " does NOT support for-each-in");
    22   }
    23 }
    24 </div>
    25 <pre id="test">
    26 <script class="testbody">
    28 var tests = [
    29   {enabled: false},
    30   {version: "1.0", enabled: false},
    31   {version: "1.1", enabled: false},
    32   {version: "1.2", enabled: false},
    33   {version: "1.3", enabled: false},
    34   {version: "1.4", enabled: false},
    35   {version: "1.5", enabled: false},
    36   {version: "1.6", enabled: true},
    37   {version: "1.7", enabled: true},
    38   {version: "1.8", enabled: true},
    39 ];
    41 var count = 0;
    42 for (var i = 0; i < tests.length; i++) {
    43   var t = tests[i];
    44   var script = document.createElement("script");
    45   script.type = "application/javascript" + ("version" in t ? ";version=" + t.version : "");
    46   script.textContent = document.getElementById("template").textContent + "\n" + "runTest(" + i + ");";
    47   document.body.appendChild(script);
    48 }
    49 script = document.createElement("script");
    50 script.textContent = 'is(count, tests.length, "runTest() call count");';
    51 document.body.appendChild(script);
    52 </script>
    53 </pre>
    54 </body>
    55 </html>

mercurial