Ad Click Attribution redirects to well-known location should not trigger a conversion...
authorwilander@apple.com <wilander@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 23 Apr 2019 16:14:05 +0000 (16:14 +0000)
committerwilander@apple.com <wilander@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 23 Apr 2019 16:14:05 +0000 (16:14 +0000)
commit600ea1374bb76a6a2906fb6de5c70b92d304b281
treeb93e9049b5685b9761689f30d0faac8bfc080d44
parent91f164917fb6b6972eb5e76463744fafb18b2ee0
Ad Click Attribution redirects to well-known location should not trigger a conversion if they are blocked by content blockers
https://bugs.webkit.org/show_bug.cgi?id=197183
<rdar://problem/47763188>

Reviewed by Alex Christensen.

Source/WebKit:

Ad Click Attribution conversions are picked up in the redirect handler
in WebKit::NetworkResourceLoader. Content blocking typically happens in
the continued redirect request handling in the web content process and
a blocked request comes back empty.

We need to call the WebKit::NetworkLoadChecker in the network process
for these specific redirects, just like we do for Ping.

The change makes use of the existing function
NetworkLoadChecker::enableContentExtensionsCheck() for this purpose.

In essence, this change makes it possible to block all conversions made
to a "/.well-known/ad-click-attribution/" URL.

* NetworkProcess/NetworkResourceLoader.cpp:
(WebKit::NetworkResourceLoader::handleAdClickAttributionConversion):
    New convenience function.
(WebKit::NetworkResourceLoader::willSendRedirectedRequest):
    Now calls NetworkLoadChecker::enableContentExtensionsCheck() if
    an Ad Click Attribution conversion was found in the redirect URL.
(WebKit::NetworkResourceLoader::continueWillSendRedirectedRequest):
    If the request was not blocked, it will store any found conversion here.
* NetworkProcess/NetworkResourceLoader.h:

LayoutTests:

* http/tests/contentextensions/block-ad-click-attribution-expected.txt: Added.
* http/tests/contentextensions/block-ad-click-attribution.html: Added.
* http/tests/contentextensions/block-ad-click-attribution.html.json: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@244544 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/http/tests/contentextensions/block-ad-click-attribution-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/contentextensions/block-ad-click-attribution.html [new file with mode: 0644]
LayoutTests/http/tests/contentextensions/block-ad-click-attribution.html.json [new file with mode: 0644]
Source/WebKit/ChangeLog
Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp
Source/WebKit/NetworkProcess/NetworkResourceLoader.h