Title: [96785] trunk
Revision
96785
Author
[email protected]
Date
2011-10-05 20:37:38 -0700 (Wed, 05 Oct 2011)

Log Message

WebSocket: Add extensions attribute
https://bugs.webkit.org/show_bug.cgi?id=69408

Reviewed by Kent Tamura.

Source/WebCore:

Add WebSocket's "extensions" attribute as specified in the WebSocket API
<http://dev.w3.org/html5/websockets/#the-websocket-interface>.

WebSocket protocol extension is not implemented at all, thus this attribute
always returns an empty string.

Test: http/tests/websocket/tests/hybi/extensions.html
      http/tests/websocket/tests/hixie76/undefined-attributes.html (updated)

* websockets/WebSocket.cpp:
(WebCore::WebSocket::extensions):
If the hixie-76 protocol is chosen, we need to return "undefined" in order to
keep behavior of the ports which have not used the newer hybi protocol yet.
* websockets/WebSocket.h:
* websockets/WebSocket.idl:

LayoutTests:

* http/tests/websocket/tests/hixie76/undefined-attributes-expected.txt:
* http/tests/websocket/tests/hixie76/undefined-attributes.html:
Added "extensions" attribute to the list because it shouldn't be defined
when hixie-76 protocol is used.
* http/tests/websocket/tests/hybi/extensions-expected.txt: Added.
* http/tests/websocket/tests/hybi/extensions.html:
Added. Test whether .extensions attribute always returns an empty string.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (96784 => 96785)


--- trunk/LayoutTests/ChangeLog	2011-10-06 03:04:49 UTC (rev 96784)
+++ trunk/LayoutTests/ChangeLog	2011-10-06 03:37:38 UTC (rev 96785)
@@ -1,3 +1,18 @@
+2011-10-05  Yuta Kitamura  <[email protected]>
+
+        WebSocket: Add extensions attribute
+        https://bugs.webkit.org/show_bug.cgi?id=69408
+
+        Reviewed by Kent Tamura.
+
+        * http/tests/websocket/tests/hixie76/undefined-attributes-expected.txt:
+        * http/tests/websocket/tests/hixie76/undefined-attributes.html:
+        Added "extensions" attribute to the list because it shouldn't be defined
+        when hixie-76 protocol is used.
+        * http/tests/websocket/tests/hybi/extensions-expected.txt: Added.
+        * http/tests/websocket/tests/hybi/extensions.html:
+        Added. Test whether .extensions attribute always returns an empty string.
+
 2011-10-05  James Simonsen  <[email protected]>
 
         [Chromium] Update test expectations for Web Audio on Windows.

Modified: trunk/LayoutTests/http/tests/websocket/tests/hixie76/undefined-attributes-expected.txt (96784 => 96785)


--- trunk/LayoutTests/http/tests/websocket/tests/hixie76/undefined-attributes-expected.txt	2011-10-06 03:04:49 UTC (rev 96784)
+++ trunk/LayoutTests/http/tests/websocket/tests/hixie76/undefined-attributes-expected.txt	2011-10-06 03:37:38 UTC (rev 96785)
@@ -3,6 +3,7 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 PASS ws.binaryType is undefined.
+PASS ws.extensions is undefined.
 PASS ws.protocol is undefined.
 PASS successfullyParsed is true
 

Modified: trunk/LayoutTests/http/tests/websocket/tests/hixie76/undefined-attributes.html (96784 => 96785)


--- trunk/LayoutTests/http/tests/websocket/tests/hixie76/undefined-attributes.html	2011-10-06 03:04:49 UTC (rev 96784)
+++ trunk/LayoutTests/http/tests/websocket/tests/hixie76/undefined-attributes.html	2011-10-06 03:37:38 UTC (rev 96785)
@@ -13,6 +13,7 @@
 var ws = new WebSocket("ws://127.0.0.1:8880/websocket/tests/hixie76/simple");
 
 shouldBeUndefined("ws.binaryType");
+shouldBeUndefined("ws.extensions");
 shouldBeUndefined("ws.protocol");
 
 var successfullyParsed = true;

Added: trunk/LayoutTests/http/tests/websocket/tests/hybi/extensions-expected.txt (0 => 96785)


--- trunk/LayoutTests/http/tests/websocket/tests/hybi/extensions-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/http/tests/websocket/tests/hybi/extensions-expected.txt	2011-10-06 03:37:38 UTC (rev 96785)
@@ -0,0 +1,10 @@
+Test WebSocket.extensions attribute.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+PASS ws.extensions is ""
+PASS ws.extensions is ""
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/http/tests/websocket/tests/hybi/extensions.html (0 => 96785)


