Title: [233119] trunk
Revision
233119
Author
[email protected]
Date
2018-06-22 19:42:00 -0700 (Fri, 22 Jun 2018)

Log Message

Disable WebSocket in WatchOS
https://bugs.webkit.org/show_bug.cgi?id=186931
<rdar://problem/39584458>

Reviewed by Wenson Hsieh.

Source/WebCore:

Add a runtime flag to enable/disable WebSocket.
By default, flag is on for all platforms except for WatchOS.

Test: fast/dom/Window/watchos/websocket/watchos/no-websocket-in-watchos.html

* Modules/websockets/WebSocket.idl:
* page/RuntimeEnabledFeatures.cpp:
(WebCore::RuntimeEnabledFeatures::RuntimeEnabledFeatures):
* page/RuntimeEnabledFeatures.h:
(WebCore::RuntimeEnabledFeatures::setWebSocketEnabled):
(WebCore::RuntimeEnabledFeatures::webSocketEnabled const):

LayoutTests:

* TestExpectations:
* fast/dom/Window/watchos/no-websocket-in-watchos-expected.txt: Added.
* fast/dom/Window/watchos/no-websocket-in-watchos.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (233118 => 233119)


--- trunk/LayoutTests/ChangeLog	2018-06-23 01:31:42 UTC (rev 233118)
+++ trunk/LayoutTests/ChangeLog	2018-06-23 02:42:00 UTC (rev 233119)
@@ -1,3 +1,15 @@
+2018-06-22  Youenn Fablet  <[email protected]>
+
+        Disable WebSocket in WatchOS
+        https://bugs.webkit.org/show_bug.cgi?id=186931
+        <rdar://problem/39584458>
+
+        Reviewed by Wenson Hsieh.
+
+        * TestExpectations:
+        * fast/dom/Window/watchos/no-websocket-in-watchos-expected.txt: Added.
+        * fast/dom/Window/watchos/no-websocket-in-watchos.html: Added.
+
 2018-06-22  Tim Horton  <[email protected]>
 
         Make it possible to add a border around loading or failed-to-load images

Added: trunk/LayoutTests/fast/dom/Window/watchos/no-websocket-in-watchos-expected.txt (0 => 233119)


--- trunk/LayoutTests/fast/dom/Window/watchos/no-websocket-in-watchos-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/Window/watchos/no-websocket-in-watchos-expected.txt	2018-06-23 02:42:00 UTC (rev 233119)
@@ -0,0 +1,3 @@
+
+PASS Ensure that WebSocket is disabled in WatchOS 
+

Added: trunk/LayoutTests/fast/dom/Window/watchos/no-websocket-in-watchos.html (0 => 233119)


--- trunk/LayoutTests/fast/dom/Window/watchos/no-websocket-in-watchos.html	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/Window/watchos/no-websocket-in-watchos.html	2018-06-23 02:42:00 UTC (rev 233119)
@@ -0,0 +1,16 @@
+<!doctype html>
+<html>
+  <head>
+    <meta charset="utf-8">
+    <title>No websocket in watchos</title>
+    <script src=""
+    <script src=""
+  </head>
+  <body>
+    <script>
+test(() => {
+    assert_equals(window.WebSocket, undefined);
+}, 'Ensure that WebSocket is disabled in WatchOS');
+    </script>
+  </body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (233118 => 233119)


