Bug 1942639 - Propagate --filter argument from desktop_unittest.py to runreftest...
[gecko.git] / dom / xslt / tests / mochitest / test_metaRefresh.html
blob21338bed82a8749ea50b395deb9275484fcb4fd0
1 <!DOCTYPE HTML>
2 <html>
3 <head>
4 <meta charset="utf-8">
5 <title><!-- TODO: insert title here --></title>
6 <script src="/tests/SimpleTest/SimpleTest.js"></script>
7 <link rel="stylesheet" href="/tests/SimpleTest/test.css"/>
8 <script>
9 SimpleTest.waitForExplicitFinish();
10 SimpleTest.requestFlakyTimeout("Use a timeout to check that a load doesn't happen.");
12 async function runTest() {
13 function refreshed(frame) {
14 return new Promise((resolve) => {
15 frame.addEventListener("load", () => {
16 let timeout = setTimeout(() => {
17 resolve(false);
18 }, 5000);
19 frame.addEventListener("load", () => {
20 clearTimeout(timeout);
21 resolve(true);
22 }, { once: true });
23 }, { once: true });
24 });
27 let frame = document.getElementById("frame");
28 let result = refreshed(frame);
29 frame.src = "file_metaRefresh.xml";
30 is(await result, true, "Meta refresh should work in iframe document created by XSLT.");
32 let sandBoxedFrame = document.getElementById("sandBoxedFrame");
33 result = refreshed(sandBoxedFrame);
34 sandBoxedFrame.src = "file_metaRefresh.xml";
35 is(await result, false, "Meta refresh shouldn't work in sandboxed iframe document created by XSLT.");
37 SimpleTest.finish();
39 </script>
40 </head>
41 <body onload="runTest();">
42 <p id="display"></p>
43 <iframe id="frame"></iframe>
44 <iframe sandbox="allow-same-origin" id="sandBoxedFrame"></iframe>
45 <div id="content" style="display: none"></div>
46 <pre id="test"></pre>
47 </body>
48 </html>