--- trunk/LayoutTests/http/tests/websocket/tests/hybi/extensions.html	                        (rev 0)
+++ trunk/LayoutTests/http/tests/websocket/tests/hybi/extensions.html	2011-10-06 03:37:38 UTC (rev 96785)
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<html>
+<head>
+<link rel="stylesheet" href=""
+<script src=""
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script>
+description("Test WebSocket.extensions attribute.");
+
+if (window.layoutTestController)
+    layoutTestController.overridePreference("WebKitHixie76WebSocketProtocolEnabled", 0);
+
+var ws = new WebSocket("ws://localhost:8880/websocket/tests/hybi/simple");
+shouldBeEqualToString("ws.extensions", "");
+
+// extensions attribute is read-only.
+ws.extensions = "foo";
+shouldBeEqualToString("ws.extensions", "");
+
+var successfullyParsed = true;
+</script>
+<script src=""
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (96784 => 96785)


--- trunk/Source/WebCore/ChangeLog	2011-10-06 03:04:49 UTC (rev 96784)
+++ trunk/Source/WebCore/ChangeLog	2011-10-06 03:37:38 UTC (rev 96785)
@@ -1,3 +1,26 @@
+2011-10-05  Yuta Kitamura  <[email protected]>
+
+        WebSocket: Add extensions attribute
+        https://bugs.webkit.org/show_bug.cgi?id=69408
+
+        Reviewed by Kent Tamura.
+
+        Add WebSocket's "extensions" attribute as specified in the WebSocket API
+        <http://dev.w3.org/html5/websockets/#the-websocket-interface>.
+
+        WebSocket protocol extension is not implemented at all, thus this attribute
+        always returns an empty string.
+
+        Test: http/tests/websocket/tests/hybi/extensions.html
+              http/tests/websocket/tests/hixie76/undefined-attributes.html (updated)
+
+        * websockets/WebSocket.cpp:
+        (WebCore::WebSocket::extensions):
+        If the hixie-76 protocol is chosen, we need to return "undefined" in order to
+        keep behavior of the ports which have not used the newer hybi protocol yet.
+        * websockets/WebSocket.h:
+        * websockets/WebSocket.idl:
+
 2011-10-05  Dominic Cooney  <[email protected]>
 
         IsShadowRootFlag should not depend on whether a ShadowRoot is attached to a host.

Modified: trunk/Source/WebCore/websockets/WebSocket.cpp (96784 => 96785)


--- trunk/Source/WebCore/websockets/WebSocket.cpp	2011-10-06 03:04:49 UTC (rev 96784)
+++ trunk/Source/WebCore/websockets/WebSocket.cpp	2011-10-06 03:37:38 UTC (rev 96785)
@@ -369,6 +369,14 @@
     return m_subprotocol;
 }
 
+String WebSocket::extensions() const
+{
+    if (m_useHixie76Protocol)
+        return String();
+    // WebSocket protocol extension is not supported yet.
+    return "";
+}
+
 String WebSocket::binaryType() const
 {
     if (m_useHixie76Protocol)

Modified: trunk/Source/WebCore/websockets/WebSocket.h (96784 => 96785)


--- trunk/Source/WebCore/websockets/WebSocket.h	2011-10-06 03:04:49 UTC (rev 96784)
+++ trunk/Source/WebCore/websockets/WebSocket.h	2011-10-06 03:37:38 UTC (rev 96785)
@@ -79,6 +79,7 @@
     unsigned long bufferedAmount() const;
 
     String protocol() const;
+    String extensions() const;
 
     String binaryType() const;
     void setBinaryType(const String& binaryType, ExceptionCode&);

Modified: trunk/Source/WebCore/websockets/WebSocket.idl (96784 => 96785)


--- trunk/Source/WebCore/websockets/WebSocket.idl	2011-10-06 03:04:49 UTC (rev 96784)
+++ trunk/Source/WebCore/websockets/WebSocket.idl	2011-10-06 03:37:38 UTC (rev 96785)
@@ -59,6 +59,7 @@
         attribute EventListener onclose;
 
         readonly attribute [ConvertNullStringTo=Undefined] DOMString protocol;
+        readonly attribute [ConvertNullStringTo=Undefined] DOMString extensions;
 
         attribute [ConvertNullStringTo=Undefined] DOMString binaryType
             setter raises(DOMException);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to