Title: [95561] branches/chromium/874/LayoutTests
Revision
95561
Author
[email protected]
Date
2011-09-20 12:05:41 -0700 (Tue, 20 Sep 2011)

Log Message

Merge 95259 - Fragment navigations should interrupt a provisional load of a different document
https://bugs.webkit.org/show_bug.cgi?id=64556

Source/WebCore:

Reviewed by Adam Barth.

Tests: http/tests/history/back-with-fragment-change.php
       http/tests/navigation/navigation-interrupted-by-fragment.html

* loader/FrameLoader.cpp: Stop provisional load if a fragment commits.
* loader/HistoryController.cpp: Don't commit the wrong provisional item.

LayoutTests:

Reviewed by Adam Barth.

Required page-dismissal-modal-dialogs-iframe.html to be updated since
the dummy <a href="" link was clicked after the provisional load was
kicked off, thus causing it to to be aborted.

* fast/loader/page-dismissal-modal-dialogs.html:
* fast/loader/resources/page-dismissal-modal-dialogs-iframe.html:
* http/tests/history/back-with-fragment-change-expected.txt: Added.
* http/tests/history/back-with-fragment-change.php: Added.
* http/tests/history/resources/back-with-fragment-change-target.html: Added.
* http/tests/navigation/navigation-interrupted-by-fragment-expected.txt: Added.
* http/tests/navigation/navigation-interrupted-by-fragment.html: Added.


[email protected]
Review URL: http://codereview.chromium.org/7983013

Modified Paths

Added Paths

Diff

Modified: branches/chromium/874/LayoutTests/fast/loader/page-dismissal-modal-dialogs.html (95560 => 95561)


--- branches/chromium/874/LayoutTests/fast/loader/page-dismissal-modal-dialogs.html	2011-09-20 18:58:04 UTC (rev 95560)
+++ branches/chromium/874/LayoutTests/fast/loader/page-dismissal-modal-dialogs.html	2011-09-20 19:05:41 UTC (rev 95561)
@@ -29,7 +29,7 @@
 }, false);
 </script></head><body><div>
 
-<a href=# _onclick_="showMessages('mainFrame click')" id=anchor>anchor</a>
+<span _onclick_="showMessages('mainFrame click')" id=anchor>anchor</span>
 <iframe src=""
 
 This page registers handlers for various types of unload events and attempts to

Modified: branches/chromium/874/LayoutTests/fast/loader/resources/page-dismissal-modal-dialogs-iframe.html (95560 => 95561)


--- branches/chromium/874/LayoutTests/fast/loader/resources/page-dismissal-modal-dialogs-iframe.html	2011-09-20 18:58:04 UTC (rev 95560)
+++ branches/chromium/874/LayoutTests/fast/loader/resources/page-dismissal-modal-dialogs-iframe.html	2011-09-20 19:05:41 UTC (rev 95561)
@@ -2,5 +2,5 @@
 <html><head><meta charset=utf-8><title>Page Dismissal Modal Dialogs iFrame</title><script>
 parent.registerEvents("iFrame", window, parent);
 </script></head><body><div>
-<a href=# _onclick_="parent.showMessages('iFrame click')" id=anchor>anchor</a>
+<span _onclick_="parent.showMessages('iFrame click')" id=anchor>anchor</span>
 </div></body></html>

Copied: branches/chromium/874/LayoutTests/http/tests/history/back-with-fragment-change-expected.txt (from rev 95259, trunk/LayoutTests/http/tests/history/back-with-fragment-change-expected.txt) (0 => 95561)


--- branches/chromium/874/LayoutTests/http/tests/history/back-with-fragment-change-expected.txt	                        (rev 0)
+++ branches/chromium/874/LayoutTests/http/tests/history/back-with-fragment-change-expected.txt	2011-09-20 19:05:41 UTC (rev 95561)
@@ -0,0 +1,9 @@
+main frame - has 1 onunload handler(s)
+CONSOLE MESSAGE: line 19: Visited fragment and waited.
+PASS
+
+============== Back Forward List ==============
+        http://127.0.0.1:8000/history/back-with-fragment-change.php  **nav target**
+        http://127.0.0.1:8000/history/resources/back-with-fragment-change-target.html  **nav target**
+curr->  http://127.0.0.1:8000/history/resources/back-with-fragment-change-target.html#foo  **nav target**
+===============================================

Copied: branches/chromium/874/LayoutTests/http/tests/history/back-with-fragment-change.php (from rev 95259, trunk/LayoutTests/http/tests/history/back-with-fragment-change.php) (0 => 95561)


