Title: [217694] trunk

Diff

Modified: trunk/LayoutTests/ChangeLog (217693 => 217694)


--- trunk/LayoutTests/ChangeLog	2017-06-02 04:14:40 UTC (rev 217693)
+++ trunk/LayoutTests/ChangeLog	2017-06-02 04:17:13 UTC (rev 217694)
@@ -1,3 +1,16 @@
+2017-06-01  Ryan Haddad  <[email protected]>
+
+        Unreviewed, rolling out r217691.
+
+        This change broke the Windows build.
+
+        Reverted changeset:
+
+        "Web Inspector: Should see active Web Sockets when opening Web
+        Inspector"
+        https://bugs.webkit.org/show_bug.cgi?id=172312
+        http://trac.webkit.org/changeset/217691
+
 2017-06-01  Devin Rousso  <[email protected]>
 
         Web Inspector: Should see active Web Sockets when opening Web Inspector

Deleted: trunk/LayoutTests/http/tests/websocket/tests/hybi/inspector/before-load-expected.txt (217693 => 217694)


--- trunk/LayoutTests/http/tests/websocket/tests/hybi/inspector/before-load-expected.txt	2017-06-02 04:14:40 UTC (rev 217693)
+++ trunk/LayoutTests/http/tests/websocket/tests/hybi/inspector/before-load-expected.txt	2017-06-02 04:17:13 UTC (rev 217694)
@@ -1,12 +0,0 @@
-Tests that WebSockets created before the inspector loads are also tracked.
-
-
-== Running test suite: WebSocket.BeforeLoad
--- Running test case: WebSocket.BeforeLoad
-PASS: Should have 1 WebSocketResource
-PASS: Resource should be a WebSocket.
-PASS: Resource URL should be "ws://127.0.0.1:8880/websocket/tests/hybi/inspector/before-load".
-PASS: Resource should have request headers.
-PASS: Resource should have response headers.
-Resource readyState should be Symbol(open).
-

Deleted: trunk/LayoutTests/http/tests/websocket/tests/hybi/inspector/before-load.html (217693 => 217694)


--- trunk/LayoutTests/http/tests/websocket/tests/hybi/inspector/before-load.html	2017-06-02 04:14:40 UTC (rev 217693)
+++ trunk/LayoutTests/http/tests/websocket/tests/hybi/inspector/before-load.html	2017-06-02 04:17:13 UTC (rev 217694)
@@ -1,74 +0,0 @@
-<!doctype html>
-<html>
-<head>
-<script src=""
-<script>
-function load()
-{
-    testRunner.waitUntilDone();
-
-    const url = ""
-    let webSocket = new WebSocket(url);
-    webSocket.addEventListener("open", (event) => {
-        // Only run the tests once the websocket has connected.
-        runTest();
-    });
-}
-
-function test()
-{
-    let suite = InspectorTest.createAsyncSuite("WebSocket.BeforeLoad");
-
-    function logReadyState(readyState) {
-        let readyStateString = "";
-
-        switch (readyState) {
-        case WebInspector.WebSocketResource.ReadyState.Closed:
-            readyStateString = "closed";
-            break;
-
-        case WebInspector.WebSocketResource.ReadyState.Connecting:
-            readyStateString = "connecting";
-            break;
-
-        case WebInspector.WebSocketResource.ReadyState.Open:
-            readyStateString = "open";
-            break;
-
-        }
-
-        InspectorTest.log(`Resource has readyState "${readyStateString}"`);
-    }
-
-    suite.addTestCase({
-        name: "WebSocket.BeforeLoad",
-        description: "Test that the existing websocket is sent to the frontend when it is first opened.",
-        test(resolve, reject) {
-            const url = ""
-            let webSocketResources = WebInspector.frameResourceManager.mainFrame.resourceCollectionForType(WebInspector.Resource.Type.WebSocket);
-            InspectorTest.expectEqual(webSocketResources.items.size, 1, "Should have 1 WebSocketResource");
-
-            let webSocketResource = webSocketResources.toArray()[0];
-            if (!webSocketResource) {
-                reject("Missing WebSocket resource.");
-                return;
-            }
-
-            InspectorTest.expectThat(webSocketResource instanceof WebInspector.WebSocketResource, "Resource should be a WebSocket.");
-            InspectorTest.expectEqual(webSocketResource.url, url, `Resource URL should be "${url}".`);
-            InspectorTest.expectThat(!isEmptyObject(webSocketResource.requestHeaders), "Resource should have request headers.");
-            InspectorTest.expectThat(!isEmptyObject(webSocketResource.responseHeaders), "Resource should have response headers.");
-            InspectorTest.log(`Resource readyState should be ${String(webSocketResource.readyState)}.`);
-
-            resolve();
-        }
-    });
-
-    suite.runTestCasesAndFinish();
-}
-</script>
-</head>
-<body _onload_="load()">
-<p>Tests that WebSockets created before the inspector loads are also tracked.</p>
-</body>
-</html>

