Bug 112534

Summary: WebSocket should not fail the connection when blob data can't be loaded correctly.
Product: WebKit Reporter: Li Yin <li.yin>
Component: WebCore Misc.Assignee: Li Yin <li.yin>
Status: RESOLVED INVALID    
Severity: Normal CC: ap, buildbot, rniwa, tkent, toyoshim, yutak
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
Patch buildbot: commit-queue-

Description Li Yin 2013-03-17 23:11:36 PDT
For WebSocket.send(blob) function, when blob data can't be loaded correctly(e.g. the File or Blob resource could not be found at the time the read was processed), WebSocket will fail the connection.
I don't think it is friendly, maybe add console message "blob data can't be loaded correctly" should be reasonable.
Comment 1 Li Yin 2013-03-18 01:40:25 PDT
In my mind, if the blob data can't be loaded successfully, WebSocket object add error message to console, should not fail the connection, and then fetch the next blob to send.
What is your thought?
Comment 2 Li Yin 2013-03-18 01:53:11 PDT
Created attachment 193503 [details]
Patch
Comment 3 Build Bot 2013-03-18 05:39:06 PDT
Comment on attachment 193503 [details]
Patch

Attachment 193503 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://webkit-commit-queue.appspot.com/results/17190513

New failing tests:
http/tests/websocket/tests/hybi/send-blob.html
Comment 4 Li Yin 2013-03-18 06:51:19 PDT
It seems the diff text can't be found from the output.
How to get the diff text?
Comment 5 Takashi Toyoshima 2013-03-18 15:25:37 PDT
Hi Li,
Adding console message sounds good. But I object to your comment #1.
WebSocket API spec about the send operation says;

If the argument is a Blob object
... snip ... if the data cannot be sent, e.g. because it would need to be buffered but the buffer is full, the user agent must close the WebSocket connection with prejudice.

send method doesn't have a way to notify errors asynchronously. And the spec consistently requires to fail the connection when send operation is not succeeded. To send following data after failure make the upper layer protocol design difficult, I think.
Comment 6 Li Yin 2013-03-18 18:15:51 PDT
(In reply to comment #5)
> Hi Li,
> Adding console message sounds good. But I object to your comment #1.
> To send following data after failure make the upper layer protocol design difficult, I think.

After a higher consideration, I think what you said is reasonable.
If we throw some packages away, it is really difficult to use the protocol.
Thanks for your comments.

And we can fix the console message issue, use the readable message to replace Integer value.
Comment 7 Li Yin 2013-03-22 06:21:36 PDT
The bug is invalid, sorry for the noise.