Bug 172155 - Resource Load Statistics: Grandfather domains for existing data records
Summary: Resource Load Statistics: Grandfather domains for existing data records
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-05-15 18:30 PDT by John Wilander
Modified: 2017-05-18 14:50 PDT (History)
12 users (show)

See Also:


Attachments
Patch (70.71 KB, patch)
2017-05-15 19:33 PDT, John Wilander
no flags Details | Formatted Diff | Diff
Patch (70.89 KB, patch)
2017-05-16 10:16 PDT, John Wilander
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews106 for mac-elcapitan-wk2 (1.18 MB, application/zip)
2017-05-16 11:20 PDT, Build Bot
no flags Details
Patch (70.91 KB, patch)
2017-05-16 11:46 PDT, John Wilander
no flags Details | Formatted Diff | Diff
Patch (70.98 KB, patch)
2017-05-16 11:51 PDT, John Wilander
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews105 for mac-elcapitan-wk2 (936.58 KB, application/zip)
2017-05-16 13:07 PDT, Build Bot
no flags Details
Patch (71.00 KB, patch)
2017-05-16 15:08 PDT, John Wilander
no flags Details | Formatted Diff | Diff
Patch (72.23 KB, patch)
2017-05-16 16:04 PDT, John Wilander
no flags Details | Formatted Diff | Diff
Patch for landing (72.30 KB, patch)
2017-05-17 16:37 PDT, John Wilander
no flags Details | Formatted Diff | Diff
Patch (72.70 KB, patch)
2017-05-18 11:27 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-05-15 18:30:23 PDT
We should grandfather domains for existing data records so allow ample time to capture user interaction.
Comment 1 John Wilander 2017-05-15 18:31:48 PDT
rdar://problem/24913532
Comment 2 John Wilander 2017-05-15 19:33:12 PDT
Created attachment 310207 [details]
Patch
Comment 3 John Wilander 2017-05-16 10:16:30 PDT
Created attachment 310270 [details]
Patch
Comment 4 Build Bot 2017-05-16 11:20:29 PDT
Comment on attachment 310270 [details]
Patch

Attachment 310270 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://webkit-queues.webkit.org/results/3751624

New failing tests:
http/tests/loading/resourceLoadStatistics/grandfathering.html
Comment 5 Build Bot 2017-05-16 11:20:31 PDT
Created attachment 310279 [details]
Archive of layout-test-results from ews106 for mac-elcapitan-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews106  Port: mac-elcapitan-wk2  Platform: Mac OS X 10.11.6
Comment 6 John Wilander 2017-05-16 11:46:48 PDT
Created attachment 310286 [details]
Patch
Comment 7 John Wilander 2017-05-16 11:51:00 PDT
Created attachment 310288 [details]
Patch
Comment 8 John Wilander 2017-05-16 12:02:22 PDT
The test case is not timing out on my machine which is why I'm trying a few things here to see what the bots do.
Comment 9 Build Bot 2017-05-16 13:07:01 PDT
Comment on attachment 310288 [details]
Patch

Attachment 310288 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://webkit-queues.webkit.org/results/3752175

New failing tests:
http/tests/loading/resourceLoadStatistics/grandfathering.html
Comment 10 Build Bot 2017-05-16 13:07:02 PDT
Created attachment 310292 [details]
Archive of layout-test-results from ews105 for mac-elcapitan-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews105  Port: mac-elcapitan-wk2  Platform: Mac OS X 10.11.6
Comment 11 John Wilander 2017-05-16 15:08:04 PDT
Created attachment 310303 [details]
Patch
Comment 12 John Wilander 2017-05-16 16:04:06 PDT
Created attachment 310312 [details]
Patch
Comment 13 Alex Christensen 2017-05-17 13:47:20 PDT
Comment on attachment 310312 [details]
Patch

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

> Source/WebCore/loader/ResourceLoadStatisticsStore.cpp:47
> +// 3 days in seconds
> +static auto grandfatheringTime = 259200;

static const auto secondsPerDay = 24 * 3600;
static auto grandfatheringTime = 3 * secondsPerDay;
etc.

