Diff
Modified: trunk/LayoutTests/ChangeLog (217911 => 217912)
--- trunk/LayoutTests/ChangeLog 2017-06-07 23:53:10 UTC (rev 217911)
+++ trunk/LayoutTests/ChangeLog 2017-06-08 00:05:55 UTC (rev 217912)
@@ -1,5 +1,27 @@
2017-06-07 Devin Rousso <[email protected]>
+ Web Inspector: Add ContextMenu item to log WebSocket object to console
+ https://bugs.webkit.org/show_bug.cgi?id=172878
+
+ Reviewed by Joseph Pecoraro.
+
+ * http/tests/websocket/tests/hybi/inspector/resolveWebSocket-expected.txt: Added.
+ * http/tests/websocket/tests/hybi/inspector/resolveWebSocket.html: Added.
+
+ * http/tests/websocket/tests/hybi/inspector/before-load-expected.txt:
+ * http/tests/websocket/tests/hybi/inspector/before-load.html:
+ * http/tests/websocket/tests/hybi/inspector/before-load_wsh.py: Removed.
+ * http/tests/websocket/tests/hybi/inspector/client-close.html:
+ * http/tests/websocket/tests/hybi/inspector/client-close_wsh.py: Removed.
+ * http/tests/websocket/tests/hybi/inspector/send-and-receive.html:
+ * http/tests/websocket/tests/hybi/inspector/send-and-receive_wsh.py: Removed.
+ * http/tests/websocket/tests/hybi/inspector/echo.py: Added.
+ (web_socket_do_extra_handshake):
+ (web_socket_transfer_data):
+ Unified common configurations for Inspector WebSocket tests.
+
+2017-06-07 Devin Rousso <[email protected]>
+
Web Inspector: Allow user to choose stylesheet when creating new rules
https://bugs.webkit.org/show_bug.cgi?id=172487
Modified: trunk/LayoutTests/http/tests/websocket/tests/hybi/inspector/before-load-expected.txt (217911 => 217912)
--- trunk/LayoutTests/http/tests/websocket/tests/hybi/inspector/before-load-expected.txt 2017-06-07 23:53:10 UTC (rev 217911)
+++ trunk/LayoutTests/http/tests/websocket/tests/hybi/inspector/before-load-expected.txt 2017-06-08 00:05:55 UTC (rev 217912)
@@ -5,7 +5,7 @@
-- 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 URL should be "ws://127.0.0.1:8880/websocket/tests/hybi/inspector/echo".
PASS: Resource should have request headers.
PASS: Resource should have response headers.
Resource readyState should be Symbol(open).
Modified: trunk/LayoutTests/http/tests/websocket/tests/hybi/inspector/before-load.html (217911 => 217912)
--- trunk/LayoutTests/http/tests/websocket/tests/hybi/inspector/before-load.html 2017-06-07 23:53:10 UTC (rev 217911)
+++ trunk/LayoutTests/http/tests/websocket/tests/hybi/inspector/before-load.html 2017-06-08 00:05:55 UTC (rev 217912)
@@ -7,7 +7,7 @@
{
testRunner.waitUntilDone();
- const url = ""
+ const url = ""
let webSocket = new WebSocket(url);
webSocket.addEventListener("open", (event) => {
// Only run the tests once the websocket has connected.
@@ -44,7 +44,7 @@
name: "WebSocket.BeforeLoad",
description: "Test that the existing websocket is sent to the frontend when it is first opened.",
test(resolve, reject) {
- const url = ""
+ const url = ""
let webSocketResources = WebInspector.frameResourceManager.mainFrame.resourceCollectionForType(WebInspector.Resource.Type.WebSocket);
InspectorTest.expectEqual(webSocketResources.items.size, 1, "Should have 1 WebSocketResource");
Deleted: trunk/LayoutTests/http/tests/websocket/tests/hybi/inspector/before-load_wsh.py (217911 => 217912)
--- trunk/LayoutTests/http/tests/websocket/tests/hybi/inspector/before-load_wsh.py 2017-06-07 23:53:10 UTC (rev 217911)
+++ trunk/LayoutTests/http/tests/websocket/tests/hybi/inspector/before-load_wsh.py 2017-06-08 00:05:55 UTC (rev 217912)
@@ -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/LayoutTests/http/tests/websocket/tests/hybi/inspector/client-close.html (217911 => 217912)
--- trunk/LayoutTests/http/tests/websocket/tests/hybi/inspector/client-close.html 2017-06-07 23:53:10 UTC (rev 217911)
+++ trunk/LayoutTests/http/tests/websocket/tests/hybi/inspector/client-close.html 2017-06-08 00:05:55 UTC (rev 217912)
@@ -5,7 +5,7 @@
<script>
function createWebSocketConnection()
{
- let webSocket = new WebSocket("ws://127.0.0.1:8880/websocket/tests/hybi/inspector/client-close");
+ let webSocket = new WebSocket("ws://127.0.0.1:8880/websocket/tests/hybi/inspector/echo");
webSocket._onopen_ = function()
{
Deleted: trunk/LayoutTests/http/tests/websocket/tests/hybi/inspector/client-close_wsh.py (217911 => 217912)
--- trunk/LayoutTests/http/tests/websocket/tests/hybi/inspector/client-close_wsh.py 2017-06-07 23:53:10 UTC (rev 217911)
+++ trunk/LayoutTests/http/tests/websocket/tests/hybi/inspector/client-close_wsh.py 2017-06-08 00:05:55 UTC (rev 217912)
@@ -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)
Copied: trunk/LayoutTests/http/tests/websocket/tests/hybi/inspector/echo_wsh.py (from rev 217911, trunk/LayoutTests/http/tests/websocket/tests/hybi/inspector/send-and-receive_wsh.py) (0 => 217912)
--- trunk/LayoutTests/http/tests/websocket/tests/hybi/inspector/echo_wsh.py (rev 0)
+++ trunk/LayoutTests/http/tests/websocket/tests/hybi/inspector/echo_wsh.py 2017-06-08 00:05:55 UTC (rev 217912)
@@ -0,0 +1,11 @@
+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)
Added: trunk/LayoutTests/http/tests/websocket/tests/hybi/inspector/resolveWebSocket-expected.txt (0 => 217912)
--- trunk/LayoutTests/http/tests/websocket/tests/hybi/inspector/resolveWebSocket-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/websocket/tests/hybi/inspector/resolveWebSocket-expected.txt 2017-06-08 00:05:55 UTC (rev 217912)
@@ -0,0 +1,13 @@
+Tests for the Network.resolveWebSocket command.
+
+
+== Running test suite: Network.resolveWebSocket
+-- Running test case: Network.resolveWebSocket.validRequestIdentifier
+PASS: Payload should have type "object".
+PASS: Payload should have className "WebSocket".
+PASS: Payload should have description "WebSocket".
+
+-- Running test case: Network.resolveWebSocket.invalidRequestIdentifier
+PASS: Should produce an error.
+Error: WebSocket not found
+
Added: trunk/LayoutTests/http/tests/websocket/tests/hybi/inspector/resolveWebSocket.html (0 => 217912)
--- trunk/LayoutTests/http/tests/websocket/tests/hybi/inspector/resolveWebSocket.html (rev 0)
+++ trunk/LayoutTests/http/tests/websocket/tests/hybi/inspector/resolveWebSocket.html 2017-06-08 00:05:55 UTC (rev 217912)
@@ -0,0 +1,71 @@
+<!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("Network.resolveWebSocket");
+
+ suite.addTestCase({
+ name: "Network.resolveWebSocket.validRequestIdentifier",
+ description: "Should return a valid response for the given request identifier.",
+ test(resolve, reject) {
+ const url = ""
+ let webSocketResource = WebInspector.frameResourceManager.resourceForURL(url);
+ if (!webSocketResource) {
+ reject("Missing WebSocket resource.");
+ return;
+ }
+
+ const objectGroup = "test";
+ NetworkAgent.resolveWebSocket(webSocketResource.requestIdentifier, objectGroup, (error, object) => {
+ if (error) {
+ reject(error);
+ return;
+ }
+
+ InspectorTest.expectEqual(object.type, "object", "Payload should have type \"object\".");
+ InspectorTest.expectEqual(object.className, "WebSocket", "Payload should have className \"WebSocket\".");
+ InspectorTest.expectEqual(object.description, "WebSocket", "Payload should have description \"WebSocket\".");
+ resolve();
+ });
+ }
+ });
+
+ // ------
+
+ suite.addTestCase({
+ name: "Network.resolveWebSocket.invalidRequestIdentifier",
+ description: "Invalid request identifiers should cause an error.",
+ test(resolve, reject) {
+ const requestIdentifier = "DOES_NOT_EXIST";
+ const objectGroup = "test";
+ NetworkAgent.resolveWebSocket(requestIdentifier, objectGroup, (error) => {
+ InspectorTest.expectThat(error, "Should produce an error.");
+ InspectorTest.log("Error: " + error);
+ resolve();
+ });
+ }
+ });
+
+ suite.runTestCasesAndFinish();
+}
+</script>
+</head>
+<body _onload_="load()">
+<p>Tests for the Network.resolveWebSocket command.</p>
+</body>
+</html>
Modified: trunk/LayoutTests/http/tests/websocket/tests/hybi/inspector/send-and-receive.html (217911 => 217912)
--- trunk/LayoutTests/http/tests/websocket/tests/hybi/inspector/send-and-receive.html 2017-06-07 23:53:10 UTC (rev 217911)
+++ trunk/LayoutTests/http/tests/websocket/tests/hybi/inspector/send-and-receive.html 2017-06-08 00:05:55 UTC (rev 217912)
@@ -9,7 +9,7 @@
function createWebSocketConnection()
{
- webSocket = new WebSocket("ws://127.0.0.1:8880/websocket/tests/hybi/inspector/send-and-receive");
+ webSocket = new WebSocket("ws://127.0.0.1:8880/websocket/tests/hybi/inspector/echo");
webSocket._onopen_ = function()
{
Deleted: trunk/LayoutTests/http/tests/websocket/tests/hybi/inspector/send-and-receive_wsh.py (217911 => 217912)
--- trunk/LayoutTests/http/tests/websocket/tests/hybi/inspector/send-and-receive_wsh.py 2017-06-07 23:53:10 UTC (rev 217911)
+++ trunk/LayoutTests/http/tests/websocket/tests/hybi/inspector/send-and-receive_wsh.py 2017-06-08 00:05:55 UTC (rev 217912)
@@ -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/_javascript_Core/ChangeLog (217911 => 217912)
--- trunk/Source/_javascript_Core/ChangeLog 2017-06-07 23:53:10 UTC (rev 217911)
+++ trunk/Source/_javascript_Core/ChangeLog 2017-06-08 00:05:55 UTC (rev 217912)
@@ -1,3 +1,13 @@
+2017-06-07 Devin Rousso <[email protected]>
+
+ Web Inspector: Add ContextMenu item to log WebSocket object to console
+ https://bugs.webkit.org/show_bug.cgi?id=172878
+
+ Reviewed by Joseph Pecoraro.
+
+ * inspector/protocol/Network.json:
+ Add resolveWebSocket command.
+
2017-06-07 Jon Davis <[email protected]>
Update feature status for features Supported In Preview
Modified: trunk/Source/_javascript_Core/inspector/protocol/Network.json (217911 => 217912)
--- trunk/Source/_javascript_Core/inspector/protocol/Network.json 2017-06-07 23:53:10 UTC (rev 217911)
+++ trunk/Source/_javascript_Core/inspector/protocol/Network.json 2017-06-08 00:05:55 UTC (rev 217912)
@@ -193,6 +193,17 @@
{ "name": "status", "type": "number", "description": "HTTP response status code." }
],
"description": "Loads a resource in the context of a frame on the inspected page without cross origin checks."
+ },
+ {
+ "name": "resolveWebSocket",
+ "description": "Resolves _javascript_ WebSocket object for given request id.",
+ "parameters": [
+ { "name": "requestId", "$ref": "RequestId", "description": "Identifier of the WebSocket resource to resolve." },
+ { "name": "objectGroup", "type": "string", "optional": true, "description": "Symbolic group name that can be used to release multiple objects." }
+ ],
+ "returns": [
+ { "name": "object", "$ref": "Runtime.RemoteObject", "description": "_javascript_ object wrapper for given node." }
+ ]
}
],
"events": [
Modified: trunk/Source/WebCore/ChangeLog (217911 => 217912)
--- trunk/Source/WebCore/ChangeLog 2017-06-07 23:53:10 UTC (rev 217911)
+++ trunk/Source/WebCore/ChangeLog 2017-06-08 00:05:55 UTC (rev 217912)
@@ -1,5 +1,23 @@
2017-06-07 Devin Rousso <[email protected]>
+ Web Inspector: Add ContextMenu item to log WebSocket object to console
+ https://bugs.webkit.org/show_bug.cgi?id=172878
+
+ Reviewed by Joseph Pecoraro.
+
+ Test: http/tests/websocket/tests/hybi/inspector/resolveWebSocket.html
+
+ * inspector/InspectorNetworkAgent.h:
+ * inspector/InspectorNetworkAgent.cpp:
+ (WebCore::InspectorNetworkAgent::InspectorNetworkAgent):
+ (WebCore::InspectorNetworkAgent::webSocketForRequestId):
+ (WebCore::webSocketAsScriptValue):
+ (WebCore::InspectorNetworkAgent::resolveWebSocket):
+ Loops over the static allActiveWebSockets to find one with the given requestId. If found, it
+ will create a RemoteObject wrapper for it and send it back to the inspector.
+
+2017-06-07 Devin Rousso <[email protected]>
+
Web Inspector: Allow user to choose stylesheet when creating new rules
https://bugs.webkit.org/show_bug.cgi?id=172487
Modified: trunk/Source/WebCore/inspector/InspectorNetworkAgent.cpp (217911 => 217912)
--- trunk/Source/WebCore/inspector/InspectorNetworkAgent.cpp 2017-06-07 23:53:10 UTC (rev 217911)
+++ trunk/Source/WebCore/inspector/InspectorNetworkAgent.cpp 2017-06-08 00:05:55 UTC (rev 217912)
@@ -48,6 +48,7 @@
#include "InspectorTimelineAgent.h"
#include "InstrumentingAgents.h"
#include "JSMainThreadExecState.h"
+#include "JSWebSocket.h"
#include "MemoryCache.h"
#include "NetworkResourcesData.h"
#include "Page.h"
@@ -56,6 +57,7 @@
#include "ResourceLoader.h"
#include "ResourceRequest.h"
#include "ResourceResponse.h"
+#include "ScriptState.h"
#include "ScriptableDocumentParser.h"
#include "SubresourceLoader.h"
#include "ThreadableLoaderClient.h"
@@ -65,10 +67,13 @@
#include "WebSocketFrame.h"
#include <inspector/ContentSearchUtilities.h>
#include <inspector/IdentifiersFactory.h>
+#include <inspector/InjectedScript.h>
+#include <inspector/InjectedScriptManager.h>
#include <inspector/InspectorFrontendRouter.h>
#include <inspector/InspectorValues.h>
#include <inspector/ScriptCallStack.h>
#include <inspector/ScriptCallStackFactory.h>
+#include <runtime/JSCInlines.h>
#include <wtf/Lock.h>
#include <wtf/RefPtr.h>
#include <wtf/Stopwatch.h>
@@ -158,6 +163,7 @@
: InspectorAgentBase(ASCIILiteral("Network"), context)
, m_frontendDispatcher(std::make_unique<Inspector::NetworkFrontendDispatcher>(context.frontendRouter))
, m_backendDispatcher(Inspector::NetworkBackendDispatcher::create(context.backendDispatcher, this))
+ , m_injectedScriptManager(context.injectedScriptManager)
, m_pageAgent(pageAgent)
, m_resourcesData(std::make_unique<NetworkResourcesData>())
{
@@ -779,6 +785,69 @@
inspectorThreadableLoaderClient->setLoader(WTFMove(loader));
}
+#if ENABLE(WEB_SOCKETS)
+
+WebSocket* InspectorNetworkAgent::webSocketForRequestId(const String& requestId)
+{
+ LockHolder lock(WebSocket::allActiveWebSocketsMutex());
+
+ for (WebSocket* webSocket : WebSocket::allActiveWebSockets(lock)) {
+ if (!is<WebSocketChannel>(webSocket->channel().get()))
+ continue;
+
+ WebSocketChannel* channel = downcast<WebSocketChannel>(webSocket->channel().get());
+ if (!channel)
+ continue;
+
+ if (IdentifiersFactory::requestId(channel->identifier()) != requestId)
+ continue;
+
+ // FIXME: <webkit.org/b/168475> Web Inspector: Correctly display iframe's and worker's WebSockets
+ if (!is<Document>(webSocket->scriptExecutionContext()))
+ continue;
+
+ Document* document = downcast<Document>(webSocket->scriptExecutionContext());
+ if (document->page() != &m_pageAgent->page())
+ continue;
+
+ return webSocket;
+ }
+
+ return nullptr;
+}
+
+static JSC::JSValue webSocketAsScriptValue(JSC::ExecState& state, WebSocket* webSocket)
+{
+ JSC::JSLockHolder lock(&state);
+ return toJS(&state, deprecatedGlobalObjectForPrototype(&state), webSocket);
+}
+
+void InspectorNetworkAgent::resolveWebSocket(ErrorString& errorString, const String& requestId, const String* const objectGroup, RefPtr<Inspector::Protocol::Runtime::RemoteObject>& result)
+{
+ WebSocket* webSocket = webSocketForRequestId(requestId);
+ if (!webSocket) {
+ errorString = ASCIILiteral("WebSocket not found");
+ return;
+ }
+
+ // FIXME: <webkit.org/b/168475> Web Inspector: Correctly display iframe's and worker's WebSockets
+ Document* document = downcast<Document>(webSocket->scriptExecutionContext());
+ Frame* frame = document->frame();
+ if (!frame) {
+ errorString = ASCIILiteral("WebSocket belongs to document without a frame");
+ return;
+ }
+
+ auto& state = *mainWorldExecState(frame);
+ auto injectedScript = m_injectedScriptManager.injectedScriptFor(&state);
+ ASSERT(!injectedScript.hasNoValue());
+
+ String objectGroupName = objectGroup ? *objectGroup : String();
+ result = injectedScript.wrapObject(webSocketAsScriptValue(state, webSocket), objectGroupName);
+}
+
+#endif // ENABLE(WEB_SOCKETS)
+
static Ref<Inspector::Protocol::Page::SearchResult> buildObjectForSearchResult(const String& requestId, const String& frameId, const String& url, int matchesCount)
{
auto searchResult = Inspector::Protocol::Page::SearchResult::create()
Modified: trunk/Source/WebCore/inspector/InspectorNetworkAgent.h (217911 => 217912)
--- trunk/Source/WebCore/inspector/InspectorNetworkAgent.h 2017-06-07 23:53:10 UTC (rev 217911)
+++ trunk/Source/WebCore/inspector/InspectorNetworkAgent.h 2017-06-08 00:05:55 UTC (rev 217912)
@@ -40,6 +40,7 @@
namespace Inspector {
class InspectorObject;
+class InjectedScriptManager;
}
namespace WebCore {
@@ -58,6 +59,7 @@
class URL;
#if ENABLE(WEB_SOCKETS)
+class WebSocket;
struct WebSocketFrame;
#endif
@@ -112,10 +114,17 @@
void getResponseBody(ErrorString&, const String& requestId, String* content, bool* base64Encoded) override;
void setResourceCachingDisabled(ErrorString&, bool disabled) override;
void loadResource(ErrorString&, const String& frameId, const String& url, Ref<LoadResourceCallback>&&) override;
+#if ENABLE(WEB_SOCKETS)
+ void resolveWebSocket(ErrorString&, const String& requestId, const String* const objectGroup, RefPtr<Inspector::Protocol::Runtime::RemoteObject>&) override;
+#endif
private:
void enable();
+#if ENABLE(WEB_SOCKETS)
+ WebSocket* webSocketForRequestId(const String& requestId);
+#endif
+
Ref<Inspector::Protocol::Network::ResourceTiming> buildObjectForTiming(const NetworkLoadMetrics&, ResourceLoader&);
Ref<Inspector::Protocol::Network::Metrics> buildObjectForMetrics(const NetworkLoadMetrics&);
RefPtr<Inspector::Protocol::Network::Response> buildObjectForResourceResponse(const ResourceResponse&, ResourceLoader*);
@@ -125,6 +134,7 @@
std::unique_ptr<Inspector::NetworkFrontendDispatcher> m_frontendDispatcher;
RefPtr<Inspector::NetworkBackendDispatcher> m_backendDispatcher;
+ Inspector::InjectedScriptManager& m_injectedScriptManager;
InspectorPageAgent* m_pageAgent { nullptr };
// FIXME: InspectorNetworkAgent should not be aware of style recalculation.
Modified: trunk/Source/WebInspectorUI/ChangeLog (217911 => 217912)
--- trunk/Source/WebInspectorUI/ChangeLog 2017-06-07 23:53:10 UTC (rev 217911)
+++ trunk/Source/WebInspectorUI/ChangeLog 2017-06-08 00:05:55 UTC (rev 217912)
@@ -1,5 +1,20 @@
2017-06-07 Devin Rousso <[email protected]>
+ Web Inspector: Add ContextMenu item to log WebSocket object to console
+ https://bugs.webkit.org/show_bug.cgi?id=172878
+
+ Reviewed by Joseph Pecoraro.
+
+ * Localizations/en.lproj/localizedStrings.js:
+
+ * UserInterface/Protocol/RemoteObject.js:
+ (WebInspector.RemoteObject.resolveWebSocket):
+
+ * UserInterface/Views/ResourceTreeElement.js:
+ (WebInspector.ResourceTreeElement.prototype.populateContextMenu):
+
+2017-06-07 Devin Rousso <[email protected]>
+
Web Inspector: Allow user to choose stylesheet when creating new rules
https://bugs.webkit.org/show_bug.cgi?id=172487
Modified: trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js (217911 => 217912)
--- trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js 2017-06-07 23:53:10 UTC (rev 217911)
+++ trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js 2017-06-08 00:05:55 UTC (rev 217912)
@@ -510,6 +510,7 @@
localizedStrings["Log Message"] = "Log Message";
localizedStrings["Log Symbol"] = "Log Symbol";
localizedStrings["Log Value"] = "Log Value";
+localizedStrings["Log WebSocket"] = "Log WebSocket";
localizedStrings["Log: "] = "Log: ";
localizedStrings["Logs"] = "Logs";
localizedStrings["Low"] = "Low";
@@ -728,6 +729,7 @@
localizedStrings["Selected Items"] = "Selected Items";
localizedStrings["Selected Symbol"] = "Selected Symbol";
localizedStrings["Selected Value"] = "Selected Value";
+localizedStrings["Selected WebSocket"] = "Selected WebSocket";
localizedStrings["Self"] = "Self";
localizedStrings["Self Size"] = "Self Size";
localizedStrings["Self Time"] = "Self Time";
Modified: trunk/Source/WebInspectorUI/UserInterface/Protocol/RemoteObject.js (217911 => 217912)
--- trunk/Source/WebInspectorUI/UserInterface/Protocol/RemoteObject.js 2017-06-07 23:53:10 UTC (rev 217911)
+++ trunk/Source/WebInspectorUI/UserInterface/Protocol/RemoteObject.js 2017-06-08 00:05:55 UTC (rev 217912)
@@ -138,6 +138,18 @@
});
}
+ static resolveWebSocket(webSocketResource, objectGroup, callback)
+ {
+ console.assert(typeof callback === "function");
+
+ NetworkAgent.resolveWebSocket(webSocketResource.requestIdentifier, objectGroup, (error, object) => {
+ if (error || !object)
+ callback(null);
+ else
+ callback(WebInspector.RemoteObject.fromPayload(object, webSocketResource.target));
+ });
+ }
+
static type(remoteObject)
{
if (remoteObject === null)
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ResourceTreeElement.js (217911 => 217912)
--- trunk/Source/WebInspectorUI/UserInterface/Views/ResourceTreeElement.js 2017-06-07 23:53:10 UTC (rev 217911)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ResourceTreeElement.js 2017-06-08 00:05:55 UTC (rev 217912)
@@ -161,6 +161,21 @@
populateContextMenu(contextMenu, event)
{
+ if (this._resource.type === WebInspector.Resource.Type.WebSocket) {
+ contextMenu.appendItem(WebInspector.UIString("Log WebSocket"), () => {
+ WebInspector.RemoteObject.resolveWebSocket(this._resource, WebInspector.RuntimeManager.ConsoleObjectGroup, (remoteObject) => {
+ if (!remoteObject)
+ return;
+
+ const text = WebInspector.UIString("Selected WebSocket");
+ const addSpecialUserLogClass = true;
+ WebInspector.consoleLogViewController.appendImmediateExecutionWithResult(text, remoteObject, addSpecialUserLogClass);
+ });
+ });
+
+ contextMenu.appendSeparator();
+ }
+
WebInspector.appendContextMenuItemsForSourceCode(contextMenu, this._resource);
super.populateContextMenu(contextMenu, event);