Bug 146299 - Prevent new loads while in PageCache (or being added to PageCache)
Summary: Prevent new loads while in PageCache (or being added to PageCache)
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Page Loading (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2015-06-24 16:57 PDT by Chris Dumez
Modified: 2015-06-26 11:27 PDT (History)
7 users (show)

See Also:


Attachments
Patch (13.77 KB, patch)
2015-06-24 21:36 PDT, Chris Dumez
darin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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>