RESOLVED FIXED 67363
WebSocket: Fix bufferedAmount after WebSocket is closed
https://bugs.webkit.org/show_bug.cgi?id=67363
Summary WebSocket: Fix bufferedAmount after WebSocket is closed
Yuta Kitamura
Reported 2011-08-31 23:14:09 PDT
It's fairly obvious when you see the source code: http://trac.webkit.org/browser/trunk/Source/WebCore/websockets/WebSocket.cpp?rev=94274#L257 257 m_bufferedAmountAfterClose += message.utf8().length() + 2; // 2 for frameing This code only assumes hixie76 protocol in which every frame has two-byte framing overhead ("\x00" and "\xFF"). Let's make this code hybi-aware.
Attachments
Patch (7.62 KB, patch)
2011-08-31 23:26 PDT, Yuta Kitamura
no flags
Patch v2 (7.70 KB, patch)
2011-09-01 00:58 PDT, Yuta Kitamura
no flags
Yuta Kitamura
Comment 1 2011-08-31 23:26:55 PDT
Kent Tamura
Comment 2 2011-08-31 23:43:56 PDT
Comment on attachment 105901 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=105901&action=review > LayoutTests/http/tests/websocket/tests/hybi/bufferedAmount-after-close.html:25 > +function getExpectedFramingOverhead(payloadSize) > +{ > + var overhead = 2 + 4; // Base header size and masking key size. > + if (payloadSize > 0xFFFF) > + overhead += 8; > + else if (payloadSize > 125) > + overhead += 2; > + return overhead; > +} Copying the code logic in C++ to the test code makes the test meaningless. We should have constant values of the overheads for each test cases. > LayoutTests/http/tests/websocket/tests/hybi/bufferedAmount-after-close.html:59 > +function doTest(message) nit: doTest -> testBufferedAmount ?
Yuta Kitamura
Comment 3 2011-09-01 00:58:47 PDT
Created attachment 105918 [details] Patch v2
Yuta Kitamura
Comment 4 2011-09-01 00:59:41 PDT
Comment on attachment 105901 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=105901&action=review >> LayoutTests/http/tests/websocket/tests/hybi/bufferedAmount-after-close.html:25 >> +} > > Copying the code logic in C++ to the test code makes the test meaningless. We should have constant values of the overheads for each test cases. Fixed. >> LayoutTests/http/tests/websocket/tests/hybi/bufferedAmount-after-close.html:59 >> +function doTest(message) > > nit: doTest -> testBufferedAmount ? Fixed.
Kent Tamura
Comment 5 2011-09-01 01:19:14 PDT
Comment on attachment 105918 [details] Patch v2 ok
WebKit Review Bot
Comment 6 2011-09-01 02:57:59 PDT
Comment on attachment 105918 [details] Patch v2 Clearing flags on attachment: 105918 Committed r94282: <http://trac.webkit.org/changeset/94282>
WebKit Review Bot
Comment 7 2011-09-01 02:58:03 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.