2008-03-21 Cameron Zwarich <cwzwarich@uwaterloo.ca>
authoroliver@apple.com <oliver@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 22 Mar 2008 07:14:40 +0000 (07:14 +0000)
committeroliver@apple.com <oliver@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 22 Mar 2008 07:14:40 +0000 (07:14 +0000)
Bug 13693: REGRESSION (r13615): Acid2 Test Eyes render improperly after a page refresh
<http://bugs.webkit.org/show_bug.cgi?id=13693>

Reviewed by Oliver Hunt

Do not create bogus history items for unloaded <object> elements, because they
cause fallback content to be ignored on reload.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@31228 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/http/tests/navigation/fallback-anchor-reload-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/navigation/fallback-anchor-reload.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/loader/FrameLoader.cpp

index 911e49a..940e2e6 100644 (file)
@@ -1,3 +1,13 @@
+2008-03-21  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
+
+        Reviewed by Oliver Hunt.
+
+        Test for <http://bugs.webkit.org/show_bug.cgi?id=13693>
+        Bug 13693: REGRESSION (r13615): Acid2 Test Eyes render improperly after a page refresh
+
+        * http/tests/navigation/fallback-anchor-reload-expected.txt: Added.
+        * http/tests/navigation/fallback-anchor-reload.html: Added.
+
 2008-03-21  Dan Bernstein  <mitz@apple.com>
 
         Reviewed by Oliver Hunt.
diff --git a/LayoutTests/http/tests/navigation/fallback-anchor-reload-expected.txt b/LayoutTests/http/tests/navigation/fallback-anchor-reload-expected.txt
new file mode 100644 (file)
index 0000000..61eb6c6
--- /dev/null
@@ -0,0 +1 @@
+Fallback content
diff --git a/LayoutTests/http/tests/navigation/fallback-anchor-reload.html b/LayoutTests/http/tests/navigation/fallback-anchor-reload.html
new file mode 100644 (file)
index 0000000..cc8d466
--- /dev/null
@@ -0,0 +1,18 @@
+<html>
+<head>
+<script type="text/javascript">
+function startTest()
+{
+    layoutTestController.dumpAsText();
+    layoutTestController.queueScript("window.location.hash = 'anchor';");
+    layoutTestController.queueReload();
+}
+</script>
+</head>
+<body onload="startTest();">
+
+<h2 id="anchor"></h2>
+
+<object data="resources/error404.pl">Fallback content</object>
+</body>
+</html>
index 5390b62..744b6f2 100644 (file)
@@ -1,3 +1,16 @@
+2008-03-21  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
+
+        Reviewed by Oliver Hunt.
+
+        Bug 13693: REGRESSION (r13615): Acid2 Test Eyes render improperly after a page refresh
+        <http://bugs.webkit.org/show_bug.cgi?id=13693>
+
+        Do not create bogus history items for unloaded <object> elements, because they
+        cause fallback content to be ignored on reload.
+
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::createHistoryItemTree):
+
 2008-03-21  Dan Bernstein  <mitz@apple.com>
 
         Reviewed by Oliver Hunt.
index a8771d1..fb8a005 100644 (file)
@@ -3886,8 +3886,17 @@ PassRefPtr<HistoryItem> FrameLoader::createHistoryItemTree(Frame* targetFrame, b
     if (!(clipAtTarget && m_frame == targetFrame)) {
         // save frame state for items that aren't loading (khtml doesn't save those)
         saveDocumentState();
-        for (Frame* child = m_frame->tree()->firstChild(); child; child = child->tree()->nextSibling())
-            bfItem->addChildItem(child->loader()->createHistoryItemTree(targetFrame, clipAtTarget));
+        for (Frame* child = m_frame->tree()->firstChild(); child; child = child->tree()->nextSibling()) {
+            FrameLoader* childLoader = child->loader();
+            bool hasChildLoaded = childLoader->frameHasLoaded();
+            
+            // If the child is a frame corresponding to an <object> element that never loaded,
+            // we don't want to create a history item, because that causes fallback content
+            // to be ignored on reload.
+            
+            if (!(!hasChildLoaded && childLoader->isHostedByObjectElement()))
+                bfItem->addChildItem(childLoader->createHistoryItemTree(targetFrame, clipAtTarget));
+        }
     }
     if (m_frame == targetFrame)
         bfItem->setIsTargetItem(true);