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>
9 let iframe
= document
.createElement('iframe');
10 let src
= `<?xml version="1.0"?>
11 <?xml-stylesheet type="text/xml" href="#stylesheet"?>
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="/">
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>
23 iframe
.src
= "data:text/xml," + encodeURIComponent(src
);
25 self
.addEventListener("message", t
.step_func(({data
: state
}) => {
27 assert_equals(state
, null, "At this point history.state should be set.");
28 iframe
.contentWindow
.postMessage("", "*");
33 assert_equals(state
, 'data', "Data set through history.replaceState in an XSLT result document should persist.");
36 document
.body
.appendChild(iframe
);
37 }, "Test for serialized state in XSLT result document");