tor-browser

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

postMessage_dup_transfer_objects.htm (1108B)


      1 <!DOCTYPE html>
      2 <html>
      3 <head>
      4 <title> postMessage with duplicate transfer objects raises DataCloneError exception </title>
      5 <script src="/resources/testharness.js"></script>
      6 <script src="/resources/testharnessreport.js"></script>
      7 </head>
      8 <body>
      9 <div id=log></div>
     10 
     11 <div style="display:none">
     12    <iframe width="70%" onload="PostMessageTest()" src="./support/ChildWindowPostMessage.htm"></iframe>
     13 </div>
     14 
     15 <script>
     16 
     17 
     18    var description = "Test Description: " +
     19                      "postMessage with duplicate transfer objects raises DataCloneError exception.";
     20 
     21    var DATA = "ports";
     22    var TARGET = document.querySelector("iframe");
     23 
     24    function PostMessageTest()
     25    {
     26        test(function()
     27        {
     28            assert_throws_dom("DATA_CLONE_ERR", TARGET.contentWindow.DOMException, function()
     29            {
     30                assert_own_property(window, "MessageChannel", "window");
     31                var channel = new MessageChannel();
     32                TARGET.contentWindow.postMessage(DATA, "*", [channel.port1, channel.port1]);
     33            });
     34        }, description);
     35    }
     36 </script>
     37 </body>
     38 </html>