tor-browser

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

response-blob-realm.any.js (754B)


      1 // META: global=window
      2 // META: title=realm of Response bytes()
      3 
      4 "use strict";
      5 
      6 promise_test(async () => {
      7  await new Promise(resolve => {
      8    onload = resolve;
      9  });
     10 
     11  let iframe = document.createElement("iframe");
     12  document.body.appendChild(iframe);
     13  iframe.srcdoc = "<!doctype html>";
     14  await new Promise(resolve => {
     15    iframe.onload = resolve;
     16  });
     17 
     18  let otherRealm = iframe.contentWindow;
     19 
     20  let ab = await window.Response.prototype.bytes.call(new otherRealm.Response(""));
     21 
     22  assert_true(ab instanceof otherRealm.Uint8Array, "Uint8Array should be created in receiver's realm");
     23  assert_false(ab instanceof Uint8Array, "Uint8Array should not be created in the bytes() methods's realm");
     24 }, "realm of the Uint8Array from Response bytes()");