Bug 200395 - Resource Load Statistics: Re-introduce latch mode for subresource cookie blocking
Summary: Resource Load Statistics: Re-introduce latch mode for subresource cookie bloc...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: John Wilander
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2019-08-02 10:46 PDT by John Wilander
Modified: 2019-08-05 14:33 PDT (History)
5 users (show)

See Also:


Attachments
Patch (22.46 KB, patch)
2019-08-02 11:00 PDT, John Wilander
no flags Details | Formatted Diff | Diff
Patch (26.71 KB, patch)
2019-08-05 11:37 PDT, John Wilander
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description John Wilander 2019-08-02 10:46:33 PDT
Back when we had a relaxation of cookie blocking 24 hours after first-party user interaction, we made sure cookie blocking could be turned on and off in subresource redirect chains. The 24 hour window is now long gone and we should simplify the cookie blocking so that once a subresource request is denied cookies, any subsequent redirect of that request will also be denied cookies, regardless of the classification status of the domains involved.
Comment 1 Radar WebKit Bug Importer 2019-08-02 10:47:07 PDT
<rdar://problem/53869611>
Comment 2 John Wilander 2019-08-02 11:00:48 PDT
Created attachment 375427 [details]
Patch
Comment 3 Darin Adler 2019-08-04 18:28:34 PDT
Comment on attachment 375427 [details]
Patch

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

> Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:142
> +    NSHTTPCookieStorage *storage = statelessCookieStorage();
> +    [m_task _setExplicitCookieStorage:storage._cookieStorage];

Since we’re collapsing this, I don’t think the local variable adds anything any more. Could be a one liner instead.

    [m_task _setExplicitCookieStorage:statelessCookieStorage()._cookieStorage];
Comment 4 John Wilander 2019-08-05 11:03:59 PDT
(In reply to Darin Adler from comment #3)
> Comment on attachment 375427 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=375427&action=review
> 
> > Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:142
> > +    NSHTTPCookieStorage *storage = statelessCookieStorage();
> > +    [m_task _setExplicitCookieStorage:storage._cookieStorage];
> 
> Since we’re collapsing this, I don’t think the local variable adds anything
> any more. Could be a one liner instead.
> 
>     [m_task
> _setExplicitCookieStorage:statelessCookieStorage()._cookieStorage];

You're right. Will fix.

I'm also going to rename NetworkDataTaskCocoa::applyCookieBlockingPolicy() to NetworkDataTaskCocoa::blockCookies() to make it clear at the call sites. At first, I wanted to stay with the more general "apply policy" to not have to touch it if we introduce more logic there. But now I think that's wrong. Readability wins.
Comment 5 John Wilander 2019-08-05 11:04:33 PDT
Thanks for the review, Darin. I'll assume you're OK with the function renaming I mention above.
Comment 6 John Wilander 2019-08-05 11:37:50 PDT
Created attachment 375540 [details]
Patch
Comment 7 John Wilander 2019-08-05 11:39:44 PDT
The renaming ended up restructuring the code and I could remove some duplicate logging. So it's best to get another review.
Comment 8 John Wilander 2019-08-05 12:28:59 PDT
Orange bubbles are unrelated. The mac-debug tree seems red and the test failures on win have nothing to do with this code.
Comment 9 John Wilander 2019-08-05 14:03:17 PDT
Comment on attachment 375540 [details]
Patch

Thanks again, Darin!
Comment 10 WebKit Commit Bot 2019-08-05 14:33:58 PDT
Comment on attachment 375540 [details]
Patch

Clearing flags on attachment: 375540

Committed r248273: <https://trac.webkit.org/changeset/248273>
Comment 11 WebKit Commit Bot 2019-08-05 14:33:59 PDT
All reviewed patches have been landed.  Closing bug.