message-received.html (1311B)
1 <!DOCTYPE html> 2 <title>"A WebSocket message has been received", with multiple globals in play</title> 3 <link rel="help" href="https://html.spec.whatwg.org/multipage/comms.html#feedback-from-the-protocol"> 4 <link rel="author" title="Domenic Denicola" href="mailto:d@domenic.me"> 5 <script src="/resources/testharness.js"></script> 6 <script src="/resources/testharnessreport.js"></script> 7 8 <!-- This is the entry global --> 9 10 <iframe src="support/incumbent.sub.html"></iframe> 11 12 <script> 13 "use strict"; 14 setup({ explicit_done: true }); 15 16 window.onload = function() { 17 async_test(function(t) { 18 frames[0].setupWebSocket("arraybuffer", t.step_func_done(function(relevantWindow, event) { 19 assert_equals(event.constructor, relevantWindow.MessageEvent); 20 assert_equals(event.data.constructor, relevantWindow.ArrayBuffer); 21 })); 22 }, "ArrayBuffer should be created in the relevant realm of the WebSocket"); 23 24 async_test(function(t) { 25 frames[0].setupWebSocket("blob", t.step_func_done(function(relevantWindow, event) { 26 assert_equals(event.constructor, relevantWindow.MessageEvent); 27 assert_equals(event.data.constructor, relevantWindow.Blob); 28 })); 29 }, "Blob should be created in the relevant realm of the WebSocket"); 30 31 done(); 32 }; 33 </script>