Deleted: trunk/LayoutTests/http/tests/websocket/tests/hybi/inspector/before-load_wsh.py (217693 => 217694)


--- trunk/LayoutTests/http/tests/websocket/tests/hybi/inspector/before-load_wsh.py	2017-06-02 04:14:40 UTC (rev 217693)
+++ trunk/LayoutTests/http/tests/websocket/tests/hybi/inspector/before-load_wsh.py	2017-06-02 04:17:13 UTC (rev 217694)
@@ -1,11 +0,0 @@
-from mod_pywebsocket import msgutil
-
-
-def web_socket_do_extra_handshake(request):
-    pass # Always accept.
-
-
-def web_socket_transfer_data(request):
-    # Echo message back
-    message = msgutil.receive_message(request)
-    msgutil.send_message(request, message)

Modified: trunk/Source/WebCore/ChangeLog (217693 => 217694)


--- trunk/Source/WebCore/ChangeLog	2017-06-02 04:14:40 UTC (rev 217693)
+++ trunk/Source/WebCore/ChangeLog	2017-06-02 04:17:13 UTC (rev 217694)
@@ -1,3 +1,16 @@
+2017-06-01  Ryan Haddad  <[email protected]>
+
+        Unreviewed, rolling out r217691.
+
+        This change broke the Windows build.
+
+        Reverted changeset:
+
+        "Web Inspector: Should see active Web Sockets when opening Web
+        Inspector"
+        https://bugs.webkit.org/show_bug.cgi?id=172312
+        http://trac.webkit.org/changeset/217691
+
 2017-06-01  Joseph Pecoraro  <[email protected]>
 
         Unreviewed Windows build fix after r217691.

Modified: trunk/Source/WebCore/Modules/websockets/ThreadableWebSocketChannel.h (217693 => 217694)


--- trunk/Source/WebCore/Modules/websockets/ThreadableWebSocketChannel.h	2017-06-02 04:14:40 UTC (rev 217693)
+++ trunk/Source/WebCore/Modules/websockets/ThreadableWebSocketChannel.h	2017-06-02 04:17:13 UTC (rev 217694)
@@ -53,8 +53,6 @@
     static Ref<ThreadableWebSocketChannel> create(ScriptExecutionContext&, WebSocketChannelClient&, SocketProvider&);
     ThreadableWebSocketChannel() { }
 
-    virtual bool isWebSocketChannel() const { return false; }
-
     enum SendResult {
         SendSuccess,
         SendFail

Modified: trunk/Source/WebCore/Modules/websockets/WebSocket.cpp (217693 => 217694)


--- trunk/Source/WebCore/Modules/websockets/WebSocket.cpp	2017-06-02 04:14:40 UTC (rev 217693)
+++ trunk/Source/WebCore/Modules/websockets/WebSocket.cpp	2017-06-02 04:17:13 UTC (rev 217694)
@@ -58,7 +58,6 @@
 #include <runtime/ArrayBuffer.h>
 #include <runtime/ArrayBufferView.h>
 #include <wtf/HashSet.h>
-#include <wtf/NeverDestroyed.h>
 #include <wtf/RunLoop.h>
 #include <wtf/StdLibExtras.h>
 #include <wtf/text/CString.h>
@@ -152,19 +151,10 @@
     , m_extensions(emptyString())
     , m_resumeTimer(*this, &WebSocket::resumeTimerFired)
 {
-    LockHolder lock(allActiveWebSocketsMutex());
-
-    allActiveWebSockets(lock).add(this);
 }
 
 WebSocket::~WebSocket()
 {
-    {
-        LockHolder lock(allActiveWebSocketsMutex());
-
-        allActiveWebSockets(lock).remove(this);
-    }
-
     if (m_channel)
         m_channel->disconnect();
 }
@@ -194,18 +184,6 @@
     return create(context, url, Vector<String> { 1, protocol });
 }
 
