Skip to content

Conversation

@annevk
Copy link
Member

@annevk annevk commented Mar 5, 2025

@annevk annevk force-pushed the annevk/opaque-path-trailing-spaces branch from 26a58e8 to ffd1def Compare March 12, 2025 17:49
@annevk annevk requested a review from karwa March 12, 2025 18:25
Copy link
Member

@rmisev rmisev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but two comments need to be corrected.

@annevk annevk force-pushed the annevk/opaque-path-trailing-spaces branch from eb2157a to 2bcbcdf Compare March 14, 2025 00:02
@annevk annevk merged commit 048018b into master Mar 14, 2025
19 checks passed
@annevk annevk deleted the annevk/opaque-path-trailing-spaces branch March 14, 2025 00:45
annevk added a commit to whatwg/url that referenced this pull request Mar 14, 2025
In fdaa0e5 we tackled a problem whereby removing the fragment or query from a URL with an opaque path through the API would not make the URL roundtrip due to the opaque path being able to end in non-percent-encoded spaces.

However, this failed to address other ways of serializing the URL. As such this is a new approach whereby opaque paths simply cannot end with non-percent-encoded spaces. Enforcing this in the URL parser allows us to completely revert the aforementioned commit, greatly simplifying the API implementation.

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

Fixes #784. Supersedes and closes #785.
webkit-commit-queue pushed a commit to annevk/WebKit that referenced this pull request Mar 14, 2025
https://bugs.webkit.org/show_bug.cgi?id=289160
rdar://146848690

Reviewed by Alex Christensen.

Instead of attempting to account for opaque paths sometimes ending in
spaces in the API implementation and failing because that did not
account for serialization, this new approach always percent-encodes the
final space of the path. This is thought to be the least invasive
change that is hopefully web-compatible. This is standardized here:
whatwg/url#844

Test changes are upstreamed here:
web-platform-tests/wpt#51129

* LayoutTests/fast/events/popup-blocked-from-unique-frame-via-window-open-named-sibling-frame-expected.txt:
* LayoutTests/http/tests/security/no-popup-from-sandbox-top-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/url/a-element-origin-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/url/a-element-origin-xhtml-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/url/a-element-xhtml_exclude=(file_javascript_mailto)-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/url/a-element_exclude=(file_javascript_mailto)-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/url/resources/setters_tests.json:
* LayoutTests/imported/w3c/web-platform-tests/url/resources/urltestdata.json:
* LayoutTests/imported/w3c/web-platform-tests/url/url-constructor.any.worker_exclude=(file_javascript_mailto)-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/url/url-constructor.any_exclude=(file_javascript_mailto)-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/url/url-origin.any-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/url/url-origin.any.worker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/url/url-setters-a-area.window-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/url/url-setters.any.worker_exclude=(file_javascript_mailto)-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/url/url-setters.any_exclude=(file_javascript_mailto)-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/url/urlsearchparams-delete.any-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/url/urlsearchparams-delete.any.js:
(test):
* LayoutTests/imported/w3c/web-platform-tests/url/urlsearchparams-delete.any.worker-expected.txt:
* Source/WTF/wtf/URL.cpp:
(WTF::URL::removeFragmentIdentifier):
(WTF::URL::removeQueryAndFragmentIdentifier):
(WTF::URL::setQuery):
(WTF::URL::maybeTrimTrailingSpacesFromOpaquePath): Deleted.
* Source/WTF/wtf/URL.h:
* Source/WTF/wtf/URLParser.cpp:
(WTF::URLParser::parse):

Canonical link: https://commits.webkit.org/292146@main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants