Skip to content
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

Add URL.parse() #825

Merged
merged 2 commits into from
Mar 25, 2024
Merged

Add URL.parse() #825

merged 2 commits into from
Mar 25, 2024

Conversation

annevk
Copy link
Member

@annevk annevk commented Mar 21, 2024

Tests: web-platform-tests/wpt#45248.

Fixes #372.

(See WHATWG Working Mode: Changes for more details.)


Preview | Diff

@annevk annevk requested review from valenting and rmisev March 21, 2024 12:22
jasnell added a commit to cloudflare/workerd that referenced this pull request Mar 23, 2024
annevk added a commit to web-platform-tests/wpt that referenced this pull request Mar 25, 2024
@annevk annevk merged commit 58acb06 into main Mar 25, 2024
2 checks passed
@annevk annevk deleted the annevk/URL.parse branch March 25, 2024 10:08
webkit-commit-queue pushed a commit to annevk/WebKit that referenced this pull request Mar 25, 2024
https://bugs.webkit.org/show_bug.cgi?id=271636

Reviewed by Alex Christensen.

This was standardized in whatwg/url#825 and test
coverage was added here:
web-platform-tests/wpt#45248

As a drive-by fix we remove m_baseURL from DOMURL as it does not need it.

* LayoutTests/imported/w3c/web-platform-tests/url/url-statics-parse.any-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/url/url-statics-parse.any.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/url/url-statics-parse.any.js: Added.
(forEach):
(test):
* LayoutTests/imported/w3c/web-platform-tests/url/url-statics-parse.any.worker-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/url/url-statics-parse.any.worker.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/url/w3c-import.log:
* Source/WebCore/html/DOMURL.cpp:
(WebCore::DOMURL::DOMURL):
(WebCore::DOMURL::create):
(WebCore::parseInternal):
(WebCore::DOMURL::parse):
(WebCore::DOMURL::canParse):
* Source/WebCore/html/DOMURL.h:
* Source/WebCore/html/DOMURL.idl:

Canonical link: https://commits.webkit.org/276656@main
thisalihassan added a commit to thisalihassan/node that referenced this pull request Mar 30, 2024
Implement the static parse method as per the WHATWG URL specification.
Unlike the URL constructor, URL.parse does not throw on invalid input,
instead returning null. This behavior allows safer parsing of URLs
without the need for try-catch blocks around constructor calls. The
implementation follows the steps outlined in the WHATWG URL standard,
ensuring compatibility and consistency with web platform URL parsing
APIs.

Fixes: nodejs#52208
Refs: whatwg/url#825
jackyzy823 pushed a commit to jackyzy823/gecko-dev that referenced this pull request Apr 1, 2024
Automatic update from web-platform-tests
URL: tests for URL.parse()

For whatwg/url#825.
--

wpt-commits: 0f550ab9f5a07ed293926a306e914866164b346b
wpt-pr: 45248
ErichDonGubler pushed a commit to erichdongubler-mozilla/firefox that referenced this pull request Apr 1, 2024
Automatic update from web-platform-tests
URL: tests for URL.parse()

For whatwg/url#825.
--

wpt-commits: 0f550ab9f5a07ed293926a306e914866164b346b
wpt-pr: 45248
jasnell added a commit to cloudflare/workerd that referenced this pull request Apr 4, 2024
nodejs-github-bot pushed a commit to nodejs/node that referenced this pull request Apr 13, 2024
Implement the static parse method as per the WHATWG URL specification.
Unlike the URL constructor, URL.parse does not throw on invalid input,
instead returning null. This behavior allows safer parsing of URLs
without the need for try-catch blocks around constructor calls. The
implementation follows the steps outlined in the WHATWG URL standard,
ensuring compatibility and consistency with web platform URL parsing
APIs.

Fixes: #52208
Refs: whatwg/url#825
PR-URL: #52280
Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Daniel Lemire <daniel@lemire.me>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
@yisibl yisibl mentioned this pull request Apr 17, 2024
aduh95 pushed a commit to nodejs/node that referenced this pull request Apr 29, 2024
Implement the static parse method as per the WHATWG URL specification.
Unlike the URL constructor, URL.parse does not throw on invalid input,
instead returning null. This behavior allows safer parsing of URLs
without the need for try-catch blocks around constructor calls. The
implementation follows the steps outlined in the WHATWG URL standard,
ensuring compatibility and consistency with web platform URL parsing
APIs.

Fixes: #52208
Refs: whatwg/url#825
PR-URL: #52280
Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Daniel Lemire <daniel@lemire.me>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
aarongable pushed a commit to chromium/chromium that referenced this pull request Apr 30, 2024
Adding static method to URL class which returns null when url string is
invalid.

Chrome Status: https://chromestatus.com/feature/6301071388704768

Issues: whatwg/url#825

Intent to Ship: https://groups.google.com/u/3/a/chromium.org/g/blink-dev/c/G070zUd0e4c

Bug: 331041242
Change-Id: I794e1d4624593de8ebfcfb9b227951e8c38e9a58
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5414853
Commit-Queue: Tsuyoshi Horo <horo@chromium.org>
Reviewed-by: Hayato Ito <hayato@chromium.org>
Reviewed-by: Tsuyoshi Horo <horo@chromium.org>
Reviewed-by: Yoav Weiss (@Shopify) <yoavweiss@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1294046}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Consider adding non-throwing URL.parse(input, base)
3 participants