From da1d2ce40803e62a2c5d5d5665cde87ead828d05 Mon Sep 17 00:00:00 2001 From: zcorpan Date: Fri, 12 May 2023 11:12:34 +0200 Subject: [PATCH 1/3] Test base URL with multiple globals for WebSocket See https://github.com/whatwg/websockets/pull/45 --- .../context-for-websocket.html | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 html/browsers/browsing-the-web/navigating-across-documents/multiple-globals/context-for-websocket.html diff --git a/html/browsers/browsing-the-web/navigating-across-documents/multiple-globals/context-for-websocket.html b/html/browsers/browsing-the-web/navigating-across-documents/multiple-globals/context-for-websocket.html new file mode 100644 index 00000000000000..029371357c72aa --- /dev/null +++ b/html/browsers/browsing-the-web/navigating-across-documents/multiple-globals/context-for-websocket.html @@ -0,0 +1,32 @@ + + + + + + From 0ede1bb0c53391bf34005f3b5589257add88df5d Mon Sep 17 00:00:00 2001 From: zcorpan Date: Mon, 15 May 2023 22:35:28 +0200 Subject: [PATCH 2/3] Fix test per feedback, expect 'current' (needs spec decision) --- .../context-for-websocket.html | 32 ------------------- .../url-parsing/current/current.html | 2 ++ .../url-parsing/incumbent/incumbent.html | 13 ++++++++ .../url-parsing/url-parsing.html | 19 +++++++++++ 4 files changed, 34 insertions(+), 32 deletions(-) delete mode 100644 html/browsers/browsing-the-web/navigating-across-documents/multiple-globals/context-for-websocket.html create mode 100644 websockets/multi-globals/url-parsing/current/current.html create mode 100644 websockets/multi-globals/url-parsing/incumbent/incumbent.html create mode 100644 websockets/multi-globals/url-parsing/url-parsing.html diff --git a/html/browsers/browsing-the-web/navigating-across-documents/multiple-globals/context-for-websocket.html b/html/browsers/browsing-the-web/navigating-across-documents/multiple-globals/context-for-websocket.html deleted file mode 100644 index 029371357c72aa..00000000000000 --- a/html/browsers/browsing-the-web/navigating-across-documents/multiple-globals/context-for-websocket.html +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - diff --git a/websockets/multi-globals/url-parsing/current/current.html b/websockets/multi-globals/url-parsing/current/current.html new file mode 100644 index 00000000000000..82a48d409901b4 --- /dev/null +++ b/websockets/multi-globals/url-parsing/current/current.html @@ -0,0 +1,2 @@ + +Current page used as a test helper diff --git a/websockets/multi-globals/url-parsing/incumbent/incumbent.html b/websockets/multi-globals/url-parsing/incumbent/incumbent.html new file mode 100644 index 00000000000000..2c5572b7749336 --- /dev/null +++ b/websockets/multi-globals/url-parsing/incumbent/incumbent.html @@ -0,0 +1,13 @@ + +Incumbent page used as a test helper + + + + diff --git a/websockets/multi-globals/url-parsing/url-parsing.html b/websockets/multi-globals/url-parsing/url-parsing.html new file mode 100644 index 00000000000000..eb58aa2d746922 --- /dev/null +++ b/websockets/multi-globals/url-parsing/url-parsing.html @@ -0,0 +1,19 @@ + +Multiple globals for base URL in WebSocket constructor + + + + + + + + From 549c88268c239427c3248e9cdf0ab54631825ffd Mon Sep 17 00:00:00 2001 From: zcorpan Date: Tue, 16 May 2023 09:26:48 +0200 Subject: [PATCH 3/3] Clarify relevant vs current in a comment --- websockets/multi-globals/url-parsing/url-parsing.html | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/websockets/multi-globals/url-parsing/url-parsing.html b/websockets/multi-globals/url-parsing/url-parsing.html index eb58aa2d746922..21ef6cd3a95487 100644 --- a/websockets/multi-globals/url-parsing/url-parsing.html +++ b/websockets/multi-globals/url-parsing/url-parsing.html @@ -11,7 +11,10 @@ async_test((t) => { onload = t.step_func_done(() => { frames[0].hello(); - const expectedUrl = new URL('current/foo', location.href); // TODO WebSocket spec says relevant + // Inside constructors, "this's relevant settings object" === "current settings object", + // because of how "this" is constructed. + // https://github.com/whatwg/websockets/issues/46 + const expectedUrl = new URL('current/foo', location.href); expectedUrl.protocol = 'ws:'; assert_equals(frames[0].ws.url, expectedUrl.href); });