Make ResourceLoadObserver::logWebSocketLoading() handle websockets in detached frames
authorwilander@apple.com <wilander@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 21 Aug 2018 18:02:33 +0000 (18:02 +0000)
committerwilander@apple.com <wilander@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 21 Aug 2018 18:02:33 +0000 (18:02 +0000)
commit5f0e27c75471fbf9ffc9980ea9e9391f398b6fa7
treeb9be96def33175d3bd386091bd5d859e5115c677
parent1e15de3d9f2acc456c805c9628ec085e8966a874
Make ResourceLoadObserver::logWebSocketLoading() handle websockets in detached frames
https://bugs.webkit.org/show_bug.cgi?id=188757
<rdar://problem/38713390>

Reviewed by Alex Christensen.

Source/WebCore:

Test: http/tests/websocket/construct-in-detached-frame-resource-load-statistics.html

* Modules/websockets/WebSocket.cpp:
(WebCore::WebSocket::connect):
    Now logs even when a frame doesn't exist.
* loader/ResourceLoadObserver.cpp:
(WebCore::ResourceLoadObserver::shouldLog const):
    Now takes boolean 'usesEphemeralSession' instead of a page to support logging when there is no page.
(WebCore::ResourceLoadObserver::logSubresourceLoading):
    Changed to send a boolean to ResourceLoadObserver::shouldLog().
(WebCore::ResourceLoadObserver::logWebSocketLoading):
    Changed to:
    - receive the main frame's URL and a boolean for ephemeral sessions instead of the Frame.
    - send a boolean to ResourceLoadObserver::shouldLog().
    - No longer call areDomainsAssociated(). It is being removed in https://bugs.webkit.org/show_bug.cgi?id=188756.
(WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
    Changed to send a boolean to ResourceLoadObserver::shouldLog().
* loader/ResourceLoadObserver.h:

Source/WebKit:

These changes are test infrastructure to support the new WebKitTestRunner
function isStatisticsRegisteredAsSubresourceUnder().

* UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
(WKWebsiteDataStoreIsStatisticsRegisteredAsSubresourceUnder):
* UIProcess/API/C/WKWebsiteDataStoreRef.h:
* UIProcess/ResourceLoadStatisticsMemoryStore.cpp:
(WebKit::ResourceLoadStatisticsMemoryStore::isRegisteredAsSubresourceUnder const):
* UIProcess/ResourceLoadStatisticsMemoryStore.h:
* UIProcess/WebResourceLoadStatisticsStore.cpp:
(WebKit::WebResourceLoadStatisticsStore::isRegisteredAsSubresourceUnder):
* UIProcess/WebResourceLoadStatisticsStore.h:

Tools:

These changes add the new WebKitTestRunner function
isStatisticsRegisteredAsSubresourceUnder().

* WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
* WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR::TestRunner::isStatisticsRegisteredAsSubresourceUnder):
* WebKitTestRunner/InjectedBundle/TestRunner.h:
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::isStatisticsRegisteredAsSubresourceUnder):
* WebKitTestRunner/TestController.h:
* WebKitTestRunner/TestInvocation.cpp:
(WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle):

LayoutTests:

* TestExpectations:
    Skipped the new test case since it is only supported on WebKit2.
* http/tests/websocket/construct-in-detached-frame-resource-load-statistics-expected.txt: Added.
* http/tests/websocket/construct-in-detached-frame-resource-load-statistics.html: Added.
* http/tests/websocket/resources/construct-in-detached-frame-resource-load-statistics.html: Added.
* platform/wk2/TestExpectations:
    Marked the new test case as [ Pass ].

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@235124 268f45cc-cd09-0410-ab3c-d52691b4dbfc
24 files changed:
LayoutTests/ChangeLog
LayoutTests/TestExpectations
LayoutTests/http/tests/websocket/construct-in-detached-frame-resource-load-statistics-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/websocket/construct-in-detached-frame-resource-load-statistics.html [new file with mode: 0644]
LayoutTests/http/tests/websocket/resources/construct-in-detached-frame-resource-load-statistics.html [new file with mode: 0644]
LayoutTests/platform/wk2/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/Modules/websockets/WebSocket.cpp
Source/WebCore/loader/ResourceLoadObserver.cpp
Source/WebCore/loader/ResourceLoadObserver.h
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.cpp
Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.h
Source/WebKit/UIProcess/ResourceLoadStatisticsMemoryStore.cpp
Source/WebKit/UIProcess/ResourceLoadStatisticsMemoryStore.h
Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp
Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.h
Tools/ChangeLog
Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl
Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp
Tools/WebKitTestRunner/InjectedBundle/TestRunner.h
Tools/WebKitTestRunner/TestController.cpp
Tools/WebKitTestRunner/TestController.h
Tools/WebKitTestRunner/TestInvocation.cpp