Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(72)

Side by Side Diff: third_party/WebKit/LayoutTests/fast/events/message-port.html

Issue 1903873004: Deprecate window.postMessage(m, transferables, origin) overload. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <body> 1 <body>
2 <p>Test cross-frame MessagePort communication.</p> 2 <p>Test cross-frame MessagePort communication.</p>
3 <p>Should be a series of SUCCESS messages, followed with DONE.</p> 3 <p>Should be a series of SUCCESS messages, followed with DONE.</p>
4 <pre id=log></pre> 4 <pre id=log></pre>
5 <script> 5 <script>
6 function log(message) 6 function log(message)
7 { 7 {
8 document.getElementById("log").innerHTML += message + "<br>"; 8 document.getElementById("log").innerHTML += message + "<br>";
9 } 9 }
10 10
11 if (window.testRunner) { 11 if (window.testRunner) {
12 testRunner.dumpAsText(); 12 testRunner.dumpAsText();
13 testRunner.waitUntilDone(); 13 testRunner.waitUntilDone();
14 } 14 }
15 15
16 var mainPort; 16 var mainPort;
17 17
18 var allTests; 18 var allTests;
19 var currentTest = 0; 19 var currentTest = 0;
20 20
21 function nextTest() 21 function nextTest()
22 { 22 {
23 var fun = "postMessage"; 23 var fun = "postMessage";
24 var testFunNo = Math.floor(currentTest / 2); 24 var testFunNo = Math.floor(currentTest / 2);
25 if (testFunNo < allTests.length) 25 if (testFunNo < allTests.length)
26 { 26 {
27 var test = allTests[testFunNo]; 27 var test = allTests[testFunNo];
28 currentTest++; 28 currentTest++;
29 test(fun); 29 test(fun);
30 } 30 }
31 else 31 else
32 { 32 {
33 done(); 33 done();
34 } 34 }
35 } 35 }
36 36
37 function test(postMessageFun) 37 function test(postMessageFun)
38 { 38 {
39 var channel = new MessageChannel; 39 var channel = new MessageChannel;
40 40
41 window.frames[0][postMessageFun]("msg", [channel.port2], "*"); 41 window.frames[0][postMessageFun]("msg", "*", [channel.port2]);
42 mainPort = channel.port1; 42 mainPort = channel.port1;
43 mainPort[postMessageFun]("ping"); 43 mainPort[postMessageFun]("ping");
44 mainPort.onmessage = function(evt) { 44 mainPort.onmessage = function(evt) {
45 if (evt.data == "pong" && evt.origin == "") 45 if (evt.data == "pong" && evt.origin == "")
46 log("Simple exchange: SUCCESS"); 46 log("Simple exchange: SUCCESS");
47 else 47 else
48 log("Simple exchange: FAIL. Got message '" + evt.data + "' from '" + evt.origin + "'."); 48 log("Simple exchange: FAIL. Got message '" + evt.data + "' from '" + evt.origin + "'.");
49 nextTest(); 49 nextTest();
50 }; 50 };
51 } 51 }
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 if (window.testRunner) 122 if (window.testRunner)
123 testRunner.notifyDone(); 123 testRunner.notifyDone();
124 }, 100); 124 }, 100);
125 } 125 }
126 126
127 allTests = [ test, test2, test3, test4, test5, test6 ] 127 allTests = [ test, test2, test3, test4, test5, test6 ]
128 128
129 </script> 129 </script>
130 <iframe src="resources/message-port-iframe.html" onload="nextTest()"></iframe> 130 <iframe src="resources/message-port-iframe.html" onload="nextTest()"></iframe>
131 </body> 131 </body>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698