|
1 <!DOCTYPE html> |
|
2 <html> |
|
3 <head> |
|
4 <title>MessageEvent tests</title> |
|
5 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
|
6 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> |
|
7 </head> |
|
8 <body> |
|
9 <p id="display"></p> |
|
10 <pre id="test"> |
|
11 <script> |
|
12 SimpleTest.waitForExplicitFinish(); |
|
13 |
|
14 window.addEventListener('message', function (e) { |
|
15 console.log(e); |
|
16 console.dir(e); |
|
17 var loc = e.data; |
|
18 is(loc.hash, '', 'Unexpected hash.'); |
|
19 is(loc.host, 'mochi.test:8888', 'Unexpected host.'); |
|
20 is(loc.hostname, 'mochi.test', 'Unexpected hostname.'); |
|
21 // Is this correct? It matches WebKit, but it seems wrong: |
|
22 // https://bugs.webkit.org/show_bug.cgi?id=106488 |
|
23 is(loc.origin, 'http://mochi.test:8888', 'Unexpected origin.'); |
|
24 is(loc.pathname, '/tests/dom/tests/mochitest/dom-level0/framed_location.html', 'Unexpected pathname.'); |
|
25 is(loc.port, '8888', 'Unexpected port.'); |
|
26 is(loc.protocol, 'http:', 'Unexpected protocol.'); |
|
27 SimpleTest.finish(); |
|
28 }); |
|
29 </script> |
|
30 <iframe sandbox="allow-scripts" src="framed_location.html"></iframe> |
|
31 </pre> |
|
32 </body> |
|
33 </html> |