Changeset 248359 in webkit
- Timestamp:
- Aug 6, 2019, 11:53:05 PM (7 years ago)
- Location:
- branches/safari-608.1-branch
- Files:
-
- 4 added
- 7 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/http/tests/navigation/page-cache-pending-ping-load-cross-origin-expected.txt (added)
-
LayoutTests/http/tests/navigation/page-cache-pending-ping-load-cross-origin.html (added)
-
LayoutTests/http/tests/navigation/page-cache-pending-ping-load-same-origin-expected.txt (added)
-
LayoutTests/http/tests/navigation/page-cache-pending-ping-load-same-origin.html (added)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/history/PageCache.cpp (modified) (1 diff)
-
Source/WebCore/loader/DocumentLoader.cpp (modified) (3 diffs)
-
Tools/ChangeLog (modified) (1 diff)
-
Tools/WebKitTestRunner/TestController.cpp (modified) (3 diffs)
-
Tools/WebKitTestRunner/TestOptions.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/safari-608.1-branch/LayoutTests/ChangeLog
r248358 r248359 1 2019-08-06 Kocsen Chung <kocsen_chung@apple.com> 2 3 Cherry-pick r248265. rdar://problem/54017843 4 5 Ping loads should not prevent page caching 6 https://bugs.webkit.org/show_bug.cgi?id=200418 7 <rdar://problem/53901632> 8 9 Reviewed by Darin Adler. 10 11 Source/WebCore: 12 13 We normally prevent page caching if there were any pending subresource loads when navigating, 14 to avoid caching partial / broken content. However, this should not apply to Ping / Beacon 15 loads since those do not impact page rendering and can outlive the page. 16 17 Tests: http/tests/navigation/page-cache-pending-ping-load-cross-origin.html 18 http/tests/navigation/page-cache-pending-ping-load-same-origin.html 19 20 * history/PageCache.cpp: 21 (WebCore::PageCache::addIfCacheable): 22 After we've fired the 'pagehide' event in each frame, stop all the loads again. This is needed 23 since pages are allowed to start ping / beacon loads in their 'pagehide' handlers. If we do not 24 stop those loads, then the next call to canCachePage() would fail because the DocumentLoader is 25 still loading. Note that we're not actually preventing these ping loads from hitting the server 26 since we never cancel page loads and those can outlive their page. 27 28 * loader/DocumentLoader.cpp: 29 (WebCore::shouldPendingCachedResourceLoadPreventPageCache): 30 (WebCore::areAllLoadersPageCacheAcceptable): 31 Make sure that Ping / Beacon / Prefetches / Icon loads do not prevent page caching. 32 33 (WebCore::DocumentLoader::addSubresourceLoader): 34 Tweak assertion that was incorrect since we actually allow ping / beacon loads when the 35 document is about to enter PageCache (while firing pagehide event). 36 37 Tools: 38 39 Add TestOption to enable PageCache at UIProcess-level so that we can test 40 page caching when navigating cross-origin with PSON enabled. 41 42 * WebKitTestRunner/TestController.cpp: 43 (WTR::TestController::resetPreferencesToConsistentValues): 44 (WTR::updateTestOptionsFromTestHeader): 45 * WebKitTestRunner/TestOptions.h: 46 (WTR::TestOptions::hasSameInitializationOptions const): 47 48 LayoutTests: 49 50 Add layout test coverage. 51 52 * http/tests/navigation/page-cache-pending-ping-load-cross-origin-expected.txt: Added. 53 * http/tests/navigation/page-cache-pending-ping-load-cross-origin.html: Added. 54 * http/tests/navigation/page-cache-pending-ping-load-same-origin-expected.txt: Added. 55 * http/tests/navigation/page-cache-pending-ping-load-same-origin.html: Added. 56 57 58 git-svn-id: https://svn.webkit.org/repository/webkit/trunk@248265 268f45cc-cd09-0410-ab3c-d52691b4dbfc 59 60 2019-08-04 Chris Dumez <cdumez@apple.com> 61 62 Ping loads should not prevent page caching 63 https://bugs.webkit.org/show_bug.cgi?id=200418 64 <rdar://problem/53901632> 65 66 Reviewed by Darin Adler. 67 68 Add layout test coverage. 69 70 * http/tests/navigation/page-cache-pending-ping-load-cross-origin-expected.txt: Added. 71 * http/tests/navigation/page-cache-pending-ping-load-cross-origin.html: Added. 72 * http/tests/navigation/page-cache-pending-ping-load-same-origin-expected.txt: Added. 73 * http/tests/navigation/page-cache-pending-ping-load-same-origin.html: Added. 74 1 75 2019-08-06 Kocsen Chung <kocsen_chung@apple.com> 2 76 -
branches/safari-608.1-branch/Source/WebCore/ChangeLog
r248358 r248359 1 2019-08-06 Kocsen Chung <kocsen_chung@apple.com> 2 3 Cherry-pick r248265. rdar://problem/54017843 4 5 Ping loads should not prevent page caching 6 https://bugs.webkit.org/show_bug.cgi?id=200418 7 <rdar://problem/53901632> 8 9 Reviewed by Darin Adler. 10 11 Source/WebCore: 12 13 We normally prevent page caching if there were any pending subresource loads when navigating, 14 to avoid caching partial / broken content. However, this should not apply to Ping / Beacon 15 loads since those do not impact page rendering and can outlive the page. 16 17 Tests: http/tests/navigation/page-cache-pending-ping-load-cross-origin.html 18 http/tests/navigation/page-cache-pending-ping-load-same-origin.html 19 20 * history/PageCache.cpp: 21 (WebCore::PageCache::addIfCacheable): 22 After we've fired the 'pagehide' event in each frame, stop all the loads again. This is needed 23 since pages are allowed to start ping / beacon loads in their 'pagehide' handlers. If we do not 24 stop those loads, then the next call to canCachePage() would fail because the DocumentLoader is 25 still loading. Note that we're not actually preventing these ping loads from hitting the server 26 since we never cancel page loads and those can outlive their page. 27 28 * loader/DocumentLoader.cpp: 29 (WebCore::shouldPendingCachedResourceLoadPreventPageCache): 30 (WebCore::areAllLoadersPageCacheAcceptable): 31 Make sure that Ping / Beacon / Prefetches / Icon loads do not prevent page caching. 32 33 (WebCore::DocumentLoader::addSubresourceLoader): 34 Tweak assertion that was incorrect since we actually allow ping / beacon loads when the 35 document is about to enter PageCache (while firing pagehide event). 36 37 Tools: 38 39 Add TestOption to enable PageCache at UIProcess-level so that we can test 40 page caching when navigating cross-origin with PSON enabled. 41 42 * WebKitTestRunner/TestController.cpp: 43 (WTR::TestController::resetPreferencesToConsistentValues): 44 (WTR::updateTestOptionsFromTestHeader): 45 * WebKitTestRunner/TestOptions.h: 46 (WTR::TestOptions::hasSameInitializationOptions const): 47 48 LayoutTests: 49 50 Add layout test coverage. 51 52 * http/tests/navigation/page-cache-pending-ping-load-cross-origin-expected.txt: Added. 53 * http/tests/navigation/page-cache-pending-ping-load-cross-origin.html: Added. 54 * http/tests/navigation/page-cache-pending-ping-load-same-origin-expected.txt: Added. 55 * http/tests/navigation/page-cache-pending-ping-load-same-origin.html: Added. 56 57 58 git-svn-id: https://svn.webkit.org/repository/webkit/trunk@248265 268f45cc-cd09-0410-ab3c-d52691b4dbfc 59 60 2019-08-04 Chris Dumez <cdumez@apple.com> 61 62 Ping loads should not prevent page caching 63 https://bugs.webkit.org/show_bug.cgi?id=200418 64 <rdar://problem/53901632> 65 66 Reviewed by Darin Adler. 67 68 We normally prevent page caching if there were any pending subresource loads when navigating, 69 to avoid caching partial / broken content. However, this should not apply to Ping / Beacon 70 loads since those do not impact page rendering and can outlive the page. 71 72 Tests: http/tests/navigation/page-cache-pending-ping-load-cross-origin.html 73 http/tests/navigation/page-cache-pending-ping-load-same-origin.html 74 75 * history/PageCache.cpp: 76 (WebCore::PageCache::addIfCacheable): 77 After we've fired the 'pagehide' event in each frame, stop all the loads again. This is needed 78 since pages are allowed to start ping / beacon loads in their 'pagehide' handlers. If we do not 79 stop those loads, then the next call to canCachePage() would fail because the DocumentLoader is 80 still loading. Note that we're not actually preventing these ping loads from hitting the server 81 since we never cancel page loads and those can outlive their page. 82 83 * loader/DocumentLoader.cpp: 84 (WebCore::shouldPendingCachedResourceLoadPreventPageCache): 85 (WebCore::areAllLoadersPageCacheAcceptable): 86 Make sure that Ping / Beacon / Prefetches / Icon loads do not prevent page caching. 87 88 (WebCore::DocumentLoader::addSubresourceLoader): 89 Tweak assertion that was incorrect since we actually allow ping / beacon loads when the 90 document is about to enter PageCache (while firing pagehide event). 91 1 92 2019-08-06 Kocsen Chung <kocsen_chung@apple.com> 2 93 -
branches/safari-608.1-branch/Source/WebCore/history/PageCache.cpp
r246187 r248359 459 459 destroyRenderTree(page->mainFrame()); 460 460 461 // Stop all loads again before checking if we can still cache the page after firing the pagehide 462 // event, since the page may have started ping loads in its pagehide event handler. 463 for (Frame* frame = &page->mainFrame(); frame; frame = frame->tree().traverseNext()) { 464 if (auto* documentLoader = frame->loader().documentLoader()) 465 documentLoader->stopLoading(); 466 } 467 461 468 // Check that the page is still page-cacheable after firing the pagehide event. The JS event handlers 462 469 // could have altered the page in a way that could prevent caching. -
branches/safari-608.1-branch/Source/WebCore/loader/DocumentLoader.cpp
r248358 r248359 126 126 } 127 127 128 static bool shouldPendingCachedResourceLoadPreventPageCache(CachedResource& cachedResource) 129 { 130 if (!cachedResource.isLoading()) 131 return false; 132 133 switch (cachedResource.type()) { 134 case CachedResource::Type::ImageResource: 135 case CachedResource::Type::Icon: 136 case CachedResource::Type::Beacon: 137 case CachedResource::Type::Ping: 138 case CachedResource::Type::LinkPrefetch: 139 return false; 140 case CachedResource::Type::MainResource: 141 case CachedResource::Type::CSSStyleSheet: 142 case CachedResource::Type::Script: 143 case CachedResource::Type::FontResource: 144 #if ENABLE(SVG_FONTS) 145 case CachedResource::Type::SVGFontResource: 146 #endif 147 case CachedResource::Type::MediaResource: 148 case CachedResource::Type::RawResource: 149 case CachedResource::Type::SVGDocumentResource: 150 #if ENABLE(XSLT) 151 case CachedResource::Type::XSLStyleSheet: 152 #endif 153 #if ENABLE(VIDEO_TRACK) 154 case CachedResource::Type::TextTrackResource: 155 #endif 156 #if ENABLE(APPLICATION_MANIFEST) 157 case CachedResource::Type::ApplicationManifest: 158 #endif 159 break; 160 }; 161 return !cachedResource.areAllClientsXMLHttpRequests(); 162 } 163 128 164 static bool areAllLoadersPageCacheAcceptable(const ResourceLoaderMap& loaders) 129 165 { … … 138 174 // Only image and XHR loads do not prevent the page from entering the PageCache. 139 175 // All non-image loads will prevent the page from entering the PageCache. 140 if ( cachedResource->isLoading() && !cachedResource->isImage() && !cachedResource->areAllClientsXMLHttpRequests())176 if (shouldPendingCachedResourceLoadPreventPageCache(*cachedResource)) 141 177 return false; 142 178 } … … 1683 1719 return; 1684 1720 1685 // A page in the PageCache or about to enter PageCache should not be able to start loads. 1686 ASSERT_WITH_SECURITY_IMPLICATION(!document() || document()->pageCacheState() == Document::NotInPageCache); 1721 #if !ASSERT_DISABLED 1722 if (document()) { 1723 switch (document()->pageCacheState()) { 1724 case Document::NotInPageCache: 1725 break; 1726 case Document::AboutToEnterPageCache: { 1727 // A page about to enter PageCache should only be able to start ping loads. 1728 auto* cachedResource = MemoryCache::singleton().resourceForRequest(loader->request(), loader->frameLoader()->frame().page()->sessionID()); 1729 ASSERT(cachedResource && CachedResource::shouldUsePingLoad(cachedResource->type())); 1730 break; 1731 } 1732 case Document::InPageCache: 1733 // A page in the PageCache should not be able to start loads. 1734 ASSERT_NOT_REACHED(); 1735 break; 1736 } 1737 } 1738 #endif 1687 1739 1688 1740 m_subresourceLoaders.add(loader->identifier(), loader); -
branches/safari-608.1-branch/Tools/ChangeLog
r248344 r248359 1 2019-08-06 Kocsen Chung <kocsen_chung@apple.com> 2 3 Cherry-pick r248265. rdar://problem/54017843 4 5 Ping loads should not prevent page caching 6 https://bugs.webkit.org/show_bug.cgi?id=200418 7 <rdar://problem/53901632> 8 9 Reviewed by Darin Adler. 10 11 Source/WebCore: 12 13 We normally prevent page caching if there were any pending subresource loads when navigating, 14 to avoid caching partial / broken content. However, this should not apply to Ping / Beacon 15 loads since those do not impact page rendering and can outlive the page. 16 17 Tests: http/tests/navigation/page-cache-pending-ping-load-cross-origin.html 18 http/tests/navigation/page-cache-pending-ping-load-same-origin.html 19 20 * history/PageCache.cpp: 21 (WebCore::PageCache::addIfCacheable): 22 After we've fired the 'pagehide' event in each frame, stop all the loads again. This is needed 23 since pages are allowed to start ping / beacon loads in their 'pagehide' handlers. If we do not 24 stop those loads, then the next call to canCachePage() would fail because the DocumentLoader is 25 still loading. Note that we're not actually preventing these ping loads from hitting the server 26 since we never cancel page loads and those can outlive their page. 27 28 * loader/DocumentLoader.cpp: 29 (WebCore::shouldPendingCachedResourceLoadPreventPageCache): 30 (WebCore::areAllLoadersPageCacheAcceptable): 31 Make sure that Ping / Beacon / Prefetches / Icon loads do not prevent page caching. 32 33 (WebCore::DocumentLoader::addSubresourceLoader): 34 Tweak assertion that was incorrect since we actually allow ping / beacon loads when the 35 document is about to enter PageCache (while firing pagehide event). 36 37 Tools: 38 39 Add TestOption to enable PageCache at UIProcess-level so that we can test 40 page caching when navigating cross-origin with PSON enabled. 41 42 * WebKitTestRunner/TestController.cpp: 43 (WTR::TestController::resetPreferencesToConsistentValues): 44 (WTR::updateTestOptionsFromTestHeader): 45 * WebKitTestRunner/TestOptions.h: 46 (WTR::TestOptions::hasSameInitializationOptions const): 47 48 LayoutTests: 49 50 Add layout test coverage. 51 52 * http/tests/navigation/page-cache-pending-ping-load-cross-origin-expected.txt: Added. 53 * http/tests/navigation/page-cache-pending-ping-load-cross-origin.html: Added. 54 * http/tests/navigation/page-cache-pending-ping-load-same-origin-expected.txt: Added. 55 * http/tests/navigation/page-cache-pending-ping-load-same-origin.html: Added. 56 57 58 git-svn-id: https://svn.webkit.org/repository/webkit/trunk@248265 268f45cc-cd09-0410-ab3c-d52691b4dbfc 59 60 2019-08-04 Chris Dumez <cdumez@apple.com> 61 62 Ping loads should not prevent page caching 63 https://bugs.webkit.org/show_bug.cgi?id=200418 64 <rdar://problem/53901632> 65 66 Reviewed by Darin Adler. 67 68 Add TestOption to enable PageCache at UIProcess-level so that we can test 69 page caching when navigating cross-origin with PSON enabled. 70 71 * WebKitTestRunner/TestController.cpp: 72 (WTR::TestController::resetPreferencesToConsistentValues): 73 (WTR::updateTestOptionsFromTestHeader): 74 * WebKitTestRunner/TestOptions.h: 75 (WTR::TestOptions::hasSameInitializationOptions const): 76 1 77 2019-08-06 Kocsen Chung <kocsen_chung@apple.com> 2 78 -
branches/safari-608.1-branch/Tools/WebKitTestRunner/TestController.cpp
r246856 r248359 799 799 WKPreferencesSetFullScreenEnabled(preferences, true); 800 800 #endif 801 WKPreferencesSetPageCacheEnabled(preferences, false);802 801 WKPreferencesSetAsynchronousPluginInitializationEnabled(preferences, false); 803 802 WKPreferencesSetAsynchronousPluginInitializationEnabledForAllPlugins(preferences, false); … … 819 818 WKPreferencesSetColorFilterEnabled(preferences, options.enableColorFilter); 820 819 WKPreferencesSetPunchOutWhiteBackgroundsInDarkMode(preferences, options.punchOutWhiteBackgroundsInDarkMode); 820 WKPreferencesSetPageCacheEnabled(preferences, options.enablePageCache); 821 821 822 822 static WKStringRef defaultTextEncoding = WKStringCreateWithUTF8CString("ISO-8859-1"); … … 1397 1397 else if (key == "enableAppNap") 1398 1398 testOptions.enableAppNap = parseBooleanTestHeaderValue(value); 1399 else if (key == "enablePageCache") 1400 testOptions.enablePageCache = parseBooleanTestHeaderValue(value); 1399 1401 pairStart = pairEnd + 1; 1400 1402 } -
branches/safari-608.1-branch/Tools/WebKitTestRunner/TestOptions.h
r246118 r248359 93 93 bool shouldPresentPopovers { true }; 94 94 bool enableAppNap { false }; 95 bool enablePageCache { false }; 95 96 96 97 double contentInsetTop { 0 }; … … 147 148 || contentInsetTop != options.contentInsetTop 148 149 || contentMode != options.contentMode 149 || enableAppNap != options.enableAppNap) 150 || enableAppNap != options.enableAppNap 151 || enablePageCache != options.enablePageCache) 150 152 return false; 151 153
Note:
See TracChangeset
for help on using the changeset viewer.