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

[browser][websockets][tests] Test failures for invalid WebSocketCloseStatus codes #45538

Closed
kjpou1 opened this issue Dec 3, 2020 · 2 comments
Assignees
Labels
arch-wasm WebAssembly architecture area-System.Net
Milestone

Comments

@kjpou1
Copy link
Contributor

kjpou1 commented Dec 3, 2020

System.Runtime.InteropServices.JavaScript.JSException : InvalidAccessError: Failed to execute 'close' on 'WebSocket': The code must be either 1000, or between 3000 and 4999. 1003 is neither.

see #45470 for tests
part of: #44666

Update:

Looks like an implementation detail of WebSockets.close() as provided by the browser.

CloseEvent status codes

The following definitions are sourced from the IANA website [Ref]. Note that the 1xxx codes are only WebSocket-internal and not for the same meaning by the transported data (like when the application-layer protocol is invalid). The only permitted codes to be specified in Firefox are 1000 and 3000 to 4999 [Source, Bug].

Found reference to in reported issue of specific source code checking and verifying this code: https://searchfox.org/mozilla-central/rev/bf81d741ff5dd11bb364ef21306da599032fd479/dom/websocket/WebSocket.cpp#2533

Have been able to reproduce the FireFox report above on Chrome as well.

Any of the following codes will throw the error except for NormalClosure.

Code Value Desc
Empty 1005 No error specified.
EndpointUnavailable 1001 (1001) Indicates an endpoint is being removed. Either the server or client will become unavailable.
InternalServerError 1011 (1011) The connection will be closed by the server because of an error on the server.
InvalidMessageType 1003 (1003) The client or server is terminating the connection because it cannot accept the data type it received.
InvalidPayloadData 1007 (1007) The client or server is terminating the connection because it has received data inconsistent with the message type.
MandatoryExtension 1010 (1010) The client is terminating the connection because it expected the server to negotiate an extension.
MessageTooBig 1009 (1009) The client or server is terminating the connection because it has received a message that is too big for it to process.
NormalClosure 1000 (1000) The connection has closed after the request was fulfilled.
PolicyViolation 1008 (1008) The connection will be closed because an endpoint has received a message that violates its policy.
ProtocolError 1002 (1002) The client or server is terminating the connection because of a protocol error.
@kjpou1 kjpou1 added arch-wasm WebAssembly architecture area-System.Net labels Dec 3, 2020
@kjpou1 kjpou1 self-assigned this Dec 3, 2020
@ghost
Copy link

ghost commented Dec 3, 2020

Tagging subscribers to this area: @dotnet/ncl
See info in area-owners.md if you want to be subscribed.

Issue Details

System.Runtime.InteropServices.JavaScript.JSException : InvalidAccessError: Failed to execute 'close' on 'WebSocket': The code must be either 1000, or between 3000 and 4999. 1005 is neither.

Author: kjpou1
Assignees: kjpou1
Labels:

arch-wasm, area-System.Net

Milestone: -

@Dotnet-GitSync-Bot Dotnet-GitSync-Bot added the untriaged New issue has not been triaged by the area owner label Dec 3, 2020
@kjpou1 kjpou1 changed the title [browser][websockets][tests] Test failures for invalid close codes [browser][websockets][tests] Test failures for invalid WebSocketCloseStatus codes Dec 4, 2020
@kjpou1 kjpou1 removed the untriaged New issue has not been triaged by the area owner label Dec 4, 2020
@kjpou1 kjpou1 added this to the 6.0.0 milestone Jan 5, 2021
@kjpou1
Copy link
Contributor Author

kjpou1 commented Jan 5, 2021

Closed via #45470

@kjpou1 kjpou1 closed this as completed Jan 5, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Feb 4, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
arch-wasm WebAssembly architecture area-System.Net
Projects
None yet
Development

No branches or pull requests

2 participants