Bug 146299

Summary: Prevent new loads while in PageCache (or being added to PageCache)
Product: WebKit Reporter: Chris Dumez <cdumez>
Component: Page LoadingAssignee: Chris Dumez <cdumez>
Status: RESOLVED FIXED    
Severity: Normal CC: aestes, ap, barraclough, beidson, commit-queue, ddkilzer, japhet
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=145748
Attachments:
Description Flags
Patch darin: review+

Description Chris Dumez 2015-06-24 16:57:29 PDT
Prevent new loads while in PageCache (or being added to PageCache).
Comment 1 Chris Dumez 2015-06-24 16:57:45 PDT
rdar://problem/21523788
Comment 2 Chris Dumez 2015-06-24 21:36:23 PDT
Created attachment 255540 [details]
Patch
Comment 3 Chris Dumez 2015-06-25 09:41:40 PDT
Comment on attachment 255540 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=255540&action=review

> Source/WebCore/loader/cache/CachedResource.cpp:218
> +    if (cachedResourceLoader.frame()->page() && cachedResourceLoader.frame()->page()->inPageCache()) {

This is the actual change. The test of the patch is about getting rid of the complexity I added in r185337.
Comment 4 Darin Adler 2015-06-26 10:56:18 PDT
Comment on attachment 255540 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=255540&action=review

> Source/WebCore/loader/FrameLoader.h:280
> +    enum class PageDismissalType {
> +        None,
> +        BeforeUnload,
> +        PageHide,
> +        Unload
> +    };

I like this better in a single line; not sure if others agree.

> Source/WebCore/loader/cache/CachedResource.cpp:217
> +    // Prevent new loads if we are in the PageCache (or being added to the PageCache).

I would not use parentheses here. Just leave them out.

> Source/WebCore/page/Page.cpp:571
> +    auto* document = mainFrame().document();
> +    if (!document)
> +        return false;
> +
> +    return document->inPageCache();

I like writing it like this:

    auto* document = mainFrame().document();
    return document && document->inPageCache();
Comment 5 Chris Dumez 2015-06-26 11:27:09 PDT
Committed r186005: <http://trac.webkit.org/changeset/186005>