Title: [229577] trunk/LayoutTests
- Revision
- 229577
- Author
- commit-qu...@webkit.org
- Date
- 2018-03-13 09:12:40 -0700 (Tue, 13 Mar 2018)
Log Message
LayoutTests/http/tests/navigation/page-cache-iframe-provisional-load.html fails with async policy delegate
https://bugs.webkit.org/show_bug.cgi?id=183386
Patch by Danyao Wang <dan...@chromium.org> on 2018-03-13
Reviewed by Chris Dumez.
This test relies on the happenstance that with sync poicy decision, the subframe transitions
to FrameLoadProvisional before main frame navigation is committed. With async delegate,
policy checks for the main frame and subframe are interleaved. When the main frame policy
decision is received, it cancels the subframe check. So the page ends up being cached when
navigating away. This is working as intended.
* http/tests/navigation/page-cache-iframe-provisional-load-async-delegates-expected.txt: Added.
* http/tests/navigation/page-cache-iframe-provisional-load-async-delegates.html: Copied from LayoutTests/http/tests/navigation/page-cache-iframe-provisional-load.html.
Add a new version of the test that forces async policy delegate.
* http/tests/navigation/page-cache-iframe-provisional-load.html:
Update test to sequence main frame navigation after start of provisional navigation in subframe.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (229576 => 229577)
--- trunk/LayoutTests/ChangeLog 2018-03-13 13:44:28 UTC (rev 229576)
+++ trunk/LayoutTests/ChangeLog 2018-03-13 16:12:40 UTC (rev 229577)
@@ -1,3 +1,23 @@
+2018-03-13 Danyao Wang <dan...@chromium.org>
+
+ LayoutTests/http/tests/navigation/page-cache-iframe-provisional-load.html fails with async policy delegate
+ https://bugs.webkit.org/show_bug.cgi?id=183386
+
+ Reviewed by Chris Dumez.
+
+ This test relies on the happenstance that with sync poicy decision, the subframe transitions
+ to FrameLoadProvisional before main frame navigation is committed. With async delegate,
+ policy checks for the main frame and subframe are interleaved. When the main frame policy
+ decision is received, it cancels the subframe check. So the page ends up being cached when
+ navigating away. This is working as intended.
+
+ * http/tests/navigation/page-cache-iframe-provisional-load-async-delegates-expected.txt: Added.
+ * http/tests/navigation/page-cache-iframe-provisional-load-async-delegates.html: Copied from LayoutTests/http/tests/navigation/page-cache-iframe-provisional-load.html.
+ Add a new version of the test that forces async policy delegate.
+
+ * http/tests/navigation/page-cache-iframe-provisional-load.html:
+ Update test to sequence main frame navigation after start of provisional navigation in subframe.
+
2018-03-13 Frederic Wang <fw...@igalia.com>
Rewrite frameset-flattening-simple to make expectation clearer
Added: trunk/LayoutTests/http/tests/navigation/page-cache-iframe-provisional-load-async-delegates-expected.txt (0 => 229577)
--- trunk/LayoutTests/http/tests/navigation/page-cache-iframe-provisional-load-async-delegates-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/navigation/page-cache-iframe-provisional-load-async-delegates-expected.txt 2018-03-13 16:12:40 UTC (rev 229577)
@@ -0,0 +1,11 @@
+A frame in provisional load stage should prevent page caching.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+pageshow - not from cache
+PASS Page was not restored from PageCache
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Copied: trunk/LayoutTests/http/tests/navigation/page-cache-iframe-provisional-load-async-delegates.html (from rev 229576, trunk/LayoutTests/http/tests/navigation/page-cache-iframe-provisional-load.html) (0 => 229577)
--- trunk/LayoutTests/http/tests/navigation/page-cache-iframe-provisional-load-async-delegates.html (rev 0)
+++ trunk/LayoutTests/http/tests/navigation/page-cache-iframe-provisional-load-async-delegates.html 2018-03-13 16:12:40 UTC (rev 229577)
@@ -0,0 +1,56 @@
+<!DOCTYPE html>
+<html>
+<body>
+<script src=""
+<script>
+description("A frame in provisional load stage should prevent page caching.");
+window.jsTestIsAsync = true;
+
+if (window.testRunner) {
+ if (testRunner.setShouldDecideNavigationPolicyAfterDelay)
+ testRunner.setShouldDecideNavigationPolicyAfterDelay(true);
+
+ testRunner.overridePreference("WebKitUsesPageCachePreferenceKey", 1);
+}
+
+window.addEventListener("pageshow", function(event) {
+ debug("pageshow - " + (event.persisted ? "" : "not ") + "from cache");
+
+ if (!window.sessionStorage.page_cache_provisional_load_test_started)
+ return;
+
+ delete window.sessionStorage.page_cache_provisional_load_test_started;
+
+ if (event.persisted)
+ testFailed("Page was restored from PageCache");
+ else
+ testPassed("Page was not restored from PageCache");
+
+ finishJSTest();
+}, false);
+
+window.addEventListener("pagehide", function(event) {
+ testFailed("pagehide - Page went into PageCache");
+}, false);
+
+function loadSubframeAndNavigateAway()
+{
+ window.sessionStorage.page_cache_provisional_load_test_started = true;
+
+ // Force a back navigation back to this page after the subframe starts provisional navigation.
+ var testFrame = document.getElementById("testFrame");
+ testFrame._onbeforeunload_ = function() {
+ setTimeout(function() {
+ window.location.href = ""
+ }, 0);
+ };
+ testFrame.src = ""
+}
+
+window.addEventListener('load', loadSubframeAndNavigateAway, false);
+
+</script>
+<iframe id="testFrame" src=""
+<script src=""
+</body>
+</html>
Modified: trunk/LayoutTests/http/tests/navigation/page-cache-iframe-provisional-load.html (229576 => 229577)
--- trunk/LayoutTests/http/tests/navigation/page-cache-iframe-provisional-load.html 2018-03-13 13:44:28 UTC (rev 229576)
+++ trunk/LayoutTests/http/tests/navigation/page-cache-iframe-provisional-load.html 2018-03-13 16:12:40 UTC (rev 229577)
@@ -31,19 +31,19 @@
function loadSubframeAndNavigateAway()
{
- // Force a back navigation back to this page.
window.sessionStorage.page_cache_provisional_load_test_started = true;
- window.location.href = ""
+ // Force a back navigation back to this page after the subframe starts provisional navigation.
var testFrame = document.getElementById("testFrame");
+ testFrame._onbeforeunload_ = function() {
+ setTimeout(function() {
+ window.location.href = ""
+ }, 0);
+ };
testFrame.src = ""
}
-window.addEventListener('load', function() {
- setTimeout(function() {
- loadSubframeAndNavigateAway();
- }, 0);
-}, false);
+window.addEventListener('load', loadSubframeAndNavigateAway, false);
</script>
<iframe id="testFrame" src=""
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes