Diff
Modified: branches/safari-601-branch/LayoutTests/ChangeLog (190487 => 190488)
--- branches/safari-601-branch/LayoutTests/ChangeLog 2015-10-02 13:56:19 UTC (rev 190487)
+++ branches/safari-601-branch/LayoutTests/ChangeLog 2015-10-02 13:56:25 UTC (rev 190488)
@@ -1,5 +1,30 @@
2015-10-02 Matthew Hanson <[email protected]>
+ Merge r187921. rdar://problem/22801988
+
+ 2015-08-04 Chris Dumez <[email protected]>
+
+ Subframes with no current HistoryItem should not prevent page-caching
+ https://bugs.webkit.org/show_bug.cgi?id=147649
+ <rdar://problem/21614832>
+
+ Reviewed by Andreas Kling.
+
+ Add a layout test that covers page-caching of a page that contains an
+ iframe with no current HistoryItem. The sub-frame has no current
+ HistoryItem because its URL is invalid: "http://".
+
+ * http/tests/navigation/page-cache-iframe-no-current-historyItem-expected.txt: Added.
+ * http/tests/navigation/page-cache-iframe-no-current-historyItem.html: Added.
+ New test.
+
+ * platform/mac-wk1/TestExpectations:
+ Skip the new test on Mac WK1. The page is still not cacheable on Mac WK1
+ because WebFrameLoaderClient::canCachePage() returns false if the frame
+ does not contain HTML at the moment.
+
+2015-10-02 Matthew Hanson <[email protected]>
+
Merge r187593. rdar://problem/22801973
2015-07-30 Simon Fraser <[email protected]>
Added: branches/safari-601-branch/LayoutTests/http/tests/navigation/page-cache-iframe-no-current-historyItem-expected.txt (0 => 190488)
--- branches/safari-601-branch/LayoutTests/http/tests/navigation/page-cache-iframe-no-current-historyItem-expected.txt (rev 0)
+++ branches/safari-601-branch/LayoutTests/http/tests/navigation/page-cache-iframe-no-current-historyItem-expected.txt 2015-10-02 13:56:25 UTC (rev 190488)
@@ -0,0 +1,13 @@
+A frame without current history item should not prevent page caching.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+pageshow - not from cache
+pagehide - entering cache
+pageshow - from cache
+PASS Page did enter and was restored from the page cache
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: branches/safari-601-branch/LayoutTests/http/tests/navigation/page-cache-iframe-no-current-historyItem.html (0 => 190488)
--- branches/safari-601-branch/LayoutTests/http/tests/navigation/page-cache-iframe-no-current-historyItem.html (rev 0)
+++ branches/safari-601-branch/LayoutTests/http/tests/navigation/page-cache-iframe-no-current-historyItem.html 2015-10-02 13:56:25 UTC (rev 190488)
@@ -0,0 +1,40 @@
+<!DOCTYPE html>
+<html>
+<body>
+<script src=""
+<script>
+description("A frame without current history item should not prevent page caching.");
+window.jsTestIsAsync = true;
+
+if (window.testRunner)
+ testRunner.overridePreference("WebKitUsesPageCachePreferenceKey", 1);
+
+window.addEventListener("pageshow", function(event) {
+ debug("pageshow - " + (event.persisted ? "" : "not ") + "from cache");
+
+ if (event.persisted) {
+ testPassed("Page did enter and was restored from the page cache");
+ finishJSTest();
+ }
+}, false);
+
+window.addEventListener("pagehide", function(event) {
+ debug("pagehide - " + (event.persisted ? "" : "not ") + "entering cache");
+ if (!event.persisted) {
+ testFailed("Page did not enter the page cache.");
+ finishJSTest();
+ }
+}, false);
+
+window.addEventListener('load', function() {
+ setTimeout(function() {
+ // Force a back navigation back to this page.
+ window.location.href = ""
+ }, 0);
+}, false);
+
+</script>
+<iframe src=""
+<script src=""
+</body>
+</html>
Modified: branches/safari-601-branch/LayoutTests/platform/mac-wk1/TestExpectations (190487 => 190488)
--- branches/safari-601-branch/LayoutTests/platform/mac-wk1/TestExpectations 2015-10-02 13:56:19 UTC (rev 190487)
+++ branches/safari-601-branch/LayoutTests/platform/mac-wk1/TestExpectations 2015-10-02 13:56:25 UTC (rev 190488)
@@ -79,6 +79,9 @@
# WK1 doesn't do pending WebGL policies
fast/canvas/webgl/useWhilePending.html [ Skip ]
+# Mac-WK1 only caches frames containing HTML at the moment.
+http/tests/navigation/page-cache-iframe-no-current-historyItem.html
+
# Animated image throttling behaves differently on WK1.
fast/images/animated-gif-body-outside-viewport.html [ Skip ]
fast/images/animated-gif-window-resizing.html [ Skip ]
Modified: branches/safari-601-branch/Source/WebCore/ChangeLog (190487 => 190488)
--- branches/safari-601-branch/Source/WebCore/ChangeLog 2015-10-02 13:56:19 UTC (rev 190487)
+++ branches/safari-601-branch/Source/WebCore/ChangeLog 2015-10-02 13:56:25 UTC (rev 190488)
@@ -1,5 +1,31 @@
2015-10-02 Matthew Hanson <[email protected]>
+ Merge r187921. rdar://problem/22801988
+
+ 2015-08-04 Chris Dumez <[email protected]>
+
+ Subframes with no current HistoryItem should not prevent page-caching
+ https://bugs.webkit.org/show_bug.cgi?id=147649
+ <rdar://problem/21614832>
+
+ Reviewed by Andreas Kling.
+
+ Subframes with no current HistoryItem should not prevent page-caching.
+ We need one for the main frame as this is the key in the PageCache.
+ However, there is no reason to require one for subframes.
+
+ This is a common reason for page-caching failures nowadays.
+
+ Frames do no have a current HistoryItem until something has been loaded in them.
+
+ Test: http/tests/navigation/page-cache-iframe-no-current-historyItem.html
+
+ * history/PageCache.cpp:
+ (WebCore::logCanCacheFrameDecision):
+ (WebCore::PageCache::canCachePageContainingThisFrame):
+
+2015-10-02 Matthew Hanson <[email protected]>
+
Merge r187593. rdar://problem/22801973
2015-07-30 Simon Fraser <[email protected]>
Modified: branches/safari-601-branch/Source/WebCore/history/PageCache.cpp (190487 => 190488)
--- branches/safari-601-branch/Source/WebCore/history/PageCache.cpp 2015-10-02 13:56:19 UTC (rev 190487)
+++ branches/safari-601-branch/Source/WebCore/history/PageCache.cpp 2015-10-02 13:56:25 UTC (rev 190488)
@@ -155,8 +155,8 @@
logPageCacheFailureDiagnosticMessage(diagnosticLoggingClient, DiagnosticLoggingKeys::httpsNoStoreKey());
rejectReasons |= 1 << IsHttpsAndCacheControlled;
}
- if (!frame.loader().history().currentItem()) {
- PCLOG(" -No current history item");
+ if (frame.isMainFrame() && !frame.loader().history().currentItem()) {
+ PCLOG(" -Main frame has no current history item");
logPageCacheFailureDiagnosticMessage(diagnosticLoggingClient, DiagnosticLoggingKeys::noCurrentHistoryItemKey());
rejectReasons |= 1 << NoHistoryItem;
}
@@ -318,7 +318,7 @@
&& !(documentLoader->substituteData().isValid() && !documentLoader->substituteData().failingURL().isEmpty())
&& (!frameLoader.subframeLoader().containsPlugins() || frame.page()->settings().pageCacheSupportsPlugins())
&& !(frame.isMainFrame() && document->url().protocolIs("https") && documentLoader->response().cacheControlContainsNoStore())
- && frameLoader.history().currentItem()
+ && (!frame.isMainFrame() || frameLoader.history().currentItem())
&& !frameLoader.quickRedirectComing()
&& !documentLoader->isLoading()
&& !documentLoader->isStopping()