-HashSet<WebSocket*>& WebSocket::allActiveWebSockets(const LockHolder&)
-{
-    static NeverDestroyed<HashSet<WebSocket*>> activeWebSockets;
-    return activeWebSockets;
-}
-
-StaticLock& WebSocket::allActiveWebSocketsMutex()
-{
-    static StaticLock mutex;
-    return mutex;
-}
-
 ExceptionOr<void> WebSocket::connect(const String& url)
 {
     return connect(url, Vector<String> { });
@@ -429,11 +407,6 @@
     return { };
 }
 
-RefPtr<ThreadableWebSocketChannel> WebSocket::channel() const
-{
-    return m_channel;
-}
-
 const URL& WebSocket::url() const
 {
     return m_url;

Modified: trunk/Source/WebCore/Modules/websockets/WebSocket.h (217693 => 217694)


--- trunk/Source/WebCore/Modules/websockets/WebSocket.h	2017-06-02 04:14:40 UTC (rev 217693)
+++ trunk/Source/WebCore/Modules/websockets/WebSocket.h	2017-06-02 04:17:13 UTC (rev 217694)
@@ -39,8 +39,6 @@
 #include "URL.h"
 #include "WebSocketChannelClient.h"
 #include <wtf/Deque.h>
-#include <wtf/HashSet.h>
-#include <wtf/Lock.h>
 
 namespace JSC {
 class ArrayBuffer;
@@ -64,9 +62,6 @@
     static ExceptionOr<Ref<WebSocket>> create(ScriptExecutionContext&, const String& url, const Vector<String>& protocols);
     virtual ~WebSocket();
 
-    static HashSet<WebSocket*>& allActiveWebSockets(const LockHolder&);
-    static StaticLock& allActiveWebSocketsMutex();
-
     enum State {
         CONNECTING = 0,
         OPEN = 1,
@@ -85,8 +80,6 @@
 
     ExceptionOr<void> close(std::optional<unsigned short> code, const String& reason);
 
-    RefPtr<ThreadableWebSocketChannel> channel() const;
-
     const URL& url() const;
     State readyState() const;
     unsigned bufferedAmount() const;
@@ -97,8 +90,6 @@
     String binaryType() const;
     ExceptionOr<void> setBinaryType(const String&);
 
-    ScriptExecutionContext* scriptExecutionContext() const final;
-
     using RefCounted::ref;
     using RefCounted::deref;
 
@@ -117,6 +108,7 @@
     const char* activeDOMObjectName() const final;
 
     EventTargetInterface eventTargetInterface() const final;
+    ScriptExecutionContext* scriptExecutionContext() const final;
 
     void refEventTarget() final { ref(); }
     void derefEventTarget() final { deref(); }

Modified: trunk/Source/WebCore/Modules/websockets/WebSocketChannel.cpp (217693 => 217694)


--- trunk/Source/WebCore/Modules/websockets/WebSocketChannel.cpp	2017-06-02 04:14:40 UTC (rev 217693)
+++ trunk/Source/WebCore/Modules/websockets/WebSocketChannel.cpp	2017-06-02 04:17:13 UTC (rev 217694)
@@ -831,21 +831,6 @@
     m_handle->sendData(frameData.data(), frameData.size(), WTFMove(completionHandler));
 }
 
-ResourceRequest WebSocketChannel::clientHandshakeRequest() const
-{
-    return m_handshake->clientHandshakeRequest();
-}
-
-const ResourceResponse& WebSocketChannel::serverHandshakeResponse() const
-{
-    return m_handshake->serverHandshakeResponse();
-}
-
-WebSocketHandshake::Mode WebSocketChannel::handshakeMode() const
-{
-    return m_handshake->mode();
-}
-
 }  // namespace WebCore
 
 #endif  // ENABLE(WEB_SOCKETS)

Modified: trunk/Source/WebCore/Modules/websockets/WebSocketChannel.h (217693 => 217694)


--- trunk/Source/WebCore/Modules/websockets/WebSocketChannel.h	2017-06-02 04:14:40 UTC (rev 217693)
+++ trunk/Source/WebCore/Modules/websockets/WebSocketChannel.h	2017-06-02 04:17:13 UTC (rev 217694)
@@ -38,11 +38,9 @@
 #include "Timer.h"
 #include "WebSocketDeflateFramer.h"
 #include "WebSocketFrame.h"
-#include "WebSocketHandshake.h"
 #include <wtf/Deque.h>
 #include <wtf/Forward.h>
 #include <wtf/RefCounted.h>
-#include <wtf/TypeCasts.h>
 #include <wtf/Vector.h>
 #include <wtf/text/CString.h>
 
@@ -51,12 +49,11 @@
 class Blob;
 class Document;
 class FileReaderLoader;
-class ResourceRequest;
-class ResourceResponse;
 class SocketProvider;
 class SocketStreamHandle;
 class SocketStreamError;
 class WebSocketChannelClient;
+class WebSocketHandshake;
 
 class WebSocketChannel : public RefCounted<WebSocketChannel>, public SocketStreamHandleClient, public ThreadableWebSocketChannel, public FileReaderLoaderClient
 {
@@ -65,8 +62,6 @@
     static Ref<WebSocketChannel> create(Document& document, WebSocketChannelClient& client, SocketProvider& provider) { return adoptRef(*new WebSocketChannel(document, client, provider)); }
     virtual ~WebSocketChannel();
 
-    bool isWebSocketChannel() const final { return true; }
-
     bool send(const char* data, int length);
 
     // ThreadableWebSocketChannel functions.
@@ -117,11 +112,6 @@
     void didFinishLoading() override;
     void didFail(int errorCode) override;
 
-    unsigned identifier() const { return m_identifier; }
-    ResourceRequest clientHandshakeRequest() const;
-    const ResourceResponse& serverHandshakeResponse() const;
-    WebSocketHandshake::Mode handshakeMode() const;
-
     using RefCounted<WebSocketChannel>::ref;
     using RefCounted<WebSocketChannel>::deref;
 
@@ -229,8 +219,4 @@
 
 } // namespace WebCore
 
-SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::WebSocketChannel)
-    static bool isType(const WebCore::ThreadableWebSocketChannel& threadableWebSocketChannel) { return threadableWebSocketChannel.isWebSocketChannel(); }
-SPECIALIZE_TYPE_TRAITS_END()
-
 #endif // ENABLE(WEB_SOCKETS)

