tor-browser

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

remove-own-iframe-during-onerror.window.js (634B)


      1 // META: script=constants.sub.js
      2 // META: timeout=long
      3 // META: variant=?default
      4 // META: variant=?wss
      5 // META: variant=?wpt_flags=h2
      6 
      7 async_test(t => {
      8  window.wsurl = SCHEME_DOMAIN_PORT + '/does-not-exist';
      9  let wsframe;
     10  window.wsonerror = () => {
     11    wsframe.remove();
     12    // If this didn't crash then the test passed.
     13    t.done();
     14  };
     15  wsframe = document.createElement('iframe');
     16  wsframe.srcdoc = `<script>
     17 const ws = new WebSocket(parent.wsurl);
     18 ws.onerror = parent.wsonerror;
     19 </script>`;
     20  onload = () => document.body.appendChild(wsframe);
     21 }, 'removing an iframe from within an onerror handler should work');
     22 
     23 done();