Bug 207692 - [Curl] Implement functions to use ResourceLoadStatistics.
Summary: [Curl] Implement functions to use ResourceLoadStatistics.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Platform (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Takashi Komori
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-02-13 05:52 PST by Takashi Komori
Modified: 2020-06-12 12:47 PDT (History)
15 users (show)

See Also:


Attachments
Implement some functions for ResouceLoadStatistics. (33.20 KB, patch)
2020-02-13 05:58 PST, Takashi Komori
no flags Details | Formatted Diff | Diff
Patch (49.61 KB, patch)
2020-05-31 18:55 PDT, Takashi Komori
no flags Details | Formatted Diff | Diff
Patch (34.12 KB, patch)
2020-05-31 21:00 PDT, Takashi Komori
no flags Details | Formatted Diff | Diff
Patch (33.61 KB, patch)
2020-06-01 02:52 PDT, Takashi Komori
no flags Details | Formatted Diff | Diff
Patch (34.13 KB, patch)
2020-06-05 00:26 PDT, Takashi Komori
no flags Details | Formatted Diff | Diff
Patch (33.87 KB, patch)
2020-06-09 01:58 PDT, Takashi Komori
no flags Details | Formatted Diff | Diff
Patch (34.45 KB, patch)
2020-06-10 12:48 PDT, Takashi Komori
no flags Details | Formatted Diff | Diff
Patch (34.48 KB, patch)
2020-06-12 11:24 PDT, Takashi Komori
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Takashi Komori 2020-02-13 05:52:59 PST
Implement functions to use ResouceLoadStatistics on curl port.
In this ticket we aim to pass all ResourceLoadStatistics tests on curl port.
Comment 1 Takashi Komori 2020-02-13 05:58:12 PST
Created attachment 390635 [details]
Implement some functions for ResouceLoadStatistics.

We implement some functions for curl port while refferring cocoa port.
Now 150 ResourceLoadStatistics tests pass and 11 tests fail.
Comment 2 Ross Kirsling 2020-02-13 10:29:41 PST
Comment on attachment 390635 [details]
Implement some functions for ResouceLoadStatistics.

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

A couple of nitpicks from me.

> Source/WebKit/NetworkProcess/curl/NetworkDataTaskCurl.cpp:60
> +    bool blockCookies = false;
> +#if ENABLE(RESOURCE_LOAD_STATISTICS)
> +    blockCookies = storedCredentialsPolicy == WebCore::StoredCredentialsPolicy::EphemeralStateless || shouldBlockCookies(request);
> +#endif

nit: Seems like an #else would be slightly better here.

> Tools/WebKitTestRunner/TestController.cpp:3115
> +    explicit GetAllStorageAccessEntriesCallbackContext(TestController& controller, CompletionHandler<void(Vector<String>&&)>&& handler)

nit: You shouldn't need `explicit` since this has two parameters.
Comment 3 Stephan Szabo 2020-02-13 10:55:55 PST
Comment on attachment 390635 [details]
Implement some functions for ResouceLoadStatistics.

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

> Source/WebKit/NetworkProcess/curl/NetworkDataTaskCurl.cpp:59
> +    blockCookies = storedCredentialsPolicy == WebCore::StoredCredentialsPolicy::EphemeralStateless || shouldBlockCookies(request);

Looking at the usage, is there a case where we want to separate the comparison with WebCore::StoredCredentialsPolicy::EphemeralStateless and the value of shouldBlockCookies(request)?
I wonder if it'd make sense to check the credentials policy inside shouldBlockCookies to prevent the possibility of misuse if the m_storedCredentialsPolicy == WebCore::StoredCredentialsPolicy::EphemeralStateless type comparsion is always required.
Comment 4 Takashi Komori 2020-05-31 18:55:41 PDT
Created attachment 400716 [details]
Patch
Comment 5 Takashi Komori 2020-05-31 21:00:32 PDT
Created attachment 400719 [details]
Patch
Comment 6 Takashi Komori 2020-05-31 21:34:46 PDT
(In reply to Ross Kirsling from comment #2)
> Comment on attachment 390635 [details]
> Implement some functions for ResouceLoadStatistics.
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=390635&action=review
> 
> A couple of nitpicks from me.
> 
> > Source/WebKit/NetworkProcess/curl/NetworkDataTaskCurl.cpp:60
> > +    bool blockCookies = false;
> > +#if ENABLE(RESOURCE_LOAD_STATISTICS)
> > +    blockCookies = storedCredentialsPolicy == WebCore::StoredCredentialsPolicy::EphemeralStateless || shouldBlockCookies(request);
> > +#endif
> 
> nit: Seems like an #else would be slightly better here.

I didn't add else part because now all lines are inside if clause.
Is it okay?

> > Tools/WebKitTestRunner/TestController.cpp:3115
> > +    explicit GetAllStorageAccessEntriesCallbackContext(TestController& controller, CompletionHandler<void(Vector<String>&&)>&& handler)
> 
> nit: You shouldn't need `explicit` since this has two parameters.

Fixed.
Comment 7 Takashi Komori 2020-06-01 02:52:21 PDT
Created attachment 400727 [details]
Patch
Comment 8 Takashi Komori 2020-06-01 02:56:26 PDT
(In reply to Stephan Szabo from comment #3)
> Comment on attachment 390635 [details]
> Implement some functions for ResouceLoadStatistics.
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=390635&action=review
> 
> > Source/WebKit/NetworkProcess/curl/NetworkDataTaskCurl.cpp:59
> > +    blockCookies = storedCredentialsPolicy == WebCore::StoredCredentialsPolicy::EphemeralStateless || shouldBlockCookies(request);
> 
> Looking at the usage, is there a case where we want to separate the
> comparison with WebCore::StoredCredentialsPolicy::EphemeralStateless and the
> value of shouldBlockCookies(request)?
> I wonder if it'd make sense to check the credentials policy inside
> shouldBlockCookies to prevent the possibility of misuse if the
> m_storedCredentialsPolicy ==
> WebCore::StoredCredentialsPolicy::EphemeralStateless type comparsion is
> always required.

We put together comparing StoredCredentialsPolicy and calling NetworkStorageSession::shouldBlockCookies
Comment 9 Basuke Suzuki 2020-06-02 18:54:45 PDT
Comment on attachment 400727 [details]
Patch

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

This is informal review: LGTM excepts for tiny documentation improvement.

> Source/WebCore/ChangeLog:8
> +        Implement functions which are required to implement ResourceLoadStatistics for wincairo.

This patch seems neutral to all ports using Curl. WinCairo shouldn't be specified as the target of this patch.
Comment 10 Basuke Suzuki 2020-06-02 18:59:35 PDT
It is not the comment for this patch, but adding more comment makes easier to understand the intent of the patch, especially the patch contains both WebKit and WebCore, WTF. Basically what you write is the objective of the patch and that is true for WebKit for many cases. For WebCore/WTF, to achieve that goal please describe what you did on that layer more specifically.
Comment 11 John Wilander 2020-06-04 13:13:09 PDT
Comment on attachment 400727 [details]
Patch

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

LGTM. See my one comment though. I'll let someone more familiar with the Curl integration to make the final call.

> Source/WebCore/platform/network/curl/CookieJarDB.cpp:622
> +bool CookieJarDB::deleteCookiesForHostname(const String& hostname, bool includeHttpOnlyCookies)

Why switch to a bool here when we have the IncludeHttpOnlyCookies enum that helps with self documentation?
Comment 12 Takashi Komori 2020-06-05 00:26:34 PDT
Created attachment 401123 [details]
Patch
Comment 13 Takashi Komori 2020-06-05 00:36:58 PDT
(In reply to Basuke Suzuki from comment #9)
> Comment on attachment 400727 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=400727&action=review
> 
> This is informal review: LGTM excepts for tiny documentation improvement.
> 
> > Source/WebCore/ChangeLog:8
> > +        Implement functions which are required to implement ResourceLoadStatistics for wincairo.
> 
> This patch seems neutral to all ports using Curl. WinCairo shouldn't be
> specified as the target of this patch.

Thank you for your review.
Changed to curl.
Comment 14 Takashi Komori 2020-06-05 00:42:21 PDT
(In reply to John Wilander from comment #11)
> Comment on attachment 400727 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=400727&action=review
> 
> LGTM. See my one comment though. I'll let someone more familiar with the
> Curl integration to make the final call.
> 
> > Source/WebCore/platform/network/curl/CookieJarDB.cpp:622
> > +bool CookieJarDB::deleteCookiesForHostname(const String& hostname, bool includeHttpOnlyCookies)
> 
> Why switch to a bool here when we have the IncludeHttpOnlyCookies enum that
> helps with self documentation?

Thank you very much for the review.
There is no reason using bool value so we changed to IncludeHttpOnlyCookies.
Comment 15 Takashi Komori 2020-06-09 01:58:37 PDT
Created attachment 401426 [details]
Patch
Comment 16 Takashi Komori 2020-06-09 02:01:06 PDT
We found we can improve some tests by implementing getHostnamesWithCookies.
So we updated the patch.
Comment 17 EWS 2020-06-09 07:50:54 PDT
Committed r262791: <https://trac.webkit.org/changeset/262791>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 401426 [details].
Comment 18 Radar WebKit Bug Importer 2020-06-09 07:51:18 PDT
<rdar://problem/64163880>
Comment 19 Radar WebKit Bug Importer 2020-06-09 07:51:21 PDT
<rdar://problem/64163879>
Comment 20 Fujii Hironori 2020-06-09 21:10:36 PDT
Committed r262834: <https://trac.webkit.org/changeset/262834>
Comment 21 Takashi Komori 2020-06-10 12:42:55 PDT
Reopen to fix WK1 crash bug.
Comment 22 Takashi Komori 2020-06-10 12:48:55 PDT
Created attachment 401571 [details]
Patch
Comment 23 Takashi Komori 2020-06-10 13:10:17 PDT
In WK1 some tests crashes because the value passed to NetworkStorageSession::clientSideCookieCap was uninitialized value.
We should not have dereferenced the variable.

This patch fixes the crash and fixes another compile issue that If we disable ENABLE_RESOURCE_LOAD_STATISTICS option, the build fails.
Comment 24 Takashi Komori 2020-06-12 11:24:25 PDT
Created attachment 401753 [details]
Patch
Comment 25 EWS 2020-06-12 12:47:20 PDT
Committed r262971: <https://trac.webkit.org/changeset/262971>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 401753 [details].