|
1 <html> |
|
2 <body> |
|
3 |
|
4 <!-- Try to load in a frame a cross-origin page which sends: |
|
5 "X-Frame-Options: Allow-From http://mochi.test:8888/", |
|
6 and a cross-origin page which sends |
|
7 "X-Frame-Options: Allow-From http://example.com/". --> |
|
8 |
|
9 <script> |
|
10 |
|
11 // Make sure these iframes aren't too tall; they both need to fit inside the |
|
12 // iframe this page is contained in, without scrolling, in order for the test's |
|
13 // screenshots to work properly. |
|
14 |
|
15 var frame_src = 'http://example.com/tests/dom/browser-element/mochitest/file_browserElement_XFrameOptionsAllowFrom.sjs'; |
|
16 |
|
17 var iframe1 = document.createElement('iframe'); |
|
18 iframe1.height = '300px'; |
|
19 var iframe2 = document.createElement('iframe'); |
|
20 iframe2.height = '300px'; |
|
21 document.body.appendChild(iframe1); |
|
22 document.body.appendChild(iframe2); |
|
23 |
|
24 iframe1.addEventListener('load', function iframe1Load() { |
|
25 iframe1.removeEventListener('load', iframe1Load); |
|
26 // This causes our embedder to take a screenshot (and blocks until the |
|
27 // screenshot is completed). |
|
28 var iframe2Loaded = false; |
|
29 iframe2.addEventListener('load', function iframe2Load() { |
|
30 iframe2.removeEventListener('load', iframe2Load); |
|
31 iframe2Loaded = true; |
|
32 alert('finish'); |
|
33 }); |
|
34 |
|
35 setTimeout(function() { iframe2.src = frame_src; }, 1000); |
|
36 }); |
|
37 |
|
38 |
|
39 iframe1.src = frame_src + '?iframe1'; |
|
40 </script> |
|
41 |
|
42 </body> |
|
43 </html> |