--- trunk/Source/WebCore/ChangeLog	2018-06-23 01:31:42 UTC (rev 233118)
+++ trunk/Source/WebCore/ChangeLog	2018-06-23 02:42:00 UTC (rev 233119)
@@ -1,3 +1,23 @@
+2018-06-22  Youenn Fablet  <[email protected]>
+
+        Disable WebSocket in WatchOS
+        https://bugs.webkit.org/show_bug.cgi?id=186931
+        <rdar://problem/39584458>
+
+        Reviewed by Wenson Hsieh.
+
+        Add a runtime flag to enable/disable WebSocket.
+        By default, flag is on for all platforms except for WatchOS.
+
+        Test: fast/dom/Window/watchos/websocket/watchos/no-websocket-in-watchos.html
+
+        * Modules/websockets/WebSocket.idl:
+        * page/RuntimeEnabledFeatures.cpp:
+        (WebCore::RuntimeEnabledFeatures::RuntimeEnabledFeatures):
+        * page/RuntimeEnabledFeatures.h:
+        (WebCore::RuntimeEnabledFeatures::setWebSocketEnabled):
+        (WebCore::RuntimeEnabledFeatures::webSocketEnabled const):
+
 2018-06-22  Woodrow Wang  <[email protected]>
 
         SubresourceLoader::didFail() should only log message if state is Initialized

Modified: trunk/Source/WebCore/Modules/websockets/WebSocket.idl (233118 => 233119)


--- trunk/Source/WebCore/Modules/websockets/WebSocket.idl	2018-06-23 01:31:42 UTC (rev 233118)
+++ trunk/Source/WebCore/Modules/websockets/WebSocket.idl	2018-06-23 02:42:00 UTC (rev 233119)
@@ -36,6 +36,7 @@
     ConstructorMayThrowException,
     ConstructorCallWith=ScriptExecutionContext,
     Exposed=(Window,Worker),
+    EnabledAtRuntime=WebSocket
 ] interface WebSocket : EventTarget {
     readonly attribute USVString URL; // Lowercased .url is the one in the spec, but leaving .URL for compatibility reasons.
     readonly attribute USVString url;

Modified: trunk/Source/WebCore/page/RuntimeEnabledFeatures.cpp (233118 => 233119)


--- trunk/Source/WebCore/page/RuntimeEnabledFeatures.cpp	2018-06-23 01:31:42 UTC (rev 233118)
+++ trunk/Source/WebCore/page/RuntimeEnabledFeatures.cpp	2018-06-23 02:42:00 UTC (rev 233119)
@@ -43,6 +43,9 @@
 #if ENABLE(MEDIA_STREAM) && PLATFORM(COCOA)
     m_isMediaDevicesEnabled = false;
 #endif
+#if PLATFORM(WATCHOS)
+    m_isWebSocketEnabled = false;
+#endif
 }
 
 RuntimeEnabledFeatures& RuntimeEnabledFeatures::sharedFeatures()

Modified: trunk/Source/WebCore/page/RuntimeEnabledFeatures.h (233118 => 233119)


--- trunk/Source/WebCore/page/RuntimeEnabledFeatures.h	2018-06-23 01:31:42 UTC (rev 233118)
+++ trunk/Source/WebCore/page/RuntimeEnabledFeatures.h	2018-06-23 02:42:00 UTC (rev 233119)
@@ -194,7 +194,10 @@
 
     void setFetchAPIEnabled(bool isEnabled) { m_isFetchAPIEnabled = isEnabled; }
     bool fetchAPIEnabled() const { return m_isFetchAPIEnabled; }
-    
+
+    void setWebSocketEnabled(bool isEnabled) { m_isWebSocketEnabled = isEnabled; }
+    bool webSocketEnabled() const { return m_isWebSocketEnabled; }
+
 #if ENABLE(STREAMS_API)
     void setReadableByteStreamAPIEnabled(bool isEnabled) { m_isReadableByteStreamAPIEnabled = isEnabled; }
     bool readableByteStreamAPIEnabled() const { return m_isReadableByteStreamAPIEnabled; }
@@ -370,6 +373,8 @@
     bool m_isCacheAPIEnabled { false };
     bool m_isFetchAPIEnabled { true };
 
+    bool m_isWebSocketEnabled { true };
+
 #if ENABLE(DOWNLOAD_ATTRIBUTE)
     bool m_isDownloadAttributeEnabled { false };
 #endif
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to