Bug 200418

Summary: Ping loads should not prevent page caching
Product: WebKit Reporter: Chris Dumez <cdumez>
Component: Page LoadingAssignee: Chris Dumez <cdumez>
Status: RESOLVED FIXED    
Severity: Normal CC: beidson, commit-queue, darin, dbates, ews-watchlist, ggaren, japhet, rniwa, webkit-bug-importer, youennf
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch none

Chris Dumez
Reported 2019-08-03 09:22:47 PDT
Ping loads should not prevent page caching.
Attachments
Patch (17.03 KB, patch)
2019-08-03 09:33 PDT, Chris Dumez
no flags
Radar WebKit Bug Importer
Comment 1 2019-08-03 09:23:13 PDT
Chris Dumez
Comment 2 2019-08-03 09:33:38 PDT
Darin Adler
Comment 3 2019-08-04 11:02:14 PDT
Comment on attachment 375486 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=375486&action=review Two suggestions for refinement later; neither should block landing this exactly as is. > Source/WebCore/history/PageCache.cpp:466 > + // Stop all loads again before checking if we can still cache the page after firing the pagehide > + // event, since the page may have started ping loads in its pagehide event handler. > + for (Frame* frame = &page->mainFrame(); frame; frame = frame->tree().traverseNext()) { > + if (auto* documentLoader = frame->loader().documentLoader()) > + documentLoader->stopLoading(); > + } Since this says "again" I assume there’s another copy of this loop somewhere. Could we share it rather than writing it out twice? > Source/WebCore/loader/DocumentLoader.cpp:128 > +static bool shouldPendingCachedResourceLoadPreventPageCache(CachedResource& cachedResource) I think the local could be named just "resource" since its unambiguous in the context of this sort function.
WebKit Commit Bot
Comment 4 2019-08-04 11:32:51 PDT
Comment on attachment 375486 [details] Patch Clearing flags on attachment: 375486 Committed r248265: <https://trac.webkit.org/changeset/248265>
WebKit Commit Bot
Comment 5 2019-08-04 11:32:52 PDT
All reviewed patches have been landed. Closing bug.
youenn fablet
Comment 6 2019-08-04 16:28:43 PDT
Comment on attachment 375486 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=375486&action=review > Source/WebCore/loader/DocumentLoader.cpp:139 > + return false; Similarly to prefetch, preloads should probably not prevent entering page cache. Probably not a huge risk in practice but this would be nice to cover that case as well. Something like (resource.isLinkPreload() && resource.preloadResult() == CachedResource::PreloadResult::PreloadNotReferenced) might do the trick.
Note You need to log in before you can comment on or make changes to this bug.