tor-browser

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

response-clone-iframe.window.js (794B)


      1 // Verify that calling Response clone() in a detached iframe doesn't crash.
      2 // Regression test for https://crbug.com/1082688.
      3 
      4 'use strict';
      5 
      6 promise_test(async () => {
      7  // Wait for the document body to be available.
      8  await new Promise(resolve => {
      9    onload = resolve;
     10  });
     11 
     12  window.iframe = document.createElement('iframe');
     13  document.body.appendChild(iframe);
     14  iframe.srcdoc = `<!doctype html>
     15 <script>
     16 const response = new Response('body');
     17 window.parent.postMessage('okay', '*');
     18 window.parent.iframe.remove();
     19 response.clone();
     20 </script>
     21 `;
     22 
     23  await new Promise(resolve => {
     24    onmessage = evt => {
     25      if (evt.data === 'okay') {
     26        resolve();
     27      }
     28    };
     29  });
     30 
     31  // If it got here without crashing, the test passed.
     32 }, 'clone within removed iframe should not crash');