Modified: trunk/Source/WebCore/inspector/InspectorNetworkAgent.cpp (217693 => 217694)


--- trunk/Source/WebCore/inspector/InspectorNetworkAgent.cpp	2017-06-02 04:14:40 UTC (rev 217693)
+++ trunk/Source/WebCore/inspector/InspectorNetworkAgent.cpp	2017-06-02 04:17:13 UTC (rev 217694)
@@ -60,8 +60,6 @@
 #include "SubresourceLoader.h"
 #include "ThreadableLoaderClient.h"
 #include "URL.h"
-#include "WebSocket.h"
-#include "WebSocketChannel.h"
 #include "WebSocketFrame.h"
 #include <inspector/ContentSearchUtilities.h>
 #include <inspector/IdentifiersFactory.h>
@@ -69,7 +67,6 @@
 #include <inspector/InspectorValues.h>
 #include <inspector/ScriptCallStack.h>
 #include <inspector/ScriptCallStackFactory.h>
-#include <wtf/Lock.h>
 #include <wtf/RefPtr.h>
 #include <wtf/Stopwatch.h>
 #include <wtf/text/StringBuilder.h>
@@ -658,31 +655,6 @@
 {
     m_enabled = true;
     m_instrumentingAgents.setInspectorNetworkAgent(this);
-
-    LockHolder lock(WebSocket::allActiveWebSocketsMutex());
-
-    for (WebSocket* webSocket : WebSocket::allActiveWebSockets(lock)) {
-        if (!is<Document>(webSocket->scriptExecutionContext()) || !is<WebSocketChannel>(webSocket->channel().get()))
-            continue;
-
-        Document* document = downcast<Document>(webSocket->scriptExecutionContext());
-        if (document->page() != &m_pageAgent->page())
-            continue;
-
-        WebSocketChannel* channel = downcast<WebSocketChannel>(webSocket->channel().get());
-        if (!channel)
-            continue;
-
-        unsigned identifier = channel->identifier();
-        didCreateWebSocket(identifier, webSocket->url());
-        willSendWebSocketHandshakeRequest(identifier, channel->clientHandshakeRequest());
-
-        if (channel->handshakeMode() == WebSocketHandshake::Connected)
-            didReceiveWebSocketHandshakeResponse(identifier, channel->serverHandshakeResponse());
-
-        if (webSocket->readyState() == WebSocket::CLOSED)
-            didCloseWebSocket(identifier);
-    }
 }
 
 void InspectorNetworkAgent::disable(ErrorString&)

