tor-browser

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

structured-clone-cross-realm-method.html (732B)


      1 <!doctype html>
      2 <title>self.structuredClone() uses this's relevant Realm for deserialization</title>
      3 <link rel="help" href="https://html.spec.whatwg.org/multipage/structured-data.html#structured-cloning">
      4 <script src="/resources/testharness.js"></script>
      5 <script src="/resources/testharnessreport.js"></script>
      6 
      7 <body>
      8 <script>
      9 const iframe = document.createElement("iframe");
     10 iframe.onload = () => {
     11  const otherWindow = iframe.contentWindow;
     12  for (const key of ["Object", "Array", "Date", "RegExp"]) {
     13    test(() => {
     14      const cloned = otherWindow.structuredClone.call(window, new otherWindow[key]);
     15      assert_true(cloned instanceof window[key]);
     16    }, `${key} instance`);
     17  }
     18 };
     19 document.body.append(iframe);
     20 </script>