tor-browser

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

test_structuredclone_backref.html (876B)


      1 <!DOCTYPE HTML>
      2 <script src="/tests/SimpleTest/SimpleTest.js"></script>
      3 <link rel="stylesheet" href="/tests/SimpleTest/test.css">
      4 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1538622">Mozilla Bug 1538622</a>
      5 
      6 <script>
      7  SimpleTest.waitForExplicitFinish();
      8 
      9  let o1 = new ImageData(25, 1),
     10      o2 = new ImageData(50, 1),
     11      o3 = new ImageData(75, 1),
     12      o4 = new ImageData(100, 1);
     13 
     14  let data = {
     15    img1: o1,
     16    img2: o2,
     17    img3: o3,
     18    img4: o4,
     19    img5: o4,
     20  };
     21 
     22  window.addEventListener("message", windowMessage);
     23 
     24  window.postMessage(data);
     25 
     26  function windowMessage(e) {
     27    let dataCopied = e.data;
     28    ok(dataCopied.img5 instanceof ImageData, "backref ImageData should still be an ImageData");
     29    is(dataCopied.img5, dataCopied.img4, "backref ImageData should be the referenced one");
     30    SimpleTest.finish();
     31  }
     32 </script>