|
1 <!DOCTYPE HTML> |
|
2 <html> |
|
3 <!-- |
|
4 https://bugzilla.mozilla.org/show_bug.cgi?id=38959 |
|
5 --> |
|
6 <head> |
|
7 <title>Test for Bug 38959</title> |
|
8 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
|
9 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> |
|
10 </head> |
|
11 <body> |
|
12 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=38959">Mozilla Bug 38959</a> |
|
13 <p id="display"></p> |
|
14 <div id="content" style="display: none"> |
|
15 <iframe id="frame"></iframe> |
|
16 </div> |
|
17 <pre id="test"> |
|
18 <script type="application/javascript"> |
|
19 |
|
20 /** Test for Bug 38959 **/ |
|
21 |
|
22 var newValue; |
|
23 |
|
24 function watcher(id, ol, ne) |
|
25 { |
|
26 newValue = ne; |
|
27 return ne; |
|
28 } |
|
29 |
|
30 function openWindow(url, crossOrigin) |
|
31 { |
|
32 newValue = true; |
|
33 var w = window.open(url); |
|
34 w.watch("x", watcher); |
|
35 } |
|
36 |
|
37 function receiveMessage(evt) |
|
38 { |
|
39 ok(newValue, "Watchpoints only allowed same-origin."); |
|
40 if (evt.data == 1) { |
|
41 openWindow("/tests/dom/tests/mochitest/bugs/iframe_bug38959-2.html"); |
|
42 } |
|
43 else { |
|
44 SimpleTest.finish(); |
|
45 } |
|
46 } |
|
47 |
|
48 SimpleTest.waitForExplicitFinish(); |
|
49 |
|
50 window.addEventListener("message", receiveMessage, false); |
|
51 |
|
52 openWindow("http://example.org/tests/dom/tests/mochitest/bugs/iframe_bug38959-1.html"); |
|
53 |
|
54 </script> |
|
55 </pre> |
|
56 </body> |
|
57 </html> |