OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <title> Cross-origin postMessage with targetOrigin == "/" </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: " + |
| 19 "If the targetOrigin argument is a single literal U+002F S
OLIDUS character (/), and " + |
| 20 "the Document of the Window object on which the method was
invoked does not have the " + |
| 21 "same origin as the entry script's document, then abort th
ese steps silently."; |
| 22 |
| 23 var t = async_test(description); |
| 24 |
| 25 var DATA = "NoExceptionRaised"; |
| 26 var TARGET = document.querySelector("iframe"); |
| 27 |
| 28 function PostMessageTest() |
| 29 { |
| 30 try |
| 31 { |
| 32 TARGET.contentWindow.postMessage("/", "/"); |
| 33 TARGET.contentWindow.postMessage(DATA, "*"); |
| 34 } |
| 35 catch(ex) |
| 36 { |
| 37 TARGET.contentWindow.postMessage("ExceptionRaised", "*"); |
| 38 } |
| 39 } |
| 40 |
| 41 window.onmessage = t.step_func(function(e) |
| 42 { |
| 43 assert_equals(e.data, DATA, "e.data"); |
| 44 t.done(); |
| 45 }); |
| 46 </script> |
| 47 </body> |
| 48 </html> |
OLD | NEW |