diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
commit | 2aa4a82499d4becd2284cdb482213d541b8804dd (patch) | |
tree | b80bf8bf13c3766139fbacc530efd0dd9d54394c /dom/xslt/tests/mochitest/test_bug1527308.html | |
parent | Initial commit. (diff) | |
download | firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.tar.xz firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.zip |
Adding upstream version 86.0.1.upstream/86.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/xslt/tests/mochitest/test_bug1527308.html')
-rw-r--r-- | dom/xslt/tests/mochitest/test_bug1527308.html | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/dom/xslt/tests/mochitest/test_bug1527308.html b/dom/xslt/tests/mochitest/test_bug1527308.html new file mode 100644 index 0000000000..c37a0c1f00 --- /dev/null +++ b/dom/xslt/tests/mochitest/test_bug1527308.html @@ -0,0 +1,38 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>Test for serialized state in XSLT result document</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<script> +async_test(t => { + let iframe = document.createElement('iframe'); + let src = `<?xml version="1.0"?> + <?xml-stylesheet type="text/xml" href="#stylesheet"?> + <doc> + <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" id="stylesheet"> + <xsl:output method="html"/> + <xsl:template match="/"> + <html> + <xsl:element name="script">self.addEventListener("message", () => { history.go(0); });</xsl:element> + <body onload="parent.postMessage(history.state, '*'); history.replaceState('data', 'title');"></body> + </html> + </xsl:template> + </xsl:stylesheet> + </doc>`; + iframe.src = "data:text/xml," + encodeURIComponent(src); + let reloaded = false; + self.addEventListener("message", t.step_func(({data: state}) => { + if (!reloaded) { + assert_equals(state, null, "At this point history.state should be set."); + iframe.contentWindow.postMessage("", "*"); + reloaded = true; + return; + } + + assert_equals(state, 'data', "Data set through history.replaceState in an XSLT result document should persist."); + t.done(); + })); + document.body.appendChild(iframe); +}, "Test for serialized state in XSLT result document"); +</script> |