tor-browser

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

util.js (763B)


      1 function sandbox_iframe_test(sandbox, src, title) {
      2  return promise_test(async t => {
      3    const iframe = document.createElement("iframe");
      4    if (sandbox !== "")
      5      iframe.sandbox = sandbox;
      6    iframe.src = src;
      7 
      8    let msg = await new Promise(resolve => {
      9      window.addEventListener('message', resolve);
     10      document.body.appendChild(iframe);
     11    });
     12 
     13    assert_equals(msg.data, "PASS", "message from opened frame");
     14    await fetch("/client-hints/accept-ch-stickiness/resources/clear-site-data.html");
     15  }, title);
     16 }
     17 
     18 function sandbox_popup_listener(src) {
     19  window.addEventListener('message', e => {
     20    window.parent.postMessage(e.data, '*');
     21  });
     22 
     23  let popup_window = window.open("/resources/blank.html");
     24  popup_window.location.href = src;
     25 }