tor-browser

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

test_bug850517.html (1880B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <!--
      4 https://bugzilla.mozilla.org/show_bug.cgi?id=850517
      5 -->
      6 <head>
      7  <meta charset="utf-8">
      8  <title>Test for Bug 850517</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 live updating of named child resolution. */
     14  SimpleTest.waitForExplicitFinish();
     15 
     16  function go() {
     17    var ifrA = $('a');
     18    var ifrB = $('b');
     19    var sb = new SpecialPowers.Cu.Sandbox('http://www.example.com');
     20    sb.win = window;
     21    sb.childA = ifrA.contentWindow;
     22    sb.childB = ifrB.contentWindow;
     23    SpecialPowers.setWrapped(sb, 'is', SpecialPowers.wrapFor(is, sb));
     24    SpecialPowers.setWrapped(sb, 'ok', SpecialPowers.wrapFor(ok, sb));
     25    is(window.theoneandonly.frameElement, ifrA, "Named child resolution works");
     26    SpecialPowers.Cu.evalInSandbox('is(win.theoneandonly, childA, "Named child resolution works via Xray");', sb);
     27    ifrA.removeAttribute('name');
     28    is(typeof window.theoneandonly, 'undefined', "Revocation works");
     29    SpecialPowers.Cu.evalInSandbox('try { win.theoneandonly; ok(false, "Should have thrown"); } ' +
     30                                   'catch (e) {ok(!!/denied/.exec(e) && !!/theoneandonly/.exec(e), "Revocation works via Xray");};', sb);
     31    ifrB.setAttribute('name', 'theoneandonly');
     32    is(window.theoneandonly.frameElement, ifrB, "Another mule kicking in the same old stall");
     33    SpecialPowers.Cu.evalInSandbox('is(win.theoneandonly, childB, "Another mule via Xray");', sb);
     34    SimpleTest.finish();
     35  }
     36 
     37  </script>
     38 </head>
     39 <body onload="go();">
     40 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=850517">Mozilla Bug 850517</a>
     41 <p id="display"></p>
     42 <iframe id="a" name="theoneandonly"></iframe>
     43 <iframe id="b"></iframe>
     44 <pre id="test">
     45 </pre>
     46 </body>
     47 </html>