Parse and handle Ad Click Attribution attributes in HTMLAnchorElement::handleClick()
authorwilander@apple.com <wilander@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 4 Feb 2019 00:44:07 +0000 (00:44 +0000)
committerwilander@apple.com <wilander@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 4 Feb 2019 00:44:07 +0000 (00:44 +0000)
commita84f85e72a83d39ad2d6428098244ce0618b20a2
tree791a8bb2baa9cf662e25617c6745f2bd66e5dc13
parent7ba1f3b11cd28cc64924b16a9f3288032cd163d9
Parse and handle Ad Click Attribution attributes in HTMLAnchorElement::handleClick()
https://bugs.webkit.org/show_bug.cgi?id=194104
<rdar://problem/47649991>

Reviewed by Chris Dumez, Daniel Bates, and Darin Adler.

Source/WebCore:

Test: http/tests/adClickAttribution/anchor-tag-attributes-validation.html

This patch adds parsing and validation of the two new Ad Click Attribution
attributes in anchor elements: adcampaignid and addestination. The data is
not yet forwarded into the loader.

* html/HTMLAnchorElement.cpp:
(WebCore::HTMLAnchorElement::parseAdClickAttribution const):
(WebCore::HTMLAnchorElement::handleClick):
    Now calls HTMLAnchorElement::parseAdClickAttribution().
* html/HTMLAnchorElement.h:
* loader/AdClickAttribution.h:
    Made WebCore::AdClickAttribution copyable since it's needed to have it be
    WTF::Optional. Also made AdClickAttribution::MaxEntropy public. Changed
    numeric types from unsigned short to uint32_t.
(WebCore::AdClickAttribution::Campaign::isValid const):
(WebCore::AdClickAttribution::Conversion::isValid const):

Tools:

* TestWebKitAPI/Tests/WebCore/AdClickAttribution.cpp:
(TestWebKitAPI::TEST):
    Changed numeric types from unsigned short to uint32_t.

LayoutTests:

This test case makes sure invalid data triggers console warnings.

* http/tests/adClickAttribution/anchor-tag-attributes-validation-expected.txt: Added.
* http/tests/adClickAttribution/anchor-tag-attributes-validation.html: Added.
* platform/ios-wk2/http/tests/adClickAttribution/anchor-tag-attributes-validation-expected.txt: Added.
    Console line numbers are not emitted when running iOS tests so this -expected.txt file doesn't have them.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240911 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/http/tests/adClickAttribution/anchor-tag-attributes-validation-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/adClickAttribution/anchor-tag-attributes-validation.html [new file with mode: 0644]
LayoutTests/platform/ios-wk2/http/tests/adClickAttribution/anchor-tag-attributes-validation-expected.txt [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/html/HTMLAnchorElement.cpp
Source/WebCore/html/HTMLAnchorElement.h
Source/WebCore/loader/AdClickAttribution.h
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WebCore/AdClickAttribution.cpp