Bug 128020

Summary: <a>/<area>'s origin getter returns "null" rather than "" when URL cannot be parsed
Product: WebKit Reporter: Maciej Stachowiak <mjs>
Component: DOMAssignee: Anne van Kesteren <annevk>
Status: RESOLVED FIXED    
Severity: Normal CC: annevk, ap, karlcow, webkit-bug-importer
Priority: P2 Keywords: BrowserCompat, InRadar
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 128023    

Description Maciej Stachowiak 2014-01-31 14:41:35 PST
The origin attribute returns null instead of empty on on invalid URL. The URL spec says to return empty.
Comment 1 Anne van Kesteren 2023-08-18 03:21:30 PDT
This only applies to the <a> and <area> elements I think (not sure how to construct a URL or Location from a string that cannot be parsed as a URL), but it's still applicable and is probably not difficult to fix:

http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C!DOCTYPE%20html%3E%0A...%3Cscript%3E%0Aa%3Ddocument.createElement(%22a%22)%3B%0Aa.href%3D%22https%3A%2F%2Ftest%3Atest%2F%22%3B%0Aw(a.origin)%3B%0A%3C%2Fscript%3E
Comment 2 Radar WebKit Bug Importer 2023-08-18 04:02:26 PDT
<rdar://problem/114078288>
Comment 3 Anne van Kesteren 2023-08-18 04:14:42 PDT
Pull request: https://github.com/WebKit/WebKit/pull/16830
Comment 4 EWS 2023-08-24 02:11:08 PDT
Committed 267222@main (0e09f4e4a3b4): <https://commits.webkit.org/267222@main>

Reviewed commits have been landed. Closing PR #16830 and removing active labels.