Web Inspector: Should see active Web Sockets when opening Web Inspector
authordrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 2 Jun 2017 02:44:45 +0000 (02:44 +0000)
committerdrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 2 Jun 2017 02:44:45 +0000 (02:44 +0000)
commitd4fba8c84bd7e549ff2b89ccd362d56f725df443
tree6a3b0466bccffa44a6daee9beca14516c3394d84
parent2074f2fe5c4226f737ee53de3daa698b64adc8bb
Web Inspector: Should see active Web Sockets when opening Web Inspector
https://bugs.webkit.org/show_bug.cgi?id=172312

Reviewed by Joseph Pecoraro.

Source/WebCore:

Test: http/tests/websocket/tests/hybi/inspector/before-load.html

* Modules/websockets/WebSocket.h:
* Modules/websockets/WebSocket.cpp:
(WebCore::WebSocket::WebSocket):
(WebCore::WebSocket::~WebSocket):
(WebCore::WebSocket::allActiveWebSockets):
(WebCore::WebSocket::allActiveWebSocketsMutex):
(WebCore::WebSocket::channel):
(WebCore::WebSocket::eventTargetInterface):
Add a static set of all WebSocket objects and provide getters to access web socket metadata.

* Modules/websockets/ThreadableWebSocketChannel.h:
(WebCore::ThreadableWebSocketChannel::isWebSocketChannel):
* Modules/websockets/WebSocketChannel.h:
* Modules/websockets/WebSocketChannel.cpp:
(WebCore::WebSocketChannel::isWebSocketChannel):
(WebCore::WebSocketChannel::identifier):
(WebCore::WebSocketChannel::clientHandshakeRequest):
(WebCore::WebSocketChannel::serverHandshakeResponse):
(WebCore::WebSocketChannel::handshakeMode):
(WebCore::WebSocketChannel::isType):
Provide getters to access web socket metadata.

* inspector/InspectorNetworkAgent.cpp:
(WebCore::InspectorNetworkAgent::enable):
Loops over the static set of all WebSocket objects and sends events for each to the frontend.

Source/WebInspectorUI:

* UserInterface/Controllers/FrameResourceManager.js:
(WebInspector.FrameResourceManager.prototype.webSocketHandshakeResponseReceived):
(WebInspector.FrameResourceManager.prototype.initialize): Removed.
Rework order of agent enable calls to ensure that the main frame is initialized before any
websocket events are dispatched.

* UserInterface/Models/WebSocketResource.js:
(WebInspector.WebSocketResource.ReadyState):
Change symbol strings in enum for better printing in tests.

LayoutTests:

Test that WebSockets created before the inspector loads are also tracked.

* http/tests/websocket/tests/hybi/inspector/before-load-expected.txt: Added.
* http/tests/websocket/tests/hybi/inspector/before-load.html: Added.
* http/tests/websocket/tests/hybi/inspector/before-load_wsh.py: Added.
(web_socket_do_extra_handshake):
(web_socket_transfer_data):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@217691 268f45cc-cd09-0410-ab3c-d52691b4dbfc
14 files changed:
LayoutTests/ChangeLog
LayoutTests/http/tests/websocket/tests/hybi/inspector/before-load-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/websocket/tests/hybi/inspector/before-load.html [new file with mode: 0644]
LayoutTests/http/tests/websocket/tests/hybi/inspector/before-load_wsh.py [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/Modules/websockets/ThreadableWebSocketChannel.h
Source/WebCore/Modules/websockets/WebSocket.cpp
Source/WebCore/Modules/websockets/WebSocket.h
Source/WebCore/Modules/websockets/WebSocketChannel.cpp
Source/WebCore/Modules/websockets/WebSocketChannel.h
Source/WebCore/inspector/InspectorNetworkAgent.cpp
Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Controllers/FrameResourceManager.js
Source/WebInspectorUI/UserInterface/Models/WebSocketResource.js