- Revision
- 199425
- Author
- [email protected]
- Date
- 2016-04-13 01:24:40 -0700 (Wed, 13 Apr 2016)
Log Message
Merge r198482 - The setter of binaryType attribute in WebSocket should raise the exception.
https://bugs.webkit.org/show_bug.cgi?id=135874
Patch by Jinwoo Jeong <[email protected]> on 2016-03-20
Reviewed by Antonio Gomes.
Source/WebCore:
According to W3C WebSocket Specification, <https://www.w3.org/TR/2012/CR-websockets-20120920/>
when an invalid value is set on binaryType of WebSocket, a SyntaxError should be raised.
* Modules/websockets/WebSocket.cpp:
(WebCore::WebSocket::setBinaryType): Add a parameter to set an exception.
* Modules/websockets/WebSocket.h: Ditto.
* Modules/websockets/WebSocket.idl: Update that setter of binaryType could raise an exception.
LayoutTests:
According to W3C WebSocket Specification, <https://www.w3.org/TR/2012/CR-websockets-20120920/>,
when an invalid value is set on binaryType of WebSocket, a SyntaxError should be raised.
* http/tests/websocket/tests/hybi/binary-type.html: Catch a syntax exception when binary type is set with invalid values.
Modified Paths
Diff
Modified: releases/WebKitGTK/webkit-2.12/LayoutTests/ChangeLog (199424 => 199425)
--- releases/WebKitGTK/webkit-2.12/LayoutTests/ChangeLog 2016-04-13 08:14:50 UTC (rev 199424)
+++ releases/WebKitGTK/webkit-2.12/LayoutTests/ChangeLog 2016-04-13 08:24:40 UTC (rev 199425)
@@ -1,3 +1,15 @@
+2016-03-20 Jinwoo Jeong <[email protected]>
+
+ The setter of binaryType attribute in WebSocket should raise the exception.
+ https://bugs.webkit.org/show_bug.cgi?id=135874
+
+ Reviewed by Antonio Gomes.
+
+ According to W3C WebSocket Specification, <https://www.w3.org/TR/2012/CR-websockets-20120920/>,
+ when an invalid value is set on binaryType of WebSocket, a SyntaxError should be raised.
+
+ * http/tests/websocket/tests/hybi/binary-type.html: Catch a syntax exception when binary type is set with invalid values.
+
2016-03-18 Darin Adler <[email protected]>
ASSERTION FAILED: m_isValid == valid() in WebCore::HTMLFormControlElement::isValidFormControlElement
Modified: releases/WebKitGTK/webkit-2.12/LayoutTests/http/tests/websocket/tests/hybi/binary-type-expected.txt (199424 => 199425)
--- releases/WebKitGTK/webkit-2.12/LayoutTests/http/tests/websocket/tests/hybi/binary-type-expected.txt 2016-04-13 08:14:50 UTC (rev 199424)
+++ releases/WebKitGTK/webkit-2.12/LayoutTests/http/tests/websocket/tests/hybi/binary-type-expected.txt 2016-04-13 08:24:40 UTC (rev 199425)
@@ -1,6 +1,6 @@
-CONSOLE MESSAGE: line 23: 'Blob' is not a valid value for binaryType; binaryType remains unchanged.
-CONSOLE MESSAGE: line 26: 'ArrayBuffer' is not a valid value for binaryType; binaryType remains unchanged.
-CONSOLE MESSAGE: line 29: '' is not a valid value for binaryType; binaryType remains unchanged.
+CONSOLE MESSAGE: line 600: 'Blob' is not a valid value for binaryType; binaryType remains unchanged.
+CONSOLE MESSAGE: line 600: 'ArrayBuffer' is not a valid value for binaryType; binaryType remains unchanged.
+CONSOLE MESSAGE: line 600: '' is not a valid value for binaryType; binaryType remains unchanged.
Test WebSocket.binaryType attribute.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
@@ -8,9 +8,11 @@
PASS ws.binaryType is "blob"
PASS ws.binaryType is "arraybuffer"
PASS ws.binaryType is "blob"
-Set invalid values to binaryType. They should be ignored. No exception should be thrown.
+PASS ws.binaryType = 'Blob' threw exception Error: SyntaxError: DOM Exception 12.
PASS ws.binaryType is "blob"
+PASS ws.binaryType = 'ArrayBuffer' threw exception Error: SyntaxError: DOM Exception 12.
PASS ws.binaryType is "blob"
+PASS ws.binaryType = '' threw exception Error: SyntaxError: DOM Exception 12.
PASS ws.binaryType is "blob"
PASS successfullyParsed is true
Modified: releases/WebKitGTK/webkit-2.12/LayoutTests/http/tests/websocket/tests/hybi/binary-type.html (199424 => 199425)
--- releases/WebKitGTK/webkit-2.12/LayoutTests/http/tests/websocket/tests/hybi/binary-type.html 2016-04-13 08:14:50 UTC (rev 199424)
+++ releases/WebKitGTK/webkit-2.12/LayoutTests/http/tests/websocket/tests/hybi/binary-type.html 2016-04-13 08:24:40 UTC (rev 199425)
@@ -18,15 +18,13 @@
ws.binaryType = "blob";
shouldBeEqualToString("ws.binaryType", "blob");
-debug("Set invalid values to binaryType. They should be ignored. No exception should be thrown.");
-
-ws.binaryType = "Blob";
+shouldThrow("ws.binaryType = 'Blob'", "'Error: SyntaxError: DOM Exception 12'");
shouldBeEqualToString("ws.binaryType", "blob");
-ws.binaryType = "ArrayBuffer"
+shouldThrow("ws.binaryType = 'ArrayBuffer'", "'Error: SyntaxError: DOM Exception 12'");
shouldBeEqualToString("ws.binaryType", "blob");
-ws.binaryType = "";
+shouldThrow("ws.binaryType = ''", "'Error: SyntaxError: DOM Exception 12'");
shouldBeEqualToString("ws.binaryType", "blob");
</script>
Modified: releases/WebKitGTK/webkit-2.12/Source/WebCore/ChangeLog (199424 => 199425)
--- releases/WebKitGTK/webkit-2.12/Source/WebCore/ChangeLog 2016-04-13 08:14:50 UTC (rev 199424)
+++ releases/WebKitGTK/webkit-2.12/Source/WebCore/ChangeLog 2016-04-13 08:24:40 UTC (rev 199425)
@@ -1,3 +1,18 @@
+2016-03-20 Jinwoo Jeong <[email protected]>
+
+ The setter of binaryType attribute in WebSocket should raise the exception.
+ https://bugs.webkit.org/show_bug.cgi?id=135874
+
+ Reviewed by Antonio Gomes.
+
+ According to W3C WebSocket Specification, <https://www.w3.org/TR/2012/CR-websockets-20120920/>
+ when an invalid value is set on binaryType of WebSocket, a SyntaxError should be raised.
+
+ * Modules/websockets/WebSocket.cpp:
+ (WebCore::WebSocket::setBinaryType): Add a parameter to set an exception.
+ * Modules/websockets/WebSocket.h: Ditto.
+ * Modules/websockets/WebSocket.idl: Update that setter of binaryType could raise an exception.
+
2016-03-19 Antti Koivisto <[email protected]>
Data URL DecodeTask may get deleted outside main thread
Modified: releases/WebKitGTK/webkit-2.12/Source/WebCore/Modules/websockets/WebSocket.cpp (199424 => 199425)
--- releases/WebKitGTK/webkit-2.12/Source/WebCore/Modules/websockets/WebSocket.cpp 2016-04-13 08:14:50 UTC (rev 199424)
+++ releases/WebKitGTK/webkit-2.12/Source/WebCore/Modules/websockets/WebSocket.cpp 2016-04-13 08:24:40 UTC (rev 199425)
@@ -443,7 +443,7 @@
return String();
}
-void WebSocket::setBinaryType(const String& binaryType)
+void WebSocket::setBinaryType(const String& binaryType, ExceptionCode& ec)
{
if (binaryType == "blob") {
m_binaryType = BinaryTypeBlob;
@@ -453,6 +453,7 @@
m_binaryType = BinaryTypeArrayBuffer;
return;
}
+ ec = SYNTAX_ERR;
scriptExecutionContext()->addConsoleMessage(MessageSource::JS, MessageLevel::Error, "'" + binaryType + "' is not a valid value for binaryType; binaryType remains unchanged.");
}
Modified: releases/WebKitGTK/webkit-2.12/Source/WebCore/Modules/websockets/WebSocket.h (199424 => 199425)
--- releases/WebKitGTK/webkit-2.12/Source/WebCore/Modules/websockets/WebSocket.h 2016-04-13 08:14:50 UTC (rev 199424)
+++ releases/WebKitGTK/webkit-2.12/Source/WebCore/Modules/websockets/WebSocket.h 2016-04-13 08:24:40 UTC (rev 199425)
@@ -88,7 +88,7 @@
String extensions() const;
String binaryType() const;
- void setBinaryType(const String&);
+ void setBinaryType(const String&, ExceptionCode&);
// EventTarget functions.
virtual EventTargetInterface eventTargetInterface() const override;
Modified: releases/WebKitGTK/webkit-2.12/Source/WebCore/Modules/websockets/WebSocket.idl (199424 => 199425)
--- releases/WebKitGTK/webkit-2.12/Source/WebCore/Modules/websockets/WebSocket.idl 2016-04-13 08:14:50 UTC (rev 199424)
+++ releases/WebKitGTK/webkit-2.12/Source/WebCore/Modules/websockets/WebSocket.idl 2016-04-13 08:24:40 UTC (rev 199425)
@@ -60,7 +60,7 @@
[TreatReturnedNullStringAs=Undefined] readonly attribute DOMString protocol;
[TreatReturnedNullStringAs=Undefined] readonly attribute DOMString extensions;
- attribute DOMString binaryType;
+ [SetterRaisesException] attribute DOMString binaryType;
[RaisesException] void send(ArrayBuffer data);
[RaisesException] void send(ArrayBufferView data);