RESOLVED CONFIGURATION CHANGED 92729
code parameter of WebSocket::close() should be unsigned value than signed.
https://bugs.webkit.org/show_bug.cgi?id=92729
Summary code parameter of WebSocket::close() should be unsigned value than signed.
Vineet Chaudhary (vineetc)
Reported 2012-07-31 02:24:43 PDT
This has came up with discussion from Bug92642. Currently as per the WebSocket API spec: http://www.whatwg.org/specs/web-apps/current-work/multipage/network.html#websocket The first parameter(code) of the close() api should be unsigned value but currently it is signed value. Replacing this code value to unsigned and WebSocketChannel::CloseEventCodeNotSpecified to 0 we can tweak idl definition as void close(in [Clamp, Optional=DefaultIsUndefined] unsigned short code, in [Optional=DefaultIsNullString] DOMString reason) raises(DOMException); Also below extra defiantions of close() from WebSocket.h can be removed. void close(ExceptionCode& ec) { close(WebSocketChannel::CloseEventCodeNotSpecified, String(), ec); } void close(int code, ExceptionCode& ec) { close(code, String(), ec); }
Attachments
proposed patch (4.22 KB, patch)
2012-07-31 02:34 PDT, Vineet Chaudhary (vineetc)
no flags
Vineet Chaudhary (vineetc)
Comment 1 2012-07-31 02:34:05 PDT
Created attachment 155473 [details] proposed patch This is the initial approach to fix this issue.
Vineet Chaudhary (vineetc)
Comment 2 2012-07-31 02:39:12 PDT
(In reply to comment #1) > Created an attachment (id=155473) [details] > proposed patch > > This is the initial approach to fix this issue. With this patch one known failing chromium test case is LayoutTests/http/tests/websocket/tests/hybi/close.html Reason is now close() api doesn't have any mechanism to know "0" value is because of MISSING_PARAMETER or its clamped value from Nan,+/-Infinity.
Kentaro Hara
Comment 3 2012-07-31 02:40:22 PDT
toyoshim: Is that value used by chromium's PPAPI bindings only? I mean, if you could fix the PPAPI bindings, will there be no other compatibility concern?
Takashi Toyoshima
Comment 4 2012-07-31 07:13:38 PDT
Hum... We should raise a proper exception for out of range closing code. So reusing 0 will mistakenly accept invalid closing code 0 which is passed by JavaScript. By the way, WebKit API modification requires special review by API owners. tkent must be the person for that.
Takashi Toyoshima
Comment 5 2012-07-31 07:31:30 PDT
How about following idea? - move WebSocket::close implementation to WebSocket::close(bool, int, const String&, ExceptionCode&). This implementation accept four arguments, and the first bool indicates if code and reason are passed. - all three close bindings use this four argument version close. - keep CloseEventCodeNotSpecified being -1, and keep WebSocketChannel::close accepting int value for code argument. - also keep WebKit API as is.
Takashi Toyoshima
Comment 6 2012-07-31 07:34:41 PDT
(In reply to comment #3) > toyoshim: Is that value used by chromium's PPAPI bindings only? I mean, if you could fix the PPAPI bindings, will there be no other compatibility concern? PPAPI bindings will work if WebKit API's value is also changed as attached patched did. I have no other concern on changing this value, except for the point of comment #4.
Anne van Kesteren
Comment 7 2023-05-12 09:21:53 PDT
This has been resolved at some point in the past.
Note You need to log in before you can comment on or make changes to this bug.