1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/browser-element/mochitest/file_browserElement_XFrameOptionsDeny.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,57 @@ 1.4 +<html> 1.5 +<body> 1.6 + 1.7 +<!-- Try to load in a frame a page which sends "X-Frame-Options: DENY", and a 1.8 + cross-origin page which sends "X-Frame-Options: SAMEORIGIN". --> 1.9 + 1.10 +<script> 1.11 + 1.12 +// Make sure these iframes aren't too tall; they both need to fit inside the 1.13 +// iframe this page is contained in, without scrolling, in order for the test's 1.14 +// screenshots to work properly. 1.15 + 1.16 +var iframe1 = document.createElement('iframe'); 1.17 +iframe1.height = '300px'; 1.18 +var iframe2 = document.createElement('iframe'); 1.19 +iframe2.height = '300px'; 1.20 +document.body.appendChild(iframe1); 1.21 +document.body.appendChild(iframe2); 1.22 + 1.23 +// This causes our embedder to take a screenshot (and blocks until the 1.24 +// screenshot is completed). 1.25 +alert('step 1'); 1.26 + 1.27 +// Wait for both iframes to load. 1.28 + 1.29 +var iframe1Loaded = false; 1.30 +iframe1.addEventListener('load', function iframe1Load() { 1.31 + iframe1.removeEventListener('load', iframe1Load); 1.32 + iframe1Loaded = true; 1.33 + waitForBothLoads(); 1.34 +}); 1.35 + 1.36 +var iframe2Loaded = false; 1.37 +iframe2.addEventListener('load', function iframe2Load() { 1.38 + iframe2.removeEventListener('load', iframe2Load); 1.39 + iframe2Loaded = true; 1.40 + waitForBothLoads(); 1.41 +}); 1.42 + 1.43 +function waitForBothLoads() { 1.44 + if (iframe1Loaded && iframe2Loaded) { 1.45 + setTimeout(function() { 1.46 + // This causes our embedder to take another screenshot. 1.47 + alert('step 2'); 1.48 + }, 0); 1.49 + } 1.50 +} 1.51 + 1.52 +iframe1.src = 'file_browserElement_XFrameOptions.sjs?DENY'; 1.53 + 1.54 +// Load iframe2 with the origin of our parent. Since we have a different 1.55 +// origin and are inside <iframe mozbrowser>, this should not load. 1.56 +iframe2.src = 'http://mochi.test:8888/tests/dom/browser-element/mochitest/file_browserElement_XFrameOptions.sjs?SAMEORIGIN'; 1.57 +</script> 1.58 + 1.59 +</body> 1.60 +</html>