RESOLVED FIXED 35570
WebSocket onmessageerror event handler
https://bugs.webkit.org/show_bug.cgi?id=35570
Summary WebSocket onmessageerror event handler
Fumitoshi Ukai
Reported 2010-03-02 03:01:43 PST
WebSocket onmessageerror event handler is added to report unexpected frames. http://lists.whatwg.org/pipermail/commit-watchers-whatwg.org/2010/003975.html
Attachments
Patch (8.56 KB, patch)
2010-03-02 21:42 PST, Fumitoshi Ukai
no flags
Patch (9.14 KB, patch)
2010-03-03 18:26 PST, Fumitoshi Ukai
no flags
Patch (8.69 KB, patch)
2010-03-03 23:28 PST, Fumitoshi Ukai
ap: review+
Fumitoshi Ukai
Comment 1 2010-03-02 21:42:11 PST
Alexey Proskuryakov
Comment 2 2010-03-03 14:42:32 PST
Comment on attachment 49877 [details] Patch Should we call onmessageerror on frame length overflow for frames 0x80...0xff? WebSocket::didReceiveMessageError() probably needs a LOG - we have it even in close(), surely an error condition should have one. Looks good to me otherwise.
Fumitoshi Ukai
Comment 3 2010-03-03 18:26:46 PST
Fumitoshi Ukai
Comment 4 2010-03-03 19:37:36 PST
(In reply to comment #3) > Created an attachment (id=49973) [details] > Patch Ah, onmessageerror has been changed to onerror http://lists.whatwg.org/pipermail/commit-watchers-whatwg.org/2010/003979.html
Alexey Proskuryakov
Comment 5 2010-03-03 22:18:25 PST
Comment on attachment 49973 [details] Patch The test depends on WebSocket.onclose patch, correct? I'm still thinking about that idea, not sure if I like it or not.
Fumitoshi Ukai
Comment 6 2010-03-03 23:28:16 PST
Fumitoshi Ukai
Comment 7 2010-03-03 23:29:31 PST
(In reply to comment #5) > (From update of attachment 49973 [details]) > The test depends on WebSocket.onclose patch, correct? I'm still thinking about > that idea, not sure if I like it or not. no, it doesn't depend on other patch. Which patch do you mean?
Alexey Proskuryakov
Comment 8 2010-03-04 00:08:59 PST
OK. I was thinking about bug 35573 (CloseEvent).
Alexey Proskuryakov
Comment 9 2010-03-04 10:46:46 PST
Comment on attachment 49990 [details] Patch > +void WebSocket::didReceiveMessageError() > +{ > + LOG(Network, "WebSocket %p didReceiveErrorMessage", this); > + if (m_state != OPEN || !scriptExecutionContext()) > + return; Can both these conditions really occur? Seems acceptable to be a little defensive, but maybe there should also be ASSERTs if this isn't supposed to happen. Otherwise, these checks can confuse someone about how this code works. r=me
Fumitoshi Ukai
Comment 10 2010-03-05 01:35:41 PST
Fumitoshi Ukai
Comment 11 2010-03-05 01:37:53 PST
(In reply to comment #9) > (From update of attachment 49990 [details]) > > +void WebSocket::didReceiveMessageError() > > +{ > > + LOG(Network, "WebSocket %p didReceiveErrorMessage", this); > > + if (m_state != OPEN || !scriptExecutionContext()) > > + return; > > Can both these conditions really occur? Seems acceptable to be a little > defensive, but maybe there should also be ASSERTs if this isn't supposed to > happen. Otherwise, these checks can confuse someone about how this code works. Ok. I think scriptExecutionContext() should be non null, but m_state might be CLOSED if script closing the WebSocket and events from network happened same time. make ASSERT(scriptExecutionContext()) and leave "if (m_state != OPEN)". > > r=me
Note You need to log in before you can comment on or make changes to this bug.