Modified: trunk/Source/WebInspectorUI/ChangeLog (217693 => 217694)


--- trunk/Source/WebInspectorUI/ChangeLog	2017-06-02 04:14:40 UTC (rev 217693)
+++ trunk/Source/WebInspectorUI/ChangeLog	2017-06-02 04:17:13 UTC (rev 217694)
@@ -1,3 +1,16 @@
+2017-06-01  Ryan Haddad  <[email protected]>
+
+        Unreviewed, rolling out r217691.
+
+        This change broke the Windows build.
+
+        Reverted changeset:
+
+        "Web Inspector: Should see active Web Sockets when opening Web
+        Inspector"
+        https://bugs.webkit.org/show_bug.cgi?id=172312
+        http://trac.webkit.org/changeset/217691
+
 2017-06-01  Devin Rousso  <[email protected]>
 
         Web Inspector: Should see active Web Sockets when opening Web Inspector

Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/FrameResourceManager.js (217693 => 217694)


--- trunk/Source/WebInspectorUI/UserInterface/Controllers/FrameResourceManager.js	2017-06-02 04:14:40 UTC (rev 217693)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/FrameResourceManager.js	2017-06-02 04:17:13 UTC (rev 217694)
@@ -29,6 +29,22 @@
     {
         super();
 
+        if (window.PageAgent)
+            PageAgent.enable();
+        if (window.NetworkAgent)
+            NetworkAgent.enable();
+
+        WebInspector.notifications.addEventListener(WebInspector.Notification.ExtraDomainsActivated, this._extraDomainsActivated, this);
+
+        this.initialize();
+    }
+
+    // Public
+
+    initialize()
+    {
+        var oldMainFrame = this._mainFrame;
+
         this._frameIdentifierMap = new Map;
         this._mainFrame = null;
         this._resourceRequestIdentifierMap = new Map;
@@ -35,21 +51,14 @@
         this._orphanedResources = new Map;
         this._webSocketIdentifierToURL = new Map;
 
+        if (this._mainFrame !== oldMainFrame)
+            this._mainFrameDidChange(oldMainFrame);
+
         this._waitingForMainFrameResourceTreePayload = true;
-
-        if (window.PageAgent) {
-            PageAgent.enable();
+        if (window.PageAgent)
             PageAgent.getResourceTree(this._processMainFrameResourceTreePayload.bind(this));
-        }
-
-        if (window.NetworkAgent)
-            NetworkAgent.enable();
-
-        WebInspector.notifications.addEventListener(WebInspector.Notification.ExtraDomainsActivated, this._extraDomainsActivated, this);
     }
 
-    // Public
-
     get mainFrame()
     {
         return this._mainFrame;
@@ -237,13 +246,12 @@
         resource.readyState = WebInspector.WebSocketResource.ReadyState.Open;
 
         let elapsedTime = WebInspector.timelineManager.computeElapsedTime(timestamp);
+        resource.markAsFinished(elapsedTime);
 
         // FIXME: <webkit.org/b/169166> Web Inspector: WebSockets: Implement timing information
         let responseTiming = response.timing || null;
 
         resource.updateForResponse(resource.url, resource.mimeType, resource.type, response.headers, response.status, response.statusText, elapsedTime, responseTiming);
-
-        resource.markAsFinished(elapsedTime);
     }
 
     webSocketFrameReceived(requestId, timestamp, response)

Modified: trunk/Source/WebInspectorUI/UserInterface/Models/WebSocketResource.js (217693 => 217694)


--- trunk/Source/WebInspectorUI/UserInterface/Models/WebSocketResource.js	2017-06-02 04:14:40 UTC (rev 217693)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/WebSocketResource.js	2017-06-02 04:17:13 UTC (rev 217694)
@@ -95,9 +95,9 @@
 };
 
 WebInspector.WebSocketResource.ReadyState = {
-    Closed: Symbol("closed"),
-    Connecting: Symbol("connecting"),
-    Open: Symbol("open"),
+    Closed: Symbol("web-socket-ready-state-closed"),
+    Connecting: Symbol("web-socket-ready-state-connecting"),
+    Open: Symbol("web-socket-ready-state-open"),
 };
 
 WebInspector.WebSocketResource.OpCodes = {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to