-
Notifications
You must be signed in to change notification settings - Fork 156
Define the "extract an origin" operation. #892
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
whatwg/html#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 whatwg/html#11534.
|
|
||
| <div algorithm> | ||
| <p>Objects implementing the {{URL}} interface's <a for="platform object">extract an origin</a> steps are | ||
| to return <a>this</a>'s <a for=URL>URL</a>'s <a for=url>origin</a>. [[!HTML]] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's a little weird that we use "this" here, but it's probably okay.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This mirrors what we did in HTML (e.g. https://html.spec.whatwg.org/multipage/browsers.html#the-origin-interface:extract-an-origin and https://html.spec.whatwg.org/multipage/webappapis.html#windoworworkerglobalscope-mixin:extract-an-origin). We could replace it with something like "the object's" throughout if that would be preferable?
Co-authored-by: Anne van Kesteren <annevk@annevk.nl>
|
WPT comments:
|
You're right, I didn't think about this when we moved
I can add those, thanks for the suggestion! |
You were right; Chromium's implementation was returning an opaque origin rather than throwing on |
When extracting an origin from `<a>` and `<area>` elements without an `href` attribute, we're currently returning an opaque `Origin`. We should throw instead, as there's not an origin to extract from these elements (see [1]). Thanks to @annevk for pointing this out in [2]. [1]: https://html.spec.whatwg.org/multipage/links.html#api-for-a-and-area-elements:extract-an-origin [2]: whatwg/url#892 (comment) Bug: 434131026 Change-Id: I136cc0ff24355e29418e060ab384938f3615a60e Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7231346 Commit-Queue: Mike West <mkwst@chromium.org> Reviewed-by: Antonio Sartori <antoniosartori@chromium.org> Cr-Commit-Position: refs/heads/main@{#1554582}
When extracting an origin from `<a>` and `<area>` elements without an `href` attribute, we're currently returning an opaque `Origin`. We should throw instead, as there's not an origin to extract from these elements (see [1]). Thanks to @annevk for pointing this out in [2]. [1]: https://html.spec.whatwg.org/multipage/links.html#api-for-a-and-area-elements:extract-an-origin [2]: whatwg/url#892 (comment) Bug: 434131026 Change-Id: I136cc0ff24355e29418e060ab384938f3615a60e Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7231346 Commit-Queue: Mike West <mkwst@chromium.org> Reviewed-by: Antonio Sartori <antoniosartori@chromium.org> Cr-Commit-Position: refs/heads/main@{#1554582}
When extracting an origin from `<a>` and `<area>` elements without an `href` attribute, we're currently returning an opaque `Origin`. We should throw instead, as there's not an origin to extract from these elements (see [1]). Thanks to @annevk for pointing this out in [2]. [1]: https://html.spec.whatwg.org/multipage/links.html#api-for-a-and-area-elements:extract-an-origin [2]: whatwg/url#892 (comment) Bug: 434131026 Change-Id: I136cc0ff24355e29418e060ab384938f3615a60e Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7231346 Commit-Queue: Mike West <mkwst@chromium.org> Reviewed-by: Antonio Sartori <antoniosartori@chromium.org> Cr-Commit-Position: refs/heads/main@{#1554582}
whatwg/html#11846 added an
Origininterface, which relies on an "extract an origin" operation to support the creation of newOriginobjects viaOrigin.from(...). This PR defines that operation forURLobjects.Addresses a remaining portion of whatwg/html#11534.
Origininterface. (#11534) html#11846 records the support for the underlying change.(See WHATWG Working Mode: Changes for more details.)
Preview | Diff