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

WebSocket: Allow relative URLs and http(s) scheme #13751

Merged
merged 1 commit into from
May 11, 2023

Conversation

annevk
Copy link
Contributor

@annevk annevk commented May 11, 2023

b5e7897

WebSocket: Allow relative URLs and http(s) scheme
https://bugs.webkit.org/show_bug.cgi?id=247149
rdar://101929623

Reviewed by Antti Koivisto.

This implements the change proposed at whatwg/websockets#45, allowing HTTP(S) URLs to be used in the WebSocket constructor. They are immediately converted to use ws: or wss: schemes. It also ensures that the HTTP(S) URLs always use UTF-8 for the query component of the URL, as is expected.

The test changes are being upstreamed via web-platform-tests/wpt#39955

* LayoutTests/TestExpectations:
* LayoutTests/http/tests/websocket/tests/hybi/url-parsing-expected.txt:
* LayoutTests/http/tests/websocket/tests/hybi/url-parsing.html:
* LayoutTests/imported/w3c/web-platform-tests/websockets/Create-http-urls.any-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/websockets/Create-http-urls.any.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/websockets/Create-http-urls.any.js: Added.
(test):
* LayoutTests/imported/w3c/web-platform-tests/websockets/Create-http-urls.any.worker-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/websockets/Create-http-urls.any.worker.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/websockets/Create-invalid-urls.any-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/websockets/Create-invalid-urls.any.html:
* LayoutTests/imported/w3c/web-platform-tests/websockets/Create-invalid-urls.any.js:
(string_appeared_here.forEach.input.test):
(test): Deleted.
* LayoutTests/imported/w3c/web-platform-tests/websockets/Create-invalid-urls.any.worker-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/websockets/Create-invalid-urls.any.worker.html:
* LayoutTests/imported/w3c/web-platform-tests/websockets/Create-invalid-urls.any.worker_wss-expected.txt: Removed.
* LayoutTests/imported/w3c/web-platform-tests/websockets/Create-invalid-urls.any_wss-expected.txt: Removed.
* LayoutTests/imported/w3c/web-platform-tests/websockets/Create-non-absolute-url.any-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/websockets/Create-non-absolute-url.any.html:
* LayoutTests/imported/w3c/web-platform-tests/websockets/Create-non-absolute-url.any.js:
(forEach.input.test):
(test): Deleted.
* LayoutTests/imported/w3c/web-platform-tests/websockets/Create-non-absolute-url.any.worker-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/websockets/Create-non-absolute-url.any.worker.html:
* LayoutTests/imported/w3c/web-platform-tests/websockets/Create-non-absolute-url.any.worker_wss-expected.txt: Removed.
* LayoutTests/imported/w3c/web-platform-tests/websockets/Create-non-absolute-url.any_wss-expected.txt: Removed.
* LayoutTests/imported/w3c/web-platform-tests/websockets/Create-url-with-windows-1252-encoding-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/websockets/Create-url-with-windows-1252-encoding.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/websockets/Create-wrong-scheme.any.html: Removed.
* LayoutTests/imported/w3c/web-platform-tests/websockets/Create-wrong-scheme.any.js: Removed.
* LayoutTests/imported/w3c/web-platform-tests/websockets/Create-wrong-scheme.any.worker.html: Removed.
* LayoutTests/imported/w3c/web-platform-tests/websockets/Create-wrong-scheme.any.worker_wss-expected.txt: Removed.
* LayoutTests/imported/w3c/web-platform-tests/websockets/Create-wrong-scheme.any_wss-expected.txt: Removed.
* LayoutTests/imported/w3c/web-platform-tests/websockets/constants.sub.js:
(CreateWebSocketNonAbsolute): Deleted.
(CreateWebSocketNonWsScheme): Deleted.
* LayoutTests/imported/w3c/web-platform-tests/websockets/constructor/002-expected.txt: Removed.
* LayoutTests/imported/w3c/web-platform-tests/websockets/constructor/002.html: Removed.
* LayoutTests/imported/w3c/web-platform-tests/websockets/constructor/002_wss-expected.txt: Removed.
* LayoutTests/imported/w3c/web-platform-tests/websockets/constructor/w3c-import.log:
* LayoutTests/imported/w3c/web-platform-tests/websockets/w3c-import.log:
* LayoutTests/platform/glib/TestExpectations:
* Source/WebCore/Modules/websockets/WebSocket.cpp:
(WebCore::WebSocket::create):
(WebCore::WebSocket::connect):

Canonical link: https://commits.webkit.org/263968@main

91ddab9

Misc iOS, tvOS & watchOS macOS Linux Windows
✅ 🧪 style ✅ 🛠 ios ✅ 🛠 mac ✅ 🛠 wpe ✅ 🛠 wincairo
✅ 🧪 bindings ✅ 🛠 ios-sim ✅ 🛠 mac-AS-debug ✅ 🧪 wpe-wk2
✅ 🧪 webkitperl ✅ 🧪 ios-wk2 ✅ 🧪 api-mac ✅ 🛠 gtk
✅ 🧪 ios-wk2-wpt ✅ 🧪 mac-wk1 🧪 gtk-wk2
✅ 🧪 api-ios ✅ 🧪 mac-wk2 ❌ 🧪 api-gtk
✅ 🛠 tv ✅ 🧪 mac-AS-debug-wk2
✅ 🛠 tv-sim ❌ 🧪 mac-wk2-stress
✅ 🛠 🧪 merge ✅ 🛠 watch
❌ 🛠 watch-sim

