WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
Bug 209032
Report all third party loads on a per-page basis
https://bugs.webkit.org/show_bug.cgi?id=209032
Summary
Report all third party loads on a per-page basis
Kate Cheney
Reported
2020-03-12 18:30:36 PDT
WKWebsiteDataStore should have an SPI call to report all third party domains loaded for a specific WebView. This should replace the call reporting only prevalent domains.
Attachments
Patch
(43.19 KB, patch)
2020-03-12 18:44 PDT
,
Kate Cheney
no flags
Details
Formatted Diff
Diff
Patch
(42.79 KB, patch)
2020-03-12 19:06 PDT
,
Kate Cheney
no flags
Details
Formatted Diff
Diff
Patch
(50.76 KB, patch)
2020-03-13 08:25 PDT
,
Kate Cheney
no flags
Details
Formatted Diff
Diff
Patch
(50.88 KB, patch)
2020-03-13 09:58 PDT
,
Kate Cheney
no flags
Details
Formatted Diff
Diff
Patch for landing
(50.87 KB, patch)
2020-03-13 11:56 PDT
,
Kate Cheney
no flags
Details
Formatted Diff
Diff
Show Obsolete
(4)
View All
Add attachment
proposed patch, testcase, etc.
Kate Cheney
Comment 1
2020-03-12 18:31:07 PDT
<
rdar://problem/60397323
>
Kate Cheney
Comment 2
2020-03-12 18:44:38 PDT
Created
attachment 393438
[details]
Patch
Kate Cheney
Comment 3
2020-03-12 19:06:37 PDT
Created
attachment 393441
[details]
Patch
John Wilander
Comment 4
2020-03-12 19:53:21 PDT
Comment on
attachment 393441
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=393441&action=review
Bots seem unhappy.
> Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.mm:393 > +- (void)_getLoadedDomainsFor:(WKWebView *)webView completionHandler:(void (^)(NSArray<NSString *> *domains))completionHandler
If this truly returns third-party loads I think the name should include that, _getLoadedThirdPartyDomains(). Likewise for the rest of the re-naming.
> Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:348 > + void getLoadedDomains(object callback);
Likewise for re-naming in Tools code.
John Wilander
Comment 5
2020-03-12 19:54:49 PDT
Build failure in WebPage.cpp.
Kate Cheney
Comment 6
2020-03-13 08:09:04 PDT
(In reply to John Wilander from
comment #5
)
> Build failure in WebPage.cpp.
(In reply to John Wilander from
comment #4
)
> Comment on
attachment 393441
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=393441&action=review
> > Bots seem unhappy. >
Whoops, not sure why that wasn't caught by my local build
> > Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.mm:393 > > +- (void)_getLoadedDomainsFor:(WKWebView *)webView completionHandler:(void (^)(NSArray<NSString *> *domains))completionHandler > > If this truly returns third-party loads I think the name should include > that, _getLoadedThirdPartyDomains(). Likewise for the rest of the re-naming. > > > Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:348 > > + void getLoadedDomains(object callback); > > Likewise for re-naming in Tools code.
Good call, uploading a new patch with this change.
Kate Cheney
Comment 7
2020-03-13 08:25:28 PDT
Created
attachment 393483
[details]
Patch
Kate Cheney
Comment 8
2020-03-13 08:45:47 PDT
(In reply to katherine_cheney from
comment #7
)
> Created
attachment 393483
[details]
> Patch
Style bot always seems upset when adding a function to Source/WebCore/loader/FrameLoaderClient.h :(
Chris Dumez
Comment 9
2020-03-13 09:02:08 PDT
Comment on
attachment 393483
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=393483&action=review
> Source/WebKit/WebProcess/WebPage/WebPage.h:1192 > + void getLoadedThirdPartyDomains(CompletionHandler<void(Vector<WebCore::RegistrableDomain>)>&&);
No get prefixes for getters please.
Chris Dumez
Comment 10
2020-03-13 09:08:31 PDT
Comment on
attachment 393483
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=393483&action=review
> Source/WebKit/WebProcess/WebPage/WebPage.cpp:6700 > + m_loadedThirdPartyDomains.add(domain);
Where in your code are you checking that it is a third-party domain? As far as I can tell, you are adding the first-party domain to this set too.
Kate Cheney
Comment 11
2020-03-13 09:19:27 PDT
(In reply to Chris Dumez from
comment #10
)
> Comment on
attachment 393483
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=393483&action=review
> > > Source/WebKit/WebProcess/WebPage/WebPage.cpp:6700 > > + m_loadedThirdPartyDomains.add(domain); > > Where in your code are you checking that it is a third-party domain? As far > as I can tell, you are adding the first-party domain to this set too.
You're right. I think I need to add a check for if the mainFrameURL == targetURL
Chris Dumez
Comment 12
2020-03-13 09:22:56 PDT
(In reply to katherine_cheney from
comment #11
)
> (In reply to Chris Dumez from
comment #10
) > > Comment on
attachment 393483
[details]
> > Patch > > > > View in context: > >
https://bugs.webkit.org/attachment.cgi?id=393483&action=review
> > > > > Source/WebKit/WebProcess/WebPage/WebPage.cpp:6700 > > > + m_loadedThirdPartyDomains.add(domain); > > > > Where in your code are you checking that it is a third-party domain? As far > > as I can tell, you are adding the first-party domain to this set too. > > You're right. I think I need to add a check for if the mainFrameURL == > targetURL
I believe you want to be checking registrable domains, not URLs.
Kate Cheney
Comment 13
2020-03-13 09:24:13 PDT
(In reply to Chris Dumez from
comment #12
)
> (In reply to katherine_cheney from
comment #11
) > > (In reply to Chris Dumez from
comment #10
) > > > Comment on
attachment 393483
[details]
> > > Patch > > > > > > View in context: > > >
https://bugs.webkit.org/attachment.cgi?id=393483&action=review
> > > > > > > Source/WebKit/WebProcess/WebPage/WebPage.cpp:6700 > > > > + m_loadedThirdPartyDomains.add(domain); > > > > > > Where in your code are you checking that it is a third-party domain? As far > > > as I can tell, you are adding the first-party domain to this set too. > > > > You're right. I think I need to add a check for if the mainFrameURL == > > targetURL > > I believe you want to be checking registrable domains, not URLs.
Yes, typo. I will be comparing the RegistrableDomains in WebPage::addLoadedThirdPartyDomain before adding to the HashSet. Thank you for pointing this out!
Kate Cheney
Comment 14
2020-03-13 09:58:01 PDT
Created
attachment 393494
[details]
Patch
John Wilander
Comment 15
2020-03-13 10:48:43 PDT
(In reply to katherine_cheney from
comment #11
)
> (In reply to Chris Dumez from
comment #10
) > > Comment on
attachment 393483
[details]
> > Patch > > > > View in context: > >
https://bugs.webkit.org/attachment.cgi?id=393483&action=review
> > > > > Source/WebKit/WebProcess/WebPage/WebPage.cpp:6700 > > > + m_loadedThirdPartyDomains.add(domain); > > > > Where in your code are you checking that it is a third-party domain? As far > > as I can tell, you are adding the first-party domain to this set too. > > You're right. I think I need to add a check for if the mainFrameURL == > targetURL
I actually thought about this but reckoned that it must be checked already since the same bug would otherwise apply to existing code with the isPrevalent check. Apparently we do have that bug in trunk then. Good catch, Chris!
Chris Dumez
Comment 16
2020-03-13 10:50:19 PDT
Comment on
attachment 393494
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=393494&action=review
> Source/WebCore/Modules/websockets/WebSocket.cpp:331 > + frame->loader().client().addLoadedThirdPartyDomain(WTFMove(domain));
You're calling addLoadedThirdPartyDomain() with a domain that is not necessarily third-party. As a result, I think this method is badly named. Maybe something like FrameLoaderClient::didLoadFromRegistrableDomain(), very generic and then it is up to the client implementation to decide what to do with it.
Kate Cheney
Comment 17
2020-03-13 11:56:58 PDT
Created
attachment 393513
[details]
Patch for landing
Kate Cheney
Comment 18
2020-03-13 11:57:30 PDT
(In reply to Chris Dumez from
comment #16
)
> Comment on
attachment 393494
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=393494&action=review
> > > Source/WebCore/Modules/websockets/WebSocket.cpp:331 > > + frame->loader().client().addLoadedThirdPartyDomain(WTFMove(domain)); > > You're calling addLoadedThirdPartyDomain() with a domain that is not > necessarily third-party. As a result, I think this method is badly named. > Maybe something like FrameLoaderClient::didLoadFromRegistrableDomain(), very > generic and then it is up to the client implementation to decide what to do > with it.
Made these changes, thanks Chris!
WebKit Commit Bot
Comment 19
2020-03-13 12:43:48 PDT
Comment on
attachment 393513
[details]
Patch for landing Clearing flags on attachment: 393513 Committed
r258421
: <
https://trac.webkit.org/changeset/258421
>
WebKit Commit Bot
Comment 20
2020-03-13 12:43:50 PDT
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 21
2020-03-13 12:44:17 PDT
<
rdar://problem/60429255
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug