tor-browser

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

postMessage_Date.sub.htm (1043B)


      1 <!DOCTYPE html>
      2 <html>
      3 <head>
      4 <title> postMessage with Date object </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="{{location[scheme]}}://{{domains[www1]}}:{{location[port]}}/webmessaging/support/ChildWindowPostMessage.htm"></iframe>
     13 </div>
     14 
     15 <script>
     16 
     17 
     18    var description = "Test Description: Messages can contain JavaScript values (e.g., Dates).";
     19 
     20    var t = async_test(description);
     21 
     22    var DATA = new Date();
     23    var TYPE = "object";
     24    var TARGET = document.querySelector("iframe");
     25 
     26    function PostMessageTest()
     27    {
     28        TARGET.contentWindow.postMessage(DATA, "*");
     29    }
     30 
     31    window.onmessage = t.step_func(function(e)
     32    {
     33        assert_equals(typeof(e.data), TYPE);
     34        assert_equals(e.data.valueOf(), DATA.valueOf());
     35        assert_not_equals(e.data, DATA, "Object is cloned");
     36        t.done();
     37    });
     38 </script>
     39 </body>
     40 </html>