dom/browser-element/mochitest/file_browserElement_XFrameOptionsDeny.html

Wed, 31 Dec 2014 06:55:50 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:55:50 +0100
changeset 2
7e26c7da4463
permissions
-rw-r--r--

Added tag UPSTREAM_283F7C6 for changeset ca08bd8f51b2

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

mercurial