Bug 190408

Summary: Anchor target should be ignored on activation when the download attribute is set
Product: WebKit Reporter: Chris Dumez <cdumez>
Component: DOMAssignee: Chris Dumez <cdumez>
Status: RESOLVED FIXED    
Severity: Normal CC: achristensen, cdumez, commit-queue, dbates, esprehn+autocc, ews-watchlist, ggaren, gyuyoung.kim, japhet, rniwa, webkit-bug-importer, youennf
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=190351
Attachments:
Description Flags
Patch
none
Patch
none
Patch none

Description Chris Dumez 2018-10-09 12:27:14 PDT
Anchor target should be ignored on activation when the download attribute is set:
- https://html.spec.whatwg.org/#the-a-element:downloading-hyperlinks-2

When the download attribute is set, we should use the "download the hyperlink" algorithm [1] instead of the "follow the hyperlink" [2] algorithm.
Note that the "download the hyperlink" triggers a download and ignores the target attribute entirely.

This is important as an anchor element with target=_blank and the download attribute set may fail because of Safari's popup blocker if we do not disregard the anchor target.

[1] https://html.spec.whatwg.org/#downloading-hyperlinks
[2] https://html.spec.whatwg.org/#following-hyperlinks-2
Comment 1 Chris Dumez 2018-10-09 12:35:02 PDT
Created attachment 351902 [details]
Patch
Comment 2 Chris Dumez 2018-10-09 13:07:56 PDT
Created attachment 351903 [details]
Patch
Comment 3 Chris Dumez 2018-10-09 14:14:52 PDT
Created attachment 351916 [details]
Patch
Comment 4 Geoffrey Garen 2018-10-09 15:54:06 PDT
Comment on attachment 351916 [details]
Patch

r=me
Comment 5 WebKit Commit Bot 2018-10-09 16:21:25 PDT
Comment on attachment 351916 [details]
Patch

Clearing flags on attachment: 351916

Committed r236987: <https://trac.webkit.org/changeset/236987>
Comment 6 WebKit Commit Bot 2018-10-09 16:21:27 PDT
All reviewed patches have been landed.  Closing bug.
Comment 7 Radar WebKit Bug Importer 2018-10-09 16:22:29 PDT
<rdar://problem/45145107>