OLD | NEW |
1 <html> | 1 <html> |
2 <head></head> | 2 <head></head> |
3 <body> | 3 <body> |
4 <div id="description"></div> | 4 <div id="description"></div> |
5 <div id="console"></div> | 5 <div id="console"></div> |
6 <script> | 6 <script> |
7 if (window.testRunner) { | 7 if (window.testRunner) { |
8 testRunner.dumpAsText(); | 8 testRunner.dumpAsText(); |
9 testRunner.waitUntilDone(); | 9 testRunner.waitUntilDone(); |
10 } | 10 } |
(...skipping 24 matching lines...) Expand all Loading... |
35 } | 35 } |
36 } | 36 } |
37 | 37 |
38 function tryPostMessage(first, second, third, shouldFail) { | 38 function tryPostMessage(first, second, third, shouldFail) { |
39 tryPostMessageFunction(window.postMessage, first, second, third, shouldFail)
; | 39 tryPostMessageFunction(window.postMessage, first, second, third, shouldFail)
; |
40 } | 40 } |
41 | 41 |
42 document.getElementById("description").innerHTML = "Test that the second argumen
t of window.postMessage is ignored or triggers an error if it is not a message p
ort. You should see PASS message '1' through '7', followed by 'done', with messa
ges 4-7 received below.<br><br>"; | 42 document.getElementById("description").innerHTML = "Test that the second argumen
t of window.postMessage is ignored or triggers an error if it is not a message p
ort. You should see PASS message '1' through '7', followed by 'done', with messa
ges 4-7 received below.<br><br>"; |
43 | 43 |
44 tryPostMessage('1', '*', 1, true); | 44 tryPostMessage('1', '*', 1, true); |
45 tryPostMessage('2', '*', 'c', true); | 45 tryPostMessage('2', '*', 'c', true); // Legacy overload resolution will consider
3rd argument to be the (string) origin. |
46 tryPostMessage('3', '*', { x: 1 }, true); | 46 tryPostMessage('3', '*', { x: 1 }, true); |
| 47 tryPostMessage('3a', { x: 1 }, '*', true); // Legacy argument order. |
47 tryPostMessage('4', '*', window); // Passes because window has a "length" attri
bute of value '0', so it looks like an array | 48 tryPostMessage('4', '*', window); // Passes because window has a "length" attri
bute of value '0', so it looks like an array |
48 tryPostMessage('4a', window, '*'); // Legacy argument order. | 49 tryPostMessage('4a', window, '*'); // Legacy argument order. |
49 tryPostMessage('5', '*', null); | 50 tryPostMessage('5', '*', null); |
50 tryPostMessage('6', '*', void 0); | 51 tryPostMessage('6', '*', void 0); |
51 var channel1 = new MessageChannel; | 52 var channel1 = new MessageChannel; |
52 tryPostMessageFunction(window.postMessage, '7', '*', [channel1.port1, channel1.p
ort2]); | 53 tryPostMessageFunction(window.postMessage, '7', '*', [channel1.port1, channel1.p
ort2]); |
53 var channel1a = new MessageChannel; | 54 var channel1a = new MessageChannel; |
54 tryPostMessageFunction(window.postMessage, '7a', [channel1a.port1, channel1a.por
t2], '*'); | 55 tryPostMessageFunction(window.postMessage, '7a', [channel1a.port1, channel1a.por
t2], '*'); |
55 var channel2 = new MessageChannel; | 56 var channel2 = new MessageChannel; |
56 tryPostMessageFunction(window.postMessage, '7', '*', [channel2.port1, channel2.p
ort2]); | 57 tryPostMessageFunction(window.postMessage, '7', '*', [channel2.port1, channel2.p
ort2]); |
(...skipping 20 matching lines...) Expand all Loading... |
77 } | 78 } |
78 else { | 79 else { |
79 console.innerHTML += "PASS: view neutered<br>" | 80 console.innerHTML += "PASS: view neutered<br>" |
80 } | 81 } |
81 | 82 |
82 | 83 |
83 tryPostMessageFunction(window.postMessage, 'done', '*'); | 84 tryPostMessageFunction(window.postMessage, 'done', '*'); |
84 </script> | 85 </script> |
85 </body> | 86 </body> |
86 </html> | 87 </html> |
OLD | NEW |