test_xfo_error_page.html (1333B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <title>Bug 1626249: Ensure correct display of neterror page for XFO</title> 5 <script src="/tests/SimpleTest/SimpleTest.js"></script> 6 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> 7 </head> 8 <body> 9 <iframe style="width:100%;" id="xfo_testframe"></iframe> 10 11 <script class="testbody" type="text/javascript"> 12 13 SimpleTest.waitForExplicitFinish(); 14 15 const { ContentTaskUtils } = SpecialPowers.ChromeUtils.importESModule( 16 "resource://testing-common/ContentTaskUtils.sys.mjs" 17 ); 18 19 const XFO_ERROR_PAGE_MSG = "This page has an X-Frame-Options policy that prevents it from being loaded in this context"; 20 21 let xfo_testframe = document.getElementById("xfo_testframe"); 22 23 xfo_testframe.onload = async function() { 24 let wrappedXFOFrame = SpecialPowers.wrap(xfo_testframe.contentWindow); 25 await ContentTaskUtils.waitForCondition( 26 () => wrappedXFOFrame.document.body.innerHTML.includes(XFO_ERROR_PAGE_MSG) 27 ); 28 let frameContentXFO = wrappedXFOFrame.document.body.innerHTML; 29 ok(frameContentXFO.includes(XFO_ERROR_PAGE_MSG), "xfo error page correct"); 30 SimpleTest.finish(); 31 } 32 33 xfo_testframe.onerror = function() { 34 ok(false, "sanity: should not fire onerror for xfo_testframe"); 35 SimpleTest.finish(); 36 } 37 38 xfo_testframe.src = "file_xfo_error_page.sjs"; 39 40 </script> 41 </body> 42 </html>