You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
websockets/cookies/007.html doesn't match spec #5213
Before whatwg/html#840, there was a step in the task that dispatched the open event that set the cookies received in the HTTP response. websockets/cookies/007.html is explicitly testing that no cookies are stored before the open event is dispatched, but that is no longer true since websockets were integrated with Fetch.
Firefox and Safari TP pass this test, Chrome fails it.
So currently for all fetches cookies are just set when the response is received. We could change that somehow maybe to synchronize them with the main thread as part of the task queued for the response (headers) coming in. We'd then make Fetch queue a task for establishing a connection as well (which matches the task of the response coming in) and HTML would use that to dispatch the open event.
If the entry's name is "set-cookie" or "set-cookie2" or another cookie-related
field name
If the relevant specification is supported by the user agent, handle the
cookie as defined by the appropriate specification, with the resource being
the one with the host host, the port port, the path (and possibly query
parameters) resource name, and the scheme http if secure is false and https if
secure is true. [COOKIES]
If the relevant specification is not supported by the user agent, then the
field must be ignored.
]]
At this point, the handshake can still fail. It seems bad to set cookies
if the handshake fails. We want to process set-cookie when the handshake
has succeeded (but before changing readyState and firing 'open').
Interesting point. I guess that only applies to cookies and would require abstracting cookies somehow in Fetch. That still doesn't address the overall point of synchronizing state across threads, but gets somewhat closer.
In Chrome the update of document.cookie and the firing of the open event are not synchronised in any way, so there's no way for us to make the test pass without major restructuring.
The wss version of the test fails due to Schemeful Same-Site cookies.
I think the point is not necessarily that they are updated in perfect lockstep, but that
if the handshake can still fail, set-cookie should not be processed yet
if the handshake succeeds, set-cookie should be processed before the open event is fired (so that the event handler for open can reliably check the cookies).
I'm happy to review a PR to fix the Schemeful Same-Site cookies aspect.
if the handshake can still fail, set-cookie should not be processed yet
This part is easy in Chrome; cookie setting happens way after handshake validation.
if the handshake succeeds, set-cookie should be processed before the open event is fired (so that the event handler for open can reliably check the cookies).
This is tricky with Chrome's architecture as we asynchronously ask any extensions if they'd like to change the response headers before we apply cookies. This happens after the WebSocket handshake is validated.
Activity
annevk commentedon Mar 24, 2017
Firefox and Safari TP pass this test, Chrome fails it.
So currently for all fetches cookies are just set when the response is received. We could change that somehow maybe to synchronize them with the main thread as part of the task queued for the response (headers) coming in. We'd then make Fetch queue a task for establishing a connection as well (which matches the task of the response coming in) and HTML would use that to dispatch the open event.
I guess I wonder what happens for normal fetches.
@zcorpan
zcorpan commentedon Mar 24, 2017
whatwg/html@43156d2
https://lists.w3.org/Archives/Public/public-whatwg-archive/2010Jul/0309.html
annevk commentedon Mar 24, 2017
Interesting point. I guess that only applies to cookies and would require abstracting cookies somehow in Fetch. That still doesn't address the overall point of synchronizing state across threads, but gets somewhat closer.
nox commentedon Mar 24, 2017
Note that Firefox and Safari both fail on the wss variant of the test.
annevk commentedon Mar 24, 2017
I think wss is not supported by WPT.
ricea commentedon Nov 7, 2022
In Chrome the update of
document.cookieand the firing of theopenevent are not synchronised in any way, so there's no way for us to make the test pass without major restructuring.The wss version of the test fails due to Schemeful Same-Site cookies.
zcorpan commentedon Nov 8, 2022
I think the point is not necessarily that they are updated in perfect lockstep, but that
set-cookieshould not be processed yetset-cookieshould be processed before theopenevent is fired (so that the event handler foropencan reliably check the cookies).I'm happy to review a PR to fix the Schemeful Same-Site cookies aspect.
ricea commentedon Nov 10, 2022
This part is easy in Chrome; cookie setting happens way after handshake validation.
This is tricky with Chrome's architecture as we asynchronously ask any extensions if they'd like to change the response headers before we apply cookies. This happens after the WebSocket handshake is validated.