tor-browser

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

cross-origin-transfer-resizable-arraybuffer.html (965B)


      1 <!DOCTYPE html>
      2 <title>postMessage transfer ArrayBuffer cross origin iframe</title>
      3 <script src='/resources/testharness.js'></script>
      4 <script src='/resources/testharnessreport.js'></script>
      5 <script src='/common/get-host-info.sub.js'></script>
      6 
      7 <script>
      8 
      9 async_test(t => {
     10  const oopif = document.createElement('iframe');
     11 
     12  window.addEventListener('message', t.step_func((e) => {
     13    if (e.data === 'started') {
     14      const rab = new ArrayBuffer(32, { maxByteLength: 1024 });
     15      oopif.contentWindow.postMessage(rab, '*', [rab]);
     16    } else {
     17      assert_equals(e.data, 'byteLength=32,maxByteLength=1024,resizable=true');
     18      t.done();
     19    }
     20  }));
     21 
     22  window.addEventListener('load', () => {
     23    oopif.src = `${get_host_info().HTTP_REMOTE_ORIGIN}/html/infrastructure/safe-passing-of-structured-data/resources/iframe-resizable-arraybuffer-helper.html`;
     24    document.body.appendChild(oopif);
     25  });
     26 }, 'postMessaging resizable ArrayBuffer to OOPIF');
     27 
     28 </script>