Bug 171295 - Resource Load Statistics: Introduce shorter time-to-live for cookie partition whitelisting
Summary: Resource Load Statistics: Introduce shorter time-to-live for cookie partition...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: John Wilander
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2017-04-25 16:01 PDT by John Wilander
Modified: 2017-04-25 18:23 PDT (History)
8 users (show)

See Also:


Attachments
Patch (44.17 KB, patch)
2017-04-25 16:24 PDT, John Wilander
no flags Details | Formatted Diff | Diff
Patch for landing (44.36 KB, patch)
2017-04-25 17:50 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 2017-04-25 16:01:58 PDT
Introduce shorter time-to-live for cookie partition whitelisting.
Comment 1 Radar WebKit Bug Importer 2017-04-25 16:07:29 PDT
<rdar://problem/31823818>
Comment 2 John Wilander 2017-04-25 16:24:40 PDT
Created attachment 308162 [details]
Patch
Comment 3 Brent Fulgham 2017-04-25 17:30:04 PDT
Comment on attachment 308162 [details]
Patch

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

Looks good. Please double-check the mix of doubles and integer math is doing what you expect, and consider using a method to hide the complexity of that one predicate. Otherwise r=me.

> Source/WebCore/loader/ResourceLoadObserver.cpp:52
> +static auto timestampResolution = 3600;

I think this gives an integer value...

> Source/WebCore/loader/ResourceLoadObserver.cpp:306
>      return std::floor(seconds / timestampResolution) * timestampResolution;

... so doesn't this do integer division? Maybe the floor doesn't do anything here?

> Source/WebCore/loader/ResourceLoadStatisticsStore.cpp:192
> +            || currentTime() > resourceStatistic.mostRecentUserInteraction + timeToLiveCookiePartitionFree);

I think this would read a little more cleanly as a local static method:

static bool shouldPartitionCookie(...)
Comment 4 John Wilander 2017-04-25 17:50:24 PDT
Created attachment 308177 [details]
Patch for landing
Comment 5 John Wilander 2017-04-25 17:53:31 PDT
(In reply to Brent Fulgham from comment #3)
> Comment on attachment 308162 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=308162&action=review
> 
> Looks good. Please double-check the mix of doubles and integer math is doing
> what you expect, and consider using a method to hide the complexity of that
> one predicate. Otherwise r=me.
> 
> > Source/WebCore/loader/ResourceLoadObserver.cpp:52
> > +static auto timestampResolution = 3600;
> 
> I think this gives an integer value...
> 
> > Source/WebCore/loader/ResourceLoadObserver.cpp:306
> >      return std::floor(seconds / timestampResolution) * timestampResolution;
> 
> ... so doesn't this do integer division? Maybe the floor doesn't do anything
> here?

I tested it and the call to floor() does make a difference:
Without floor 1493167842.243571
With floor 1493164800.000000

> > Source/WebCore/loader/ResourceLoadStatisticsStore.cpp:192
> > +            || currentTime() > resourceStatistic.mostRecentUserInteraction + timeToLiveCookiePartitionFree);
> 
> I think this would read a little more cleanly as a local static method:
> 
> static bool shouldPartitionCookie(...)

Agreed and fixed.

Thanks for the review, Brent!
Comment 6 WebKit Commit Bot 2017-04-25 18:22:59 PDT
Comment on attachment 308177 [details]
Patch for landing

Clearing flags on attachment: 308177

Committed r215782: <http://trac.webkit.org/changeset/215782>
Comment 7 WebKit Commit Bot 2017-04-25 18:23:01 PDT
All reviewed patches have been landed.  Closing bug.