tor-browser

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

promise-job-incumbent-incumbent.html (1055B)


      1 <!DOCTYPE html>
      2 <meta charset="utf-8">
      3 <title>Incumbent page used as a test helper</title>
      4 
      5 <iframe src="relevant/relevant.html" id="r"></iframe>
      6 <iframe src="current/current.html" id="c"></iframe>
      7 
      8 <script>
      9  const relevant = document.querySelector("#r");
     10  const current = document.querySelector("#c");
     11 
     12  window.runWindowPostMessageVeryIndirectly = (...args) => {
     13    return current.contentWindow.postMessage.call(relevant.contentWindow, ...args);
     14  };
     15 
     16  // This tests the backup incumbent settings object stack scenario, by avoiding putting user code on the stack.
     17  window.runWindowPostMessageVeryIndirectlyWithNoUserCode = (promise, promiseMethod, ...args) => {
     18    const runWindowPostMessage = current.contentWindow.postMessage.bind(relevant.contentWindow, ...args);
     19    promise[promiseMethod](runWindowPostMessage);
     20  };
     21 
     22  window.resolveThenableThatRunsWindowPostMessageVeryIndirectlyWithNoUserCode = (...args) => {
     23    Promise.resolve({
     24      then: current.contentWindow.postMessage.bind(relevant.contentWindow, ...args)
     25    });
     26  };
     27 </script>