|
1 <html> |
|
2 <body> |
|
3 |
|
4 <!-- Try to load in a frame a page which sends "X-Frame-Options: DENY", and a |
|
5 cross-origin page which sends "X-Frame-Options: SAMEORIGIN". --> |
|
6 |
|
7 <script> |
|
8 |
|
9 // Make sure these iframes aren't too tall; they both need to fit inside the |
|
10 // iframe this page is contained in, without scrolling, in order for the test's |
|
11 // screenshots to work properly. |
|
12 |
|
13 var iframe1 = document.createElement('iframe'); |
|
14 iframe1.height = '300px'; |
|
15 var iframe2 = document.createElement('iframe'); |
|
16 iframe2.height = '300px'; |
|
17 document.body.appendChild(iframe1); |
|
18 document.body.appendChild(iframe2); |
|
19 |
|
20 // This causes our embedder to take a screenshot (and blocks until the |
|
21 // screenshot is completed). |
|
22 alert('step 1'); |
|
23 |
|
24 // Wait for both iframes to load. |
|
25 |
|
26 var iframe1Loaded = false; |
|
27 iframe1.addEventListener('load', function iframe1Load() { |
|
28 iframe1.removeEventListener('load', iframe1Load); |
|
29 iframe1Loaded = true; |
|
30 waitForBothLoads(); |
|
31 }); |
|
32 |
|
33 var iframe2Loaded = false; |
|
34 iframe2.addEventListener('load', function iframe2Load() { |
|
35 iframe2.removeEventListener('load', iframe2Load); |
|
36 iframe2Loaded = true; |
|
37 waitForBothLoads(); |
|
38 }); |
|
39 |
|
40 function waitForBothLoads() { |
|
41 if (iframe1Loaded && iframe2Loaded) { |
|
42 setTimeout(function() { |
|
43 // This causes our embedder to take another screenshot. |
|
44 alert('step 2'); |
|
45 }, 0); |
|
46 } |
|
47 } |
|
48 |
|
49 iframe1.src = 'file_browserElement_XFrameOptions.sjs?DENY'; |
|
50 |
|
51 // Load iframe2 with the origin of our parent. Since we have a different |
|
52 // origin and are inside <iframe mozbrowser>, this should not load. |
|
53 iframe2.src = 'http://mochi.test:8888/tests/dom/browser-element/mochitest/file_browserElement_XFrameOptions.sjs?SAMEORIGIN'; |
|
54 </script> |
|
55 |
|
56 </body> |
|
57 </html> |