--- branches/chromium/874/LayoutTests/http/tests/history/back-with-fragment-change.php	                        (rev 0)
+++ branches/chromium/874/LayoutTests/http/tests/history/back-with-fragment-change.php	2011-09-20 19:05:41 UTC (rev 95561)
@@ -0,0 +1,45 @@
+<!--
+We intentionally want the page to load slowly (every time, hence no caching), so
+that when back-with-fragment-change-target.html calls history.back(), the load
+is provisional for a while (long enough for the window.location = '#foo' script
+to run and stop that load).
+-->
+<?php
+
+sleep(2);
+
+header("Cache-control: no-cache, no-store");
+header("Pragma: no-cache");
+?>
+
+<script>
+if (window.layoutTestController) {
+    layoutTestController.dumpBackForwardList();
+    layoutTestController.dumpAsText();
+    layoutTestController.waitUntilDone();
+}
+
+_onload_ = function() {
+    if (sessionStorage.didNavigate) {
+        console.log('Should not have ended up back at the test start page');
+        delete sessionStorage.didNavigate;
+        if (window.layoutTestController)
+            layoutTestController.notifyDone();
+        return;
+    }
+
+    // Change the location in a timeout to make sure it generates a history entry
+    setTimeout(function() {
+            window.location = 'resources/back-with-fragment-change-target.html'
+            sessionStorage.didNavigate = true;
+        }, 0);
+}
+
+// Make sure there's no page cache.
+_onunload_ = function() { };
+</script>
+<p>
+Tests that a history navigation that is aborted by a fragment change doesn't
+update the provisional history item. This test relies on
+<code>layoutTestController.dumpBackForwardList</code> to verify correctness
+and thus can only be run via DumpRenderTree.</p>

Copied: branches/chromium/874/LayoutTests/http/tests/history/resources/back-with-fragment-change-target.html (from rev 95259, trunk/LayoutTests/http/tests/history/resources/back-with-fragment-change-target.html) (0 => 95561)


--- branches/chromium/874/LayoutTests/http/tests/history/resources/back-with-fragment-change-target.html	                        (rev 0)
+++ branches/chromium/874/LayoutTests/http/tests/history/resources/back-with-fragment-change-target.html	2011-09-20 19:05:41 UTC (rev 95561)
@@ -0,0 +1,25 @@
+<script>
+_onload_ = function() {
+    setTimeout(function() {
+        // Start to go back (runs asynchonously)
+        history.back();
+        // But immediately cancel that load of a history item and navigate to
+        // a fragment on the page instead. We should remain on this page and
+        // a history item should be added (with past ones not being affected)
+        setTimeout(function(){window.location = '#foo'}, 0);
+    }, 0);
+}
+  
+_onhashchange_ = function() {
+    setTimeout(done, 100);
+}
+
+function done() {
+    delete sessionStorage.didNavigate;
+    console.log('Visited fragment and waited.');
+    if (window.layoutTestController) {
+        layoutTestController.notifyDone();
+    }
+}
+</script>
+PASS

Copied: branches/chromium/874/LayoutTests/http/tests/navigation/navigation-interrupted-by-fragment-expected.txt (from rev 95259, trunk/LayoutTests/http/tests/navigation/navigation-interrupted-by-fragment-expected.txt) (0 => 95561)


--- branches/chromium/874/LayoutTests/http/tests/navigation/navigation-interrupted-by-fragment-expected.txt	                        (rev 0)
+++ branches/chromium/874/LayoutTests/http/tests/navigation/navigation-interrupted-by-fragment-expected.txt	2011-09-20 19:05:41 UTC (rev 95561)
@@ -0,0 +1,8 @@
+CONSOLE MESSAGE: line 23: First visit.
+CONSOLE MESSAGE: line 17: Visited fragment and waited.
+This test checks that interrupting a slow navigation with a fragment navigation will cancel the first navigation.
+
+============== Back Forward List ==============
+        http://127.0.0.1:8000/navigation/navigation-interrupted-by-fragment.html  **nav target**
+curr->  http://127.0.0.1:8000/navigation/navigation-interrupted-by-fragment.html#abc  **nav target**
+===============================================

Copied: branches/chromium/874/LayoutTests/http/tests/navigation/navigation-interrupted-by-fragment.html (from rev 95259, trunk/LayoutTests/http/tests/navigation/navigation-interrupted-by-fragment.html) (0 => 95561)


--- branches/chromium/874/LayoutTests/http/tests/navigation/navigation-interrupted-by-fragment.html	                        (rev 0)
+++ branches/chromium/874/LayoutTests/http/tests/navigation/navigation-interrupted-by-fragment.html	2011-09-20 19:05:41 UTC (rev 95561)
@@ -0,0 +1,26 @@
+<script>
+if (window.layoutTestController) {
+    layoutTestController.dumpBackForwardList();
+    layoutTestController.dumpAsText();
+    layoutTestController.waitUntilDone();
+}
+_onload_ = function() {
+    window.location = 'resources/slow-resource.pl?delay=100';
+    setTimeout(function() {window.location = 'navigation-interrupted-by-fragment.html#abc'}, 10);
+}
+
+_onhashchange_ = function() {
+    setTimeout(done, 100);
+}
+
+function done() {
+    console.log('Visited fragment and waited.');
+    if (window.layoutTestController) {
+        layoutTestController.notifyDone();
+    }
+}
+
+console.log('First visit.');
+
+</script>
+<p>This test checks that interrupting a slow navigation with a fragment navigation will cancel the first navigation.
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to