Bug 92642

Summary: [Bindings]Remove custom JS/V8 bindings for WebSocket::close() using [Clamp]
Product: WebKit Reporter: Vineet Chaudhary (vineetc) <code.vineet>
Component: New BugsAssignee: Vineet Chaudhary (vineetc) <code.vineet>
Status: RESOLVED FIXED    
Severity: Normal CC: abarth, haraken, japhet, jochen, ojan, toyoshim, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
patch_for_review none

Vineet Chaudhary (vineetc)
Reported 2012-07-30 05:57:31 PDT
With support of [Clamp] as extended attribute we can replace custom bindings from WebSocket::close(). Spec for WebSocket::close() : http://www.whatwg.org/specs/web-apps/current-work/multipage/network.html#websocket
Attachments
patch_for_review (10.04 KB, patch)
2012-07-30 06:07 PDT, Vineet Chaudhary (vineetc)
no flags
Vineet Chaudhary (vineetc)
Comment 1 2012-07-30 06:07:52 PDT
Created attachment 155278 [details] patch_for_review
Vineet Chaudhary (vineetc)
Comment 2 2012-07-30 06:08:42 PDT
Comment on attachment 155278 [details] patch_for_review View in context: https://bugs.webkit.org/attachment.cgi?id=155278&action=review > Source/WebCore/ChangeLog:22 > + (GenerateParametersCheck): I apologize for this, its regression from my previous patch :(
Kentaro Hara
Comment 3 2012-07-30 06:25:30 PDT
Comment on attachment 155278 [details] patch_for_review View in context: https://bugs.webkit.org/attachment.cgi?id=155278&action=review LGTM, this is a great progress. > Source/WebCore/Modules/websockets/WebSocket.idl:76 > + void close(in [Clamp, Optional] unsigned short code, in [Optional] DOMString reason) raises(DOMException); BTW, isn't it allowed to change the value of WebSocketChannel::CloseEventCodeNotSpecified from -1 to 0? If we can change it to 0, we can make the binding code clearer: by specifying [Optional=DefaultIsUndefined] for 'code' and [Optional=DefaultIsNullString] for 'reason', we can remove close(ExceptionCode& ec) and close(int code, ExceptionCode& ec).
Kentaro Hara
Comment 4 2012-07-30 06:29:23 PDT
Comment on attachment 155278 [details] patch_for_review > BTW, isn't it allowed to change the value of WebSocketChannel::CloseEventCodeNotSpecified from -1 to 0? Sorry, I was misunderstanding. Please ignore the comment:)
Vineet Chaudhary (vineetc)
Comment 5 2012-07-30 06:42:57 PDT
(In reply to comment #4) > (From update of attachment 155278 [details]) > > BTW, isn't it allowed to change the value of WebSocketChannel::CloseEventCodeNotSpecified from -1 to 0? > > Sorry, I was misunderstanding. Please ignore the comment:) > BTW, isn't it allowed to change the value of WebSocketChannel::CloseEventCodeNotSpecified from -1 to 0? > > If we can change it to 0, we can make the binding code clearer: by specifying [Optional=DefaultIsUndefined] for 'code' and [Optional=DefaultIsNullString] for 'reason', we can remove close(ExceptionCode& ec) and close(int code, ExceptionCode& ec). As per the http://tools.ietf.org/html/rfc6455#section-7.4.1 we can change "-1" to "0" as 0-999 are not in used. But I am really not sure if this doesn't breaks existing behaviour of chrome as it might be based on this code(websocket.h). Shall we check with chromium peoples ?
Vineet Chaudhary (vineetc)
Comment 6 2012-07-30 06:45:01 PDT
(In reply to comment #5) > As per the http://tools.ietf.org/html/rfc6455#section-7.4.1 we can change "-1" to "0" as 0-999 are not in used. > But I am really not sure if this doesn't breaks existing behaviour of chrome as it might be based on this code(websocket.h). Shall we check with chromium peoples > ? Rather we should use 0 than -1 as the spec itself says it should be unsigned void close([Clamp] optional unsigned short code, optional DOMString reason);
Kentaro Hara
Comment 7 2012-07-30 06:47:12 PDT
(In reply to comment #6) > (In reply to comment #5) > > As per the http://tools.ietf.org/html/rfc6455#section-7.4.1 we can change "-1" to "0" as 0-999 are not in used. > > But I am really not sure if this doesn't breaks existing behaviour of chrome as it might be based on this code(websocket.h). Shall we check with chromium peoples > > ? > > Rather we should use 0 than -1 as the spec itself says it should be unsigned > > void close([Clamp] optional unsigned short code, optional DOMString reason); Oh, good point. toyoshim: Do you have any concern about changing the default 'code' value from -1 to 0? vineetc: Either way let's fix the problem in a follow-up patch:)
Vineet Chaudhary (vineetc)
Comment 8 2012-07-30 06:52:58 PDT
Comment on attachment 155278 [details] patch_for_review > vineetc: Either way let's fix the problem in a follow-up patch:) Oke we will address/discuss this in another thread. Thanks..
Takashi Toyoshima
Comment 9 2012-07-30 07:07:21 PDT
> toyoshim: Do you have any concern about changing the default 'code' value from -1 to 0? In WebSocket::close(), code and reason are defined as "optional". Originally, this out of range value -1 is used to detect the case there values are omitted. Another concern is that this value is exported via WebKit API. $ git grep CloseEventCodeNotSpecified (snip) WebKit/chromium/public/WebSocket.h: CloseEventCodeNotSpecified = -1, This value is used in chromium side to support PPAPI bindings. Changing this value will break some chromium unit tests temporally, but I can fix them in chromium side. Anyway, I should disable these tests temporally, so please ping me before landing this change.
Takashi Toyoshima
Comment 10 2012-07-30 07:13:03 PDT
Ah, it's no problem to land this change without changing CloseEventCodeNotSpecified. Vineet, thank you for supporting clamp and revise WebSocket to use it.
WebKit Review Bot
Comment 11 2012-07-30 09:33:13 PDT
Comment on attachment 155278 [details] patch_for_review Clearing flags on attachment: 155278 Committed r124034: <http://trac.webkit.org/changeset/124034>
WebKit Review Bot
Comment 12 2012-07-30 09:33:17 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.