> Source/WebCore/loader/ResourceLoadStatisticsStore.cpp:103
> +    if (version > 3) {

static const auto minimumVersionWithGrandfathering = 3;

> Source/WebCore/loader/ResourceLoadStatisticsStore.cpp:346
> +    double now = currentTime();

This local variable seems excessive.

> Source/WebCore/loader/ResourceLoadStatisticsStore.h:94
> +    double m_endOfGrandfatheringTimestamp { 0 };
> +    double m_lastTimeDataRecordsWereRemoved { 0 };

double -> Seconds?

> Source/WebKit2/UIProcess/WebProcessProxy.cpp:268
> +void WebProcessProxy::topPrivatelyControlledDomainsWithWebiteData(OptionSet<WebsiteDataType> dataTypes, bool shouldNotifyPage, std::function<void(HashSet<String>&&)> completionHandler)

I know we use std::function elsewhere in this file, but I don't think we should keep adding std::function where we can use Function, even if it differs in style from nearby code, unless it would require huge refactoring to not.

> Source/WebKit2/UIProcess/API/C/WKResourceLoadStatisticsManager.h:-50
> -    WK_EXPORT void WKResourceLoadStatisticsManagerSetMinimumTimeBetweeenDataRecordsRemoval(double seconds);

I assume this has never been adopted so we don't need to keep it in for binary compatibility with anything.

> Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.cpp:526
> +        for (auto&& dataRecord : existingDataRecords)

auto&&
cool!
Comment 14 John Wilander 2017-05-17 16:37:34 PDT
Created attachment 310459 [details]
Patch for landing
Comment 15 John Wilander 2017-05-17 16:40:19 PDT
(In reply to Alex Christensen from comment #13)
> Comment on attachment 310312 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=310312&action=review
> 
> > Source/WebCore/loader/ResourceLoadStatisticsStore.cpp:47
> > +// 3 days in seconds
> > +static auto grandfatheringTime = 259200;
> 
> static const auto secondsPerDay = 24 * 3600;
> static auto grandfatheringTime = 3 * secondsPerDay;
> etc.

Good suggestion. Fixed.

> > Source/WebCore/loader/ResourceLoadStatisticsStore.cpp:103
> > +    if (version > 3) {
> 
> static const auto minimumVersionWithGrandfathering = 3;

Fixed.

> > Source/WebCore/loader/ResourceLoadStatisticsStore.cpp:346
> > +    double now = currentTime();
> 
> This local variable seems excessive.

True.

> > Source/WebCore/loader/ResourceLoadStatisticsStore.h:94
> > +    double m_endOfGrandfatheringTimestamp { 0 };
> > +    double m_lastTimeDataRecordsWereRemoved { 0 };
> 
> double -> Seconds?

This I think goes into the bucked of changes we should do in an overhaul. Andy brought up the same thing earlier.

> > Source/WebKit2/UIProcess/WebProcessProxy.cpp:268
> > +void WebProcessProxy::topPrivatelyControlledDomainsWithWebiteData(OptionSet<WebsiteDataType> dataTypes, bool shouldNotifyPage, std::function<void(HashSet<String>&&)> completionHandler)
> 
> I know we use std::function elsewhere in this file, but I don't think we
> should keep adding std::function where we can use Function, even if it
> differs in style from nearby code, unless it would require huge refactoring
> to not.

Yes, I know you've said this before and so has Andy. Should I file a Bugzilla to work through the WebProcessProxy and the WebsiteDataStore classes and do this change?

> > Source/WebKit2/UIProcess/API/C/WKResourceLoadStatisticsManager.h:-50
> > -    WK_EXPORT void WKResourceLoadStatisticsManagerSetMinimumTimeBetweeenDataRecordsRemoval(double seconds);
> 
> I assume this has never been adopted so we don't need to keep it in for
> binary compatibility with anything.

I was never implemented.

> > Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.cpp:526
> > +        for (auto&& dataRecord : existingDataRecords)
> 
> auto&&
> cool!

Thanks, Alex!
Comment 16 WebKit Commit Bot 2017-05-17 16:55:28 PDT
Comment on attachment 310459 [details]
Patch for landing

Clearing flags on attachment: 310459

Committed r217014: <http://trac.webkit.org/changeset/217014>
Comment 17 WebKit Commit Bot 2017-05-17 16:55:30 PDT
All reviewed patches have been landed.  Closing bug.
Comment 18 Ryan Haddad 2017-05-17 17:34:46 PDT
(In reply to WebKit Commit Bot from comment #16)
> Comment on attachment 310459 [details]
> Patch for landing
> 
> Clearing flags on attachment: 310459
> 
> Committed r217014: <http://trac.webkit.org/changeset/217014>
This change caused LayoutTests to exit early with crashes on mac-wk2:

https://build.webkit.org/results/Apple%20Sierra%20Release%20WK2%20(Tests)/r217014%20(1561)/accessibility/accessibility-crash-setattribute-crash-log.txt

https://build.webkit.org/builders/Apple%20Sierra%20Release%20WK2%20(Tests)/builds/1561
Comment 19 Ryan Haddad 2017-05-17 17:37:16 PDT
Reverted r217014 for reason:

This change caused mac-wk2 LayoutTests to exit early due to crashes.

Committed r217020: <http://trac.webkit.org/changeset/217020>
Comment 20 John Wilander 2017-05-18 11:27:08 PDT
Created attachment 310522 [details]
Patch
Comment 21 WebKit Commit Bot 2017-05-18 14:50:08 PDT
Comment on attachment 310522 [details]
Patch

Clearing flags on attachment: 310522

Committed r217068: <http://trac.webkit.org/changeset/217068>
Comment 22 WebKit Commit Bot 2017-05-18 14:50:10 PDT
All reviewed patches have been landed.  Closing bug.