Changeset 198482 in webkit
- Timestamp:
- Mar 20, 2016 10:28:21 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r198474 r198482 1 2016-03-20 Jinwoo Jeong <jw00.jeong@samsung.com> 2 3 The setter of binaryType attribute in WebSocket should raise the exception. 4 https://bugs.webkit.org/show_bug.cgi?id=135874 5 6 Reviewed by Antonio Gomes. 7 8 According to W3C WebSocket Specification, <https://www.w3.org/TR/2012/CR-websockets-20120920/>, 9 when an invalid value is set on binaryType of WebSocket, a SyntaxError should be raised. 10 11 * http/tests/websocket/tests/hybi/binary-type.html: Catch a syntax exception when binary type is set with invalid values. 12 1 13 2016-03-20 Chris Fleizach <cfleizach@apple.com> 2 14 -
trunk/LayoutTests/http/tests/websocket/tests/hybi/binary-type-expected.txt
r178527 r198482 1 CONSOLE MESSAGE: line 23: 'Blob' is not a valid value for binaryType; binaryType remains unchanged.2 CONSOLE MESSAGE: line 26: 'ArrayBuffer' is not a valid value for binaryType; binaryType remains unchanged.3 CONSOLE MESSAGE: line 29: '' is not a valid value for binaryType; binaryType remains unchanged.1 CONSOLE MESSAGE: line 600: 'Blob' is not a valid value for binaryType; binaryType remains unchanged. 2 CONSOLE MESSAGE: line 600: 'ArrayBuffer' is not a valid value for binaryType; binaryType remains unchanged. 3 CONSOLE MESSAGE: line 600: '' is not a valid value for binaryType; binaryType remains unchanged. 4 4 Test WebSocket.binaryType attribute. 5 5 … … 9 9 PASS ws.binaryType is "arraybuffer" 10 10 PASS ws.binaryType is "blob" 11 Set invalid values to binaryType. They should be ignored. No exception should be thrown.11 PASS ws.binaryType = 'Blob' threw exception Error: SyntaxError: DOM Exception 12. 12 12 PASS ws.binaryType is "blob" 13 PASS ws.binaryType = 'ArrayBuffer' threw exception Error: SyntaxError: DOM Exception 12. 13 14 PASS ws.binaryType is "blob" 15 PASS ws.binaryType = '' threw exception Error: SyntaxError: DOM Exception 12. 14 16 PASS ws.binaryType is "blob" 15 17 PASS successfullyParsed is true -
trunk/LayoutTests/http/tests/websocket/tests/hybi/binary-type.html
r130019 r198482 19 19 shouldBeEqualToString("ws.binaryType", "blob"); 20 20 21 debug("Set invalid values to binaryType. They should be ignored. No exception should be thrown."); 22 23 ws.binaryType = "Blob"; 21 shouldThrow("ws.binaryType = 'Blob'", "'Error: SyntaxError: DOM Exception 12'"); 24 22 shouldBeEqualToString("ws.binaryType", "blob"); 25 23 26 ws.binaryType = "ArrayBuffer" 24 shouldThrow("ws.binaryType = 'ArrayBuffer'", "'Error: SyntaxError: DOM Exception 12'"); 27 25 shouldBeEqualToString("ws.binaryType", "blob"); 28 26 29 ws.binaryType = "";27 shouldThrow("ws.binaryType = ''", "'Error: SyntaxError: DOM Exception 12'"); 30 28 shouldBeEqualToString("ws.binaryType", "blob"); 31 29 -
trunk/Source/WebCore/ChangeLog
r198481 r198482 1 2016-03-20 Jinwoo Jeong <jw00.jeong@samsung.com> 2 3 The setter of binaryType attribute in WebSocket should raise the exception. 4 https://bugs.webkit.org/show_bug.cgi?id=135874 5 6 Reviewed by Antonio Gomes. 7 8 According to W3C WebSocket Specification, <https://www.w3.org/TR/2012/CR-websockets-20120920/> 9 when an invalid value is set on binaryType of WebSocket, a SyntaxError should be raised. 10 11 * Modules/websockets/WebSocket.cpp: 12 (WebCore::WebSocket::setBinaryType): Add a parameter to set an exception. 13 * Modules/websockets/WebSocket.h: Ditto. 14 * Modules/websockets/WebSocket.idl: Update that setter of binaryType could raise an exception. 15 1 16 2016-03-20 Dan Bernstein <mitz@apple.com> 2 17 -
trunk/Source/WebCore/Modules/websockets/WebSocket.cpp
r196242 r198482 444 444 } 445 445 446 void WebSocket::setBinaryType(const String& binaryType )446 void WebSocket::setBinaryType(const String& binaryType, ExceptionCode& ec) 447 447 { 448 448 if (binaryType == "blob") { … … 454 454 return; 455 455 } 456 ec = SYNTAX_ERR; 456 457 scriptExecutionContext()->addConsoleMessage(MessageSource::JS, MessageLevel::Error, "'" + binaryType + "' is not a valid value for binaryType; binaryType remains unchanged."); 457 458 } -
trunk/Source/WebCore/Modules/websockets/WebSocket.h
r197563 r198482 89 89 90 90 String binaryType() const; 91 void setBinaryType(const String& );91 void setBinaryType(const String&, ExceptionCode&); 92 92 93 93 // EventTarget functions. -
trunk/Source/WebCore/Modules/websockets/WebSocket.idl
r197060 r198482 61 61 readonly attribute DOMString? extensions; 62 62 63 attribute DOMString binaryType;63 [SetterRaisesException] attribute DOMString binaryType; 64 64 65 65 [RaisesException] void send(ArrayBuffer data);
Note: See TracChangeset
for help on using the changeset viewer.