Bug 1942639 - Propagate --filter argument from desktop_unittest.py to runreftest...
[gecko.git] / dom / xslt / tests / mochitest / test_bug1527308.html
blobc37a0c1f007f2994b6ab72428c2badaf8abbe4f0
1 <!DOCTYPE html>
2 <meta charset="utf-8">
3 <title>Test for serialized state in XSLT result document</title>
4 <script src="/resources/testharness.js"></script>
5 <script src="/resources/testharnessreport.js"></script>
6 <div id="log"></div>
7 <script>
8 async_test(t => {
9 let iframe = document.createElement('iframe');
10 let src = `<?xml version="1.0"?>
11 <?xml-stylesheet type="text/xml" href="#stylesheet"?>
12 <doc>
13 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" id="stylesheet">
14 <xsl:output method="html"/>
15 <xsl:template match="/">
16 <html>
17 <xsl:element name="script">self.addEventListener("message", () => { history.go(0); });</xsl:element>
18 <body onload="parent.postMessage(history.state, '*'); history.replaceState('data', 'title');"></body>
19 </html>
20 </xsl:template>
21 </xsl:stylesheet>
22 </doc>`;
23 iframe.src = "data:text/xml," + encodeURIComponent(src);
24 let reloaded = false;
25 self.addEventListener("message", t.step_func(({data: state}) => {
26 if (!reloaded) {
27 assert_equals(state, null, "At this point history.state should be set.");
28 iframe.contentWindow.postMessage("", "*");
29 reloaded = true;
30 return;
33 assert_equals(state, 'data', "Data set through history.replaceState in an XSLT result document should persist.");
34 t.done();
35 }));
36 document.body.appendChild(iframe);
37 }, "Test for serialized state in XSLT result document");
38 </script>