tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

test_bug862380.html (1605B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <!--
      4 https://bugzilla.mozilla.org/show_bug.cgi?id=862380
      5 -->
      6 <head>
      7  <meta charset="utf-8">
      8  <title>Test for Bug 862380</title>
      9  <script src="/tests/SimpleTest/SimpleTest.js"></script>
     10  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
     11  <script type="application/javascript">
     12 
     13  /** Test for Bug 862380 **/
     14  SimpleTest.waitForExplicitFinish();
     15  function go() {
     16    checkNotEnumerable($('ifr').contentWindow, true);
     17    checkNotEnumerable($('ifr').contentWindow.location, false);
     18    SimpleTest.finish();
     19  }
     20 
     21 function checkNotEnumerable(obj, isWindow) {
     22    try {
     23      const expectedWindow = ["0"];
     24      const expectedLocation = [];
     25      const expected = isWindow ? expectedWindow : expectedLocation;
     26      is(Object.keys(obj).length, expected.length,
     27         "Object.keys gives right array length");
     28      var actual = [];
     29      for (var i in obj)
     30        actual.push(i);
     31      is(actual.length, expected.length,
     32         "Enumeration sees the right number of props");
     33      actual.sort();
     34      expected.sort();
     35      for (var i = 0; i < actual.length; ++i)
     36        is(actual[i], expected[i], "Arrays should be the same " + i);
     37    } catch (e) {
     38      ok(false, "threw: " + e);
     39    }
     40  }
     41 
     42  </script>
     43 </head>
     44 <body>
     45 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=862380">Mozilla Bug 862380</a>
     46 <p id="display"></p>
     47 <div id="content" style="display: none">
     48 
     49 </div>
     50 <iframe id="ifr" onload="go();" src="http://example.org/tests/js/xpconnect/tests/mochitest/file_empty.html"></iframe>
     51 <pre id="test">
     52 </pre>
     53 </body>
     54 </html>