Bug 1135764 - Make sure XSLT transform results have a document timeline so things like transitions will work. r=smaug, a=lmandel
new file mode 100644
--- /dev/null
+++ b/dom/xslt/tests/mochitest/file_bug1135764.xml
@@ -0,0 +1,3 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?xml-stylesheet type="text/xsl" href="file_bug1135764.xsl"?>
+<root/>
new file mode 100644
--- /dev/null
+++ b/dom/xslt/tests/mochitest/file_bug1135764.xsl
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+<xsl:output method="html"
+ indent="yes"
+ version="5.0"
+ doctype-system="about:legacy-compat"/>
+
+<xsl:template match="/">
+<html>
+<head>
+</head>
+ <body>
+ Some text
+ </body>
+</html>
+</xsl:template>
+
+</xsl:stylesheet>
--- a/dom/xslt/tests/mochitest/mochitest.ini
+++ b/dom/xslt/tests/mochitest/mochitest.ini
@@ -9,10 +9,12 @@
[test_bug511487.html]
[test_bug551412.html]
[test_bug551654.html]
[test_bug566629.html]
[test_bug566629.xhtml]
[test_bug603159.html]
[test_bug616774.html]
[test_bug667315.html]
+[test_bug1135764.html]
+support-files = file_bug1135764.xml file_bug1135764.xsl
[test_exslt_regex.html]
[test_parameter.html]
new file mode 100644
--- /dev/null
+++ b/dom/xslt/tests/mochitest/test_bug1135764.html
@@ -0,0 +1,45 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1135764
+-->
+<head>
+ <meta charset="utf-8">
+ <title>Test for Bug 1135764</title>
+ <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+ <script type="application/javascript">
+
+ /** Test for Bug 1135764 **/
+ SimpleTest.waitForExplicitFinish();
+ var counter = 0;
+ var startTimelineValue;
+
+ function waitATick() {
+ ++counter;
+ if (counter == 1) {
+ frames[0].requestAnimationFrame(waitATick);
+ return;
+ }
+ ok(frames[0].document.timeline.currentTime !== startTimelineValue,
+ "The timeline in an XSLT-transformed document should still advance");
+ SimpleTest.finish();
+ }
+ addLoadEvent(function() {
+ startTimelineValue = frames[0].document.timeline.currentTime;
+ frames[0].requestAnimationFrame(waitATick);
+ })
+ </script>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1135764">Mozilla Bug 1135764</a>
+<p id="display">
+ <iframe src="file_bug1135764.xml"></iframe>
+</p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+</pre>
+</body>
+</html>
--- a/layout/base/nsDocumentViewer.cpp
+++ b/layout/base/nsDocumentViewer.cpp
@@ -1780,16 +1780,23 @@ nsDocumentViewer::SetDocumentInternal(ns
bool aForceReuseInnerWindow)
{
MOZ_ASSERT(aDocument);
// Set new container
aDocument->SetContainer(mContainer);
if (mDocument != aDocument) {
+ if (aForceReuseInnerWindow) {
+ // Transfer the navigation timing information to the new document, since
+ // we're keeping the same inner and hence should really have the same
+ // timing information.
+ aDocument->SetNavigationTiming(mDocument->GetNavigationTiming());
+ }
+
if (mDocument->IsStaticDocument()) {
mDocument->SetScriptGlobalObject(nullptr);
mDocument->Destroy();
}
// Clear the list of old child docshells. Child docshells for the new
// document will be constructed as frames are created.
if (!aDocument->IsStaticDocument()) {