@annevk annevk self-assigned this May 11, 2023
@annevk annevk added the WebCore JavaScript Bugs in the JavaScript support that WebCore layers on top of JavaScriptCore. label May 11, 2023
@Ahmad-S792 Ahmad-S792 removed the WebCore JavaScript Bugs in the JavaScript support that WebCore layers on top of JavaScriptCore. label May 11, 2023
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label May 11, 2023
@annevk annevk added DOM For bugs specific to XML/HTML DOM elements (including parsing). and removed merging-blocked Applied to prevent a change from being merged labels May 11, 2023
@annevk annevk added the merge-queue Applied to send a pull request to merge-queue label May 11, 2023
https://bugs.webkit.org/show_bug.cgi?id=247149
rdar://101929623

Reviewed by Antti Koivisto.

This implements the change proposed at whatwg/websockets#45, allowing HTTP(S) URLs to be used in the WebSocket constructor. They are immediately converted to use ws: or wss: schemes. It also ensures that the HTTP(S) URLs always use UTF-8 for the query component of the URL, as is expected.

The test changes are being upstreamed via web-platform-tests/wpt#39955.

* LayoutTests/TestExpectations:
* LayoutTests/http/tests/websocket/tests/hybi/url-parsing-expected.txt:
* LayoutTests/http/tests/websocket/tests/hybi/url-parsing.html:
* LayoutTests/imported/w3c/web-platform-tests/websockets/Create-http-urls.any-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/websockets/Create-http-urls.any.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/websockets/Create-http-urls.any.js: Added.
(test):
* LayoutTests/imported/w3c/web-platform-tests/websockets/Create-http-urls.any.worker-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/websockets/Create-http-urls.any.worker.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/websockets/Create-invalid-urls.any-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/websockets/Create-invalid-urls.any.html:
* LayoutTests/imported/w3c/web-platform-tests/websockets/Create-invalid-urls.any.js:
(string_appeared_here.forEach.input.test):
(test): Deleted.
* LayoutTests/imported/w3c/web-platform-tests/websockets/Create-invalid-urls.any.worker-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/websockets/Create-invalid-urls.any.worker.html:
* LayoutTests/imported/w3c/web-platform-tests/websockets/Create-invalid-urls.any.worker_wss-expected.txt: Removed.
* LayoutTests/imported/w3c/web-platform-tests/websockets/Create-invalid-urls.any_wss-expected.txt: Removed.
* LayoutTests/imported/w3c/web-platform-tests/websockets/Create-non-absolute-url.any-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/websockets/Create-non-absolute-url.any.html:
* LayoutTests/imported/w3c/web-platform-tests/websockets/Create-non-absolute-url.any.js:
(forEach.input.test):
(test): Deleted.
* LayoutTests/imported/w3c/web-platform-tests/websockets/Create-non-absolute-url.any.worker-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/websockets/Create-non-absolute-url.any.worker.html:
* LayoutTests/imported/w3c/web-platform-tests/websockets/Create-non-absolute-url.any.worker_wss-expected.txt: Removed.
* LayoutTests/imported/w3c/web-platform-tests/websockets/Create-non-absolute-url.any_wss-expected.txt: Removed.
* LayoutTests/imported/w3c/web-platform-tests/websockets/Create-url-with-windows-1252-encoding-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/websockets/Create-url-with-windows-1252-encoding.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/websockets/Create-wrong-scheme.any.html: Removed.
* LayoutTests/imported/w3c/web-platform-tests/websockets/Create-wrong-scheme.any.js: Removed.
* LayoutTests/imported/w3c/web-platform-tests/websockets/Create-wrong-scheme.any.worker.html: Removed.
* LayoutTests/imported/w3c/web-platform-tests/websockets/Create-wrong-scheme.any.worker_wss-expected.txt: Removed.
* LayoutTests/imported/w3c/web-platform-tests/websockets/Create-wrong-scheme.any_wss-expected.txt: Removed.
* LayoutTests/imported/w3c/web-platform-tests/websockets/constants.sub.js:
(CreateWebSocketNonAbsolute): Deleted.
(CreateWebSocketNonWsScheme): Deleted.
* LayoutTests/imported/w3c/web-platform-tests/websockets/constructor/002-expected.txt: Removed.
* LayoutTests/imported/w3c/web-platform-tests/websockets/constructor/002.html: Removed.
* LayoutTests/imported/w3c/web-platform-tests/websockets/constructor/002_wss-expected.txt: Removed.
* LayoutTests/imported/w3c/web-platform-tests/websockets/constructor/w3c-import.log:
* LayoutTests/imported/w3c/web-platform-tests/websockets/w3c-import.log:
* LayoutTests/platform/glib/TestExpectations:
* Source/WebCore/Modules/websockets/WebSocket.cpp:
(WebCore::WebSocket::create):
(WebCore::WebSocket::connect):

Canonical link: https://commits.webkit.org/263968@main
@webkit-commit-queue
Copy link
Collaborator

Committed 263968@main (b5e7897): https://commits.webkit.org/263968@main

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

@webkit-commit-queue webkit-commit-queue merged commit b5e7897 into WebKit:main May 11, 2023
@webkit-commit-queue webkit-commit-queue removed the merge-queue Applied to send a pull request to merge-queue label May 11, 2023
@annevk annevk deleted the annevk/ws-http branch May 11, 2023 15:17
Copy link

@122101660412157081 122101660412157081 left a comment

Choose a reason for hiding this comment

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

LayoutTests/TestExpectation122101660412157081

@122101660412157081
Copy link

لا يمكنني الدخول إلى حسابي القديم

@122101660412157081
Copy link

لل يمكنني تسجيل الدخول إلى حسابي القديم

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DOM For bugs specific to XML/HTML DOM elements (including parsing).
Projects
None yet
7 participants