[webkit-reviews] review granted: [Bug 194104] Parse and handle Ad Click Attribution attributes in HTMLAnchorElement::handleClick() : [Attachment 360904] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Feb 1 15:47:53 PST 2019


Chris Dumez <cdumez at apple.com> has granted John Wilander <wilander at apple.com>'s
request for review:
Bug 194104: Parse and handle Ad Click Attribution attributes in
HTMLAnchorElement::handleClick()
https://bugs.webkit.org/show_bug.cgi?id=194104

Attachment 360904: Patch

https://bugs.webkit.org/attachment.cgi?id=360904&action=review




--- Comment #34 from Chris Dumez <cdumez at apple.com> ---
Comment on attachment 360904
  --> https://bugs.webkit.org/attachment.cgi?id=360904
Patch

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

r=me with suggestions.

> Source/WebCore/loader/AdClickAttribution.cpp:97
> +    if (toConvert.length() != 2)

Basically, here I'd do something like:
auto parsed = parseHTMLNonNegativeInteger(toConvert);
if (!parsed)
    return Exception { ConstraintError, makeString('\"', toConvert, "\" can not
be converted to an unsigned integer which is required for Ad Click
Attribution.") };

if (parsed.value() >= maxEntropy)
	return Exception { ConstraintError, makeString('\"', toConvert, "\" is
greater than or equal to ", String::number(maxEntropy), " and is not allowed
for Ad Click Attribution.") };

return parsed.value();


Code would be shorter and we'd parse the number following the rules defined in
the HTML spec.


More information about the webkit-reviews mailing list