test_xslt.html (1727B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <title>Test feature policy - XSLT-transformed child document</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 10 <script class="testbody" type="text/javascript"> 11 12 SimpleTest.waitForExplicitFinish(); 13 14 function loadCrossOriginURL(iframe, file) { 15 const url = new URL("file_xslt_outer.html", location.href); 16 url.hostname = "example.com"; 17 url.port = null; 18 url.searchParams.set("file", file); 19 20 let { promise, resolve } = Promise.withResolvers(); 21 window.addEventListener("message", event => { 22 let { fullscreen, features } = event.data; 23 resolve({ fullscreen, features: [...features].sort((a, b) => a[0].localeCompare(b[0])) }); 24 }, { once: true }); 25 26 // Need to open this in a separate window for the xorigin variant, otherwise 27 // we'd get a restricted set of policies as this page is loaded in an iframe 28 // for that variant. 29 let win = window.open(url); 30 SimpleTest.registerCleanupFunction(() => { 31 win.close(); 32 }); 33 34 return promise; 35 } 36 37 SpecialPowers.pushPrefEnv({ 38 set: [ 39 ["full-screen-api.enabled", true], 40 ["full-screen-api.allow-trusted-requests-only", false], 41 ["full-screen-api.transition-duration.enter", "0 0"], 42 ["full-screen-api.transition-duration.leave", "0 0"], 43 ], 44 }).then(() => { 45 loadCrossOriginURL("expected", "file_xslt.html").then((expected) => { 46 loadCrossOriginURL("actual", "file_xslt.xml").then((actual) => { 47 isDeeply(actual, expected, "Permissions should be coming from the iframe's allow attribute and headers on the source document."); 48 49 SimpleTest.finish(); 50 }); 51 }); 52 }); 53 54 </script> 55 </body> 56 </html>