tor-browser

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

test_crossOriginWindowSymbolAccess.html (1273B)


      1 <!DOCTYPE html>
      2 <meta charset=utf-8>
      3 <title>Test for accessing symbols on a cross-origin window</title>
      4 <script src="/resources/testharness.js"></script>
      5 <script src="/resources/testharnessreport.js"></script>
      6 <div id="log"></div>
      7 <iframe id="sameProc" src="http://test1.mochi.test:8888/tests/js/xpconnect/tests/mochitest/file_empty.html"></iframe>
      8 <iframe id="crossProc" src="http://www1.w3c-test.org/common/blank.html"></iframe>
      9 <script>
     10 /* global async_test, assert_equals, assert_throws */
     11 
     12 async_test(function(t) {
     13  window.addEventListener("load", t.step_func(
     14    function() {
     15      assert_equals(document.getElementById("sameProc").contentDocument, null, "Should have a crossorigin frame");
     16      assert_equals(document.getElementById("crossProc").contentDocument, null, "Should have a crossorigin frame");
     17      for (let f of [0, 1]) {
     18        assert_throws("SecurityError", function() {
     19          frames[f][Symbol.iterator];
     20        }, "Should throw exception on cross-origin Window symbol-named get");
     21        assert_throws("SecurityError", function() {
     22          frames[f].location[Symbol.iterator];
     23        }, "Should throw exception on cross-origin Location symbol-named get");
     24      }
     25      t.done();
     26    }
     27  ));
     28 }, "Check Symbol access on load");
     29 </script>