Back list isn't properly updated for fragment changes after a redirect.
authorbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 22 Sep 2009 20:04:25 +0000 (20:04 +0000)
committerbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 22 Sep 2009 20:04:25 +0000 (20:04 +0000)
<rdar://problem/6142803> and https://bugs.webkit.org/show_bug.cgi?id=20355

Reviewed by Darin Adler.

WebCore:

Test: fast/loader/fragment-after-redirect-gets-back-entry.html

* loader/FrameLoader.cpp:
(WebCore::FrameLoader::loadURL): Properly reset the policy FrameLoadType before
  consulting the policy delegate for fragment scrolling.

LayoutTests:

* fast/loader/fragment-after-redirect-gets-back-entry-expected.txt: Added.
* fast/loader/fragment-after-redirect-gets-back-entry.html: Added.
* fast/loader/resources/click-fragment-link.html: Added.

* http/tests/navigation/relativeanchor-frames-expected.txt: Updated results (a progression!)

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

LayoutTests/ChangeLog
LayoutTests/fast/loader/fragment-after-redirect-gets-back-entry-expected.txt [new file with mode: 0644]
LayoutTests/fast/loader/fragment-after-redirect-gets-back-entry.html [new file with mode: 0644]
LayoutTests/fast/loader/resources/click-fragment-link.html [new file with mode: 0644]
LayoutTests/http/tests/navigation/relativeanchor-frames-expected.txt
WebCore/ChangeLog
WebCore/loader/FrameLoader.cpp

index 6ea9fd7..2ccec57 100644 (file)
@@ -1,3 +1,16 @@
+2009-09-22  Brady Eidson  <beidson@apple.com>
+
+        Reviewed by Darin Adler.
+
+        Back list isn't properly updated for fragment changes after a redirect.
+        <rdar://problem/6142803> and https://bugs.webkit.org/show_bug.cgi?id=20355
+
+        * fast/loader/fragment-after-redirect-gets-back-entry-expected.txt: Added.
+        * fast/loader/fragment-after-redirect-gets-back-entry.html: Added.
+        * fast/loader/resources/click-fragment-link.html: Added.
+
+        * http/tests/navigation/relativeanchor-frames-expected.txt: Updated results (a progression!)
+
 2009-09-22  Victor Wang  <victorw@chromium.org>
 
         Reviewed by Dimitri Glazkov.
diff --git a/LayoutTests/fast/loader/fragment-after-redirect-gets-back-entry-expected.txt b/LayoutTests/fast/loader/fragment-after-redirect-gets-back-entry-expected.txt
new file mode 100644 (file)
index 0000000..c09af71
--- /dev/null
@@ -0,0 +1,6 @@
+Click this link, and there should be a back-list entry for the page without the fragment ID.
+
+============== Back Forward List ==============
+        (file test):fast/loader/resources/click-fragment-link.html  **nav target**
+curr->  (file test):fast/loader/resources/click-fragment-link.html#testfragment  **nav target**
+===============================================
diff --git a/LayoutTests/fast/loader/fragment-after-redirect-gets-back-entry.html b/LayoutTests/fast/loader/fragment-after-redirect-gets-back-entry.html
new file mode 100644 (file)
index 0000000..aa9d745
--- /dev/null
@@ -0,0 +1,11 @@
+<script>
+
+if (window.layoutTestController) {
+    layoutTestController.dumpAsText();
+    layoutTestController.dumpBackForwardList();
+    layoutTestController.waitUntilDone();
+}
+
+window.location.replace('resources/click-fragment-link.html');
+
+</script>
\ No newline at end of file
diff --git a/LayoutTests/fast/loader/resources/click-fragment-link.html b/LayoutTests/fast/loader/resources/click-fragment-link.html
new file mode 100644 (file)
index 0000000..f73675f
--- /dev/null
@@ -0,0 +1,22 @@
+<script>
+
+function loaded() {
+    if (window.layoutTestController) {
+        var element = document.getElementById("fragmentlink");
+        eventSender.mouseMoveTo(element.offsetLeft + (element.offsetWidth / 2), element.offsetTop + (element.offsetHeight / 2));
+        eventSender.mouseDown();
+        eventSender.mouseUp();
+    }
+}
+
+function hashChanged()
+{
+    if (window.layoutTestController)
+        layoutTestController.notifyDone();
+}
+
+</script>
+<body onhashchange="hashChanged();" onload="loaded();">
+<a id="fragmentlink" href="#testfragment">Click this link, and there should be a back-list entry for the page without the fragment ID.</a>
+</body>
+<html>
index 4e0c5dd..613ae05 100644 (file)
@@ -2,7 +2,10 @@
 
 ============== Back Forward List ==============
         http://127.0.0.1:8000/navigation/relativeanchor-frames.html  **nav target**
-curr->  http://127.0.0.1:8000/navigation/resources/frameset.pl?frameURL=success200.html  **nav target**
+        http://127.0.0.1:8000/navigation/resources/frameset.pl?frameURL=success200.html  **nav target**
             http://127.0.0.1:8000/navigation/resources/otherpage.html (in frame "footer")
             http://127.0.0.1:8000/navigation/resources/success200.html (in frame "main")
+curr->  http://127.0.0.1:8000/navigation/resources/frameset.pl?frameURL=success200.html
+            http://127.0.0.1:8000/navigation/resources/otherpage.html (in frame "footer")
+            http://127.0.0.1:8000/navigation/resources/success200.html#anchor1 (in frame "main")  **nav target**
 ===============================================
index df80d3d..c8f26d5 100644 (file)
@@ -1,3 +1,16 @@
+2009-09-22  Brady Eidson  <beidson@apple.com>
+
+        Reviewed by Darin Adler.
+
+        Back list isn't properly updated for fragment changes after a redirect.
+        <rdar://problem/6142803> and https://bugs.webkit.org/show_bug.cgi?id=20355
+
+        Test: fast/loader/fragment-after-redirect-gets-back-entry.html
+
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::loadURL): Properly reset the policy FrameLoadType before
+          consulting the policy delegate for fragment scrolling.
+
 2009-09-22  Darin Fisher  <darin@chromium.org>
 
         Reviewed by Dimitri Glazkov.
index 2b886ca..16c390c 100644 (file)
@@ -2333,6 +2333,7 @@ void FrameLoader::loadURL(const KURL& newURL, const String& referrer, const Stri
     if (shouldScrollToAnchor(isFormSubmission, newLoadType, newURL)) {
         oldDocumentLoader->setTriggeringAction(action);
         stopPolicyCheck();
+        m_policyLoadType = newLoadType;
         checkNavigationPolicy(request, oldDocumentLoader.get(), formState.release(),
             callContinueFragmentScrollAfterNavigationPolicy, this);
     } else {