Define the "extract an origin" operation.
https://github.com/whatwg/html/pull/11846 added an Origin interface, which relies on an "extract an origin" operation to support the creation of new Origin objects via Origin.from(...). This PR defines that operation for URL objects.
Addresses a remaining portion of https://github.com/whatwg/html/issues/11534.
- [X] At least two implementers are interested (and none opposed):
- https://github.com/whatwg/html/pull/11846 records the support for the underlying change.
- [X] Tests are written and can be reviewed and commented upon at:
- https://wpt.fyi/results/html/browsers/origin/tentative/api/origin-from-url.any.html?label=experimental&label=master&aligned (will be non-tentative shortly).
- [X] Implementation bugs are filed:
- This work is part of the work necessary for the bugs recorded in the HTML PR above.
- [X] MDN issue is filed: Same as the HTML PR above.
- [X] The top of this comment includes a clear commit message to use.
(See WHATWG Working Mode: Changes for more details.)
WPT comments:
- You can't create new content in WPT
/interfaces/. That directory is managed automatically. It should probably be tested as part of otherhtml.idlAPIs, though perhaps it can be split, but it'll have to loadhtml.idl. - It seems like we don't have tests for
<a>and<area>withouthrefattributes. From a quick skim I suspect this might not be implemented correctly.
You can't create new content in WPT
/interfaces/. That directory is managed automatically. It should probably be tested as part of otherhtml.idlAPIs, though perhaps it can be split, but it'll have to loadhtml.idl.
You're right, I didn't think about this when we moved Origin into HTML. I'll fix it up once the file's updated (https://github.com/w3c/webref/blob/main/ed/idl/html.idl is up to date, but hasn't been pulled in yet...).
It seems like we don't have tests for
<a>and<area>withouthrefattributes. From a quick skim I suspect this might not be implemented correctly.
I can add those, thanks for the suggestion!
It seems like we don't have tests for
<a>and<area>withouthrefattributes. From a quick skim I suspect this might not be implemented correctly.I can add those, thanks for the suggestion!
You were right; Chromium's implementation was returning an opaque origin rather than throwing on Origin.from(<a>). Fixing that and updating the tests in https://chromium-review.googlesource.com/c/chromium/src/+/7231346.