Title: [256837] trunk
Revision
256837
Author
katherine_che...@apple.com
Date
2020-02-18 10:09:13 -0800 (Tue, 18 Feb 2020)

Log Message

Web socket loads should be captured for logging per-page prevalent domains
https://bugs.webkit.org/show_bug.cgi?id=207840
<rdar://problem/59511746>

Reviewed by Chris Dumez.

Source/WebCore:

Test: http/tests/websocket/web-socket-loads-captured-in-per-page-domains.html

Captures a domain connection via WebSocket to check if it should be
logged as a prevalent resource.

* Modules/websockets/WebSocket.cpp:
(WebCore::WebSocket::connect):

LayoutTests:

Resource load statistics is only supported on mac and iOS, we should
skip this on other platforms.

* http/tests/websocket/web-socket-loads-captured-in-per-page-domains-expected.txt: Added.
* http/tests/websocket/web-socket-loads-captured-in-per-page-domains.html: Added.
* platform/gtk/TestExpectations:
* platform/win/TestExpectations:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (256836 => 256837)


--- trunk/LayoutTests/ChangeLog	2020-02-18 17:46:05 UTC (rev 256836)
+++ trunk/LayoutTests/ChangeLog	2020-02-18 18:09:13 UTC (rev 256837)
@@ -1,3 +1,19 @@
+2020-02-18  Kate Cheney  <katherine_che...@apple.com>
+
+        Web socket loads should be captured for logging per-page prevalent domains
+        https://bugs.webkit.org/show_bug.cgi?id=207840
+        <rdar://problem/59511746>
+
+        Reviewed by Chris Dumez.
+
+        Resource load statistics is only supported on mac and iOS, we should
+        skip this on other platforms.
+
+        * http/tests/websocket/web-socket-loads-captured-in-per-page-domains-expected.txt: Added.
+        * http/tests/websocket/web-socket-loads-captured-in-per-page-domains.html: Added.
+        * platform/gtk/TestExpectations:
+        * platform/win/TestExpectations:
+
 2020-02-17  Dean Jackson  <d...@apple.com>
 
         [WebGL] Update WebGL2 results with ANGLE backend

Added: trunk/LayoutTests/http/tests/websocket/web-socket-loads-captured-in-per-page-domains-expected.txt (0 => 256837)


--- trunk/LayoutTests/http/tests/websocket/web-socket-loads-captured-in-per-page-domains-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/http/tests/websocket/web-socket-loads-captured-in-per-page-domains-expected.txt	2020-02-18 18:09:13 UTC (rev 256837)
@@ -0,0 +1,10 @@
+Ensure web socket loads are captured by per-page prevalent domain logging.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS Domain was successfully marked prevalent.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/http/tests/websocket/web-socket-loads-captured-in-per-page-domains.html (0 => 256837)


--- trunk/LayoutTests/http/tests/websocket/web-socket-loads-captured-in-per-page-domains.html	                        (rev 0)
+++ trunk/LayoutTests/http/tests/websocket/web-socket-loads-captured-in-per-page-domains.html	2020-02-18 18:09:13 UTC (rev 256837)
@@ -0,0 +1,39 @@
+<!DOCTYPE html>
+<head>
+    <script src=""
+    <script src=""
+</head>
+<body _onload_="runTest()">
+<script>
+    description('Ensure web socket loads are captured by per-page prevalent domain logging.');
+
+    window.jsTestIsAsync = true;
+    
+    if (window.testRunner)
+        testRunner.setAllowsAnySSLCertificate(true);
+
+    function askForPrevalentResources() {
+        testRunner.getPrevalentDomains(function (arrayOfDomains) {
+            if (arrayOfDomains.length == 0) {
+                askForPrevalentResources();
+                return;
+            }
+            if (arrayOfDomains.includes("localhost"))
+                testPassed("Domain was successfully marked prevalent.");
+            else
+                testFailed("Domain was not successfully marked prevalent.");
+            setEnableFeature(false, finishJSTest);
+        });
+    }
+
+    function runTest() {
+        setEnableFeature(true, function() {
+            testRunner.setStatisticsPrevalentResource("http://localhost", true, function () {
+                new WebSocket('ws://localhost:8880/websocket/tests/hybi/simple');
+                setTimeout(askForPrevalentResources, 0);
+            });
+        });
+    }
+</script>
+<script src=""
+</body>

Modified: trunk/LayoutTests/platform/gtk/TestExpectations (256836 => 256837)


--- trunk/LayoutTests/platform/gtk/TestExpectations	2020-02-18 17:46:05 UTC (rev 256836)
+++ trunk/LayoutTests/platform/gtk/TestExpectations	2020-02-18 18:09:13 UTC (rev 256837)
@@ -1184,6 +1184,7 @@
 
 # No support for resource load statistics yet
 http/tests/resourceLoadStatistics/ [ Skip ]
+http/tests/websocket/web-socket-loads-captured-in-per-page-domains.html [ Skip ]
 
 # No support for screen capture
 fast/mediastream/screencapture-user-gesture.html [ Skip ]

Modified: trunk/LayoutTests/platform/mac-wk1/TestExpectations (256836 => 256837)


--- trunk/LayoutTests/platform/mac-wk1/TestExpectations	2020-02-18 17:46:05 UTC (rev 256836)
+++ trunk/LayoutTests/platform/mac-wk1/TestExpectations	2020-02-18 18:09:13 UTC (rev 256837)
@@ -939,4 +939,5 @@
 
 webkit.org/b/207857 fast/canvas/webgl/texImage2D-mse-flipY-false.html [ Pass Timeout ]
 
-webkit.org/b/207891 imported/w3c/web-platform-tests/css/css-position/fixed-z-index-blend.html [ Pass Failure ]
\ No newline at end of file
+webkit.org/b/207891 imported/w3c/web-platform-tests/css/css-position/fixed-z-index-blend.html [ Pass Failure ]
+http/tests/websocket/web-socket-loads-captured-in-per-page-domains.html [ Skip ]

Modified: trunk/LayoutTests/platform/win/TestExpectations (256836 => 256837)


--- trunk/LayoutTests/platform/win/TestExpectations	2020-02-18 17:46:05 UTC (rev 256836)
+++ trunk/LayoutTests/platform/win/TestExpectations	2020-02-18 18:09:13 UTC (rev 256837)
@@ -111,6 +111,7 @@
 webkit.org/b/173281 editing/selection/selection-across-shadow-boundaries-readonly-3.html [ Skip ]
 webkit.org/b/173281 editing/selection/selection-across-shadow-boundaries-user-select-all-1.html [ Skip ]
 webkit.org/b/193748 http/tests/adClickAttribution [ Skip ]
+http/tests/websocket/web-socket-loads-captured-in-per-page-domains.html [ Skip ]
 
 # TODO HW filters not yet supported on Windows
 webkit.org/b/74716 css3/filters/effect-blur-hw.html [ Skip ]

Modified: trunk/Source/WebCore/ChangeLog (256836 => 256837)


--- trunk/Source/WebCore/ChangeLog	2020-02-18 17:46:05 UTC (rev 256836)
+++ trunk/Source/WebCore/ChangeLog	2020-02-18 18:09:13 UTC (rev 256837)
@@ -1,3 +1,19 @@
+2020-02-18  Kate Cheney  <katherine_che...@apple.com>
+
+        Web socket loads should be captured for logging per-page prevalent domains
+        https://bugs.webkit.org/show_bug.cgi?id=207840
+        <rdar://problem/59511746>
+
+        Reviewed by Chris Dumez.
+
+        Test: http/tests/websocket/web-socket-loads-captured-in-per-page-domains.html
+
+        Captures a domain connection via WebSocket to check if it should be
+        logged as a prevalent resource.
+
+        * Modules/websockets/WebSocket.cpp:
+        (WebCore::WebSocket::connect):
+
 2020-02-18  Simon Fraser  <simon.fra...@apple.com>
 
         Move from "layer flush" terminology to "rendering update"

Modified: trunk/Source/WebCore/Modules/websockets/WebSocket.cpp (256836 => 256837)


--- trunk/Source/WebCore/Modules/websockets/WebSocket.cpp	2020-02-18 17:46:05 UTC (rev 256836)
+++ trunk/Source/WebCore/Modules/websockets/WebSocket.cpp	2020-02-18 18:09:13 UTC (rev 256837)
@@ -42,6 +42,7 @@
 #include "EventNames.h"
 #include "Frame.h"
 #include "FrameLoader.h"
+#include "FrameLoaderClient.h"
 #include "Logging.h"
 #include "MessageEvent.h"
 #include "ResourceLoadObserver.h"
@@ -51,6 +52,7 @@
 #include "SocketProvider.h"
 #include "ThreadableWebSocketChannel.h"
 #include "WebSocketChannel.h"
+#include "WorkerLoaderProxy.h"
 #include <_javascript_Core/ArrayBuffer.h>
 #include <_javascript_Core/ArrayBufferView.h>
 #include <_javascript_Core/ScriptCallStack.h>
@@ -321,6 +323,17 @@
         return { };
     }
 
+#if ENABLE(RESOURCE_LOAD_STATISTICS)
+    auto reportRegistrableDomain = [url = "" context) {
+        if (auto* frame = downcast<Document>(context).frame())
+            frame->loader().client().addLoadedRegistrableDomain(RegistrableDomain(url));
+    };
+    if (is<Document>(context))
+        reportRegistrableDomain(context);
+    else
+        downcast<WorkerGlobalScope>(context).thread().workerLoaderProxy().postTaskToLoader(WTFMove(reportRegistrableDomain));
+#endif
+
     m_pendingActivity = makePendingActivity(*this);
 
     return { };
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to