tor-browser

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

027.html (797B)


      1 <!doctype html>
      2 <title>message channel as ports</title>
      3 <script src="/resources/testharness.js"></script>
      4 <script src="/resources/testharnessreport.js"></script>
      5 <div id=log></div>
      6 <script>
      7 async_test(function(t) {
      8  var channel = new MessageChannel();
      9  postMessage('', '*', [channel.port1, channel.port2]);
     10  onmessage = t.step_func(function(e) {
     11    assert_equals(e.ports.length, 2);
     12    t.done();
     13  });
     14 }, "MessageChannel's ports as MessagePort objects");
     15 
     16 test(() => {
     17  var channel = new MessageChannel();
     18  channel[0] = channel.port1;
     19  channel[1] = channel.port2;
     20  channel.length = 2;
     21  assert_throws_js(TypeError,
     22                   () => { postMessage('', '*', channel) },
     23                   'Old-style WebIDL arrays must throw a type error');
     24 }, "Old-style array objects");
     25 </script>