Bug 200395

Summary: Resource Load Statistics: Re-introduce latch mode for subresource cookie blocking
Product: WebKit Reporter: John Wilander <wilander>
Component: WebKit Misc.Assignee: John Wilander <wilander>
Status: RESOLVED FIXED    
Severity: Normal CC: achristensen, bfulgham, commit-queue, darin, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch none

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.