WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
patch.txt (text/plain), 30.03 KB, created by
Nikita Vasilyev
on 2017-03-08 14:26:33 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Nikita Vasilyev
Created:
2017-03-08 14:26:33 PST
Size:
30.03 KB
patch
obsolete
>diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog >index ca040bc..dd0231c 100644 >--- a/Source/JavaScriptCore/ChangeLog >+++ b/Source/JavaScriptCore/ChangeLog >@@ -1,3 +1,14 @@ >+2017-03-08 Nikita Vasilyev <nvasilyev@apple.com> >+ >+ Web Inspector: Show individual messages in the content pane for a WebSocket >+ https://bugs.webkit.org/show_bug.cgi?id=169011 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Add walltime parameter and correct the description of Timestamp type. >+ >+ * inspector/protocol/Network.json: >+ > 2017-03-07 Dean Jackson <dino@apple.com> > > Some platforms won't be able to create a GPUDevice >diff --git a/Source/JavaScriptCore/inspector/protocol/Network.json b/Source/JavaScriptCore/inspector/protocol/Network.json >index 5b159ab..90f4bf1 100644 >--- a/Source/JavaScriptCore/inspector/protocol/Network.json >+++ b/Source/JavaScriptCore/inspector/protocol/Network.json >@@ -21,6 +21,11 @@ > { > "id": "Timestamp", > "type": "number", >+ "description": "Elapsed time since opened." >+ }, >+ { >+ "id": "Walltime", >+ "type": "number", > "description": "Number of seconds since epoch." > }, > { >@@ -255,7 +260,8 @@ > "description": "Fired when WebSocket is about to initiate handshake.", > "parameters": [ > { "name": "requestId", "$ref": "RequestId", "description": "Request identifier." }, >- { "name": "timestamp", "$ref": "Timestamp", "description": "Timestamp." }, >+ { "name": "timestamp", "$ref": "Timestamp", "description": "Elapsed time since opened." }, >+ { "name": "walltime", "$ref": "Walltime", "description": "Number of seconds since epoch." }, > { "name": "request", "$ref": "WebSocketRequest", "description": "WebSocket request data." } > ] > }, >@@ -264,7 +270,7 @@ > "description": "Fired when WebSocket handshake response becomes available.", > "parameters": [ > { "name": "requestId", "$ref": "RequestId", "description": "Request identifier." }, >- { "name": "timestamp", "$ref": "Timestamp", "description": "Timestamp." }, >+ { "name": "timestamp", "$ref": "Timestamp", "description": "Elapsed time since opened." }, > { "name": "response", "$ref": "WebSocketResponse", "description": "WebSocket response data." } > ] > }, >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index df31917..8c0e32f 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,17 @@ >+2017-03-08 Nikita Vasilyev <nvasilyev@apple.com> >+ >+ Web Inspector: Show individual messages in the content pane for a WebSocket >+ https://bugs.webkit.org/show_bug.cgi?id=169011 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Add walltime parameter. >+ >+ No new tests. Tests will be added in a follow up patch. >+ >+ * inspector/InspectorNetworkAgent.cpp: >+ (WebCore::InspectorNetworkAgent::willSendWebSocketHandshakeRequest): >+ > 2017-03-07 Jiewen Tan <jiewen_tan@apple.com> > > [WebCrypto] Implement ECDH ImportKey/ExportKey operations >diff --git a/Source/WebCore/inspector/InspectorNetworkAgent.cpp b/Source/WebCore/inspector/InspectorNetworkAgent.cpp >index ee34ccf..b55e396 100644 >--- a/Source/WebCore/inspector/InspectorNetworkAgent.cpp >+++ b/Source/WebCore/inspector/InspectorNetworkAgent.cpp >@@ -541,7 +541,7 @@ void InspectorNetworkAgent::willSendWebSocketHandshakeRequest(unsigned long iden > auto requestObject = Inspector::Protocol::Network::WebSocketRequest::create() > .setHeaders(buildObjectForHeaders(request.httpHeaderFields())) > .release(); >- m_frontendDispatcher->webSocketWillSendHandshakeRequest(IdentifiersFactory::requestId(identifier), timestamp(), WTFMove(requestObject)); >+ m_frontendDispatcher->webSocketWillSendHandshakeRequest(IdentifiersFactory::requestId(identifier), timestamp(), currentTime(), WTFMove(requestObject)); > } > > void InspectorNetworkAgent::didReceiveWebSocketHandshakeResponse(unsigned long identifier, const ResourceResponse& response) >diff --git a/Source/WebInspectorUI/ChangeLog b/Source/WebInspectorUI/ChangeLog >index 6c3374c..429e3ce 100644 >--- a/Source/WebInspectorUI/ChangeLog >+++ b/Source/WebInspectorUI/ChangeLog >@@ -1,3 +1,68 @@ >+2017-03-08 Nikita Vasilyev <nvasilyev@apple.com> >+ >+ Web Inspector: Show individual messages in the content pane for a WebSocket >+ https://bugs.webkit.org/show_bug.cgi?id=169011 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ When selecting a Web Socket in Network panel or Resources, display a table >+ of all messages that have been sent and received. >+ >+ * Localizations/en.lproj/localizedStrings.js: >+ * UserInterface/Controllers/FrameResourceManager.js: >+ (WebInspector.FrameResourceManager.prototype.webSocketWillSendHandshakeRequest): >+ Add a walltime parameter. >+ >+ (WebInspector.FrameResourceManager.prototype._webSocketFrameReceivedOrSent): >+ Fix a bug: masked messages are outgoing, not incoming. >+ >+ * UserInterface/Images/ArrowUp.svg: Added. >+ Add an icon for outgoing messages. >+ >+ * UserInterface/Main.html: >+ * UserInterface/Models/WebSocketResource.js: >+ (WebInspector.WebSocketResource): >+ (WebInspector.WebSocketResource.prototype.get openTime): >+ Open time is the time when Web Inspector was opened. >+ >+ (WebInspector.WebSocketResource.prototype.get walltime): >+ (WebInspector.WebSocketResource.prototype.addFrame): >+ >+ * UserInterface/Protocol/NetworkObserver.js: >+ (WebInspector.NetworkObserver.prototype.webSocketWillSendHandshakeRequest): >+ (WebInspector.NetworkObserver.prototype.webSocketFrameSent): >+ (WebInspector.NetworkObserver.prototype.webSocketFrameError): >+ (WebInspector.NetworkObserver): >+ * UserInterface/Views/NetworkSidebarPanel.js: >+ (WebInspector.NetworkSidebarPanel.prototype.treeElementAddedOrChanged): >+ * UserInterface/Views/ResourceClusterContentView.js: >+ (WebInspector.ResourceClusterContentView.prototype.get responseContentView): >+ >+ * UserInterface/Views/WebSocketContentView.js: Added. >+ (WebInspector.WebSocketContentView): >+ Only show Time column when walltime is set. >+ >+ (WebInspector.WebSocketContentView.textForOpcode): >+ (WebInspector.WebSocketContentView.prototype.shown): >+ (WebInspector.WebSocketContentView.prototype.hidden): >+ (WebInspector.WebSocketContentView.prototype.addFrame): >+ (WebInspector.WebSocketContentView.prototype._updateFrames): >+ Only render frames that haven't been rendered yet. >+ >+ (WebInspector.WebSocketContentView.prototype._addRow): >+ (WebInspector.WebSocketContentView.prototype._timeStringFromTimestamp): >+ * UserInterface/Views/WebSocketContentView.css: Added. >+ (.web-socket.content-view > .data-grid): >+ (.web-socket.content-view > .data-grid table.data): >+ (.web-socket.content-view > .data-grid td.data-column,): >+ (.web-socket.content-view > .data-grid .data-column > div): >+ (.web-socket.content-view .icon): >+ (.web-socket.content-view .outgoing .icon): >+ (.web-socket.content-view .data-grid.variable-height-rows table.data tr:nth-child(odd)): >+ (.web-socket.content-view .data-grid table.data tr.revealed): >+ (.web-socket.content-view .data-grid.variable-height-rows table.data tr.outgoing): >+ (.web-socket.content-view .data-grid.variable-height-rows table.data tr.non-text-frame): >+ > 2017-03-07 Chris Dumez <cdumez@apple.com> > > Drop non-standard MessageEvent.webkitInitMessageEvent() >diff --git a/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js b/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js >index dcc6f01..20866d6 100644 >--- a/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js >+++ b/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js >@@ -110,6 +110,7 @@ localizedStrings["Back (%s)"] = "Back (%s)"; > localizedStrings["Background"] = "Background"; > localizedStrings["Basis"] = "Basis"; > localizedStrings["Bezier"] = "Bezier"; >+localizedStrings["Binary Frame"] = "Binary Frame"; > localizedStrings["Blend"] = "Blend"; > localizedStrings["Block Variables"] = "Block Variables"; > localizedStrings["Blur"] = "Blur"; >@@ -186,6 +187,7 @@ localizedStrings["Compression"] = "Compression"; > localizedStrings["Condition"] = "Condition"; > localizedStrings["Conditional expression"] = "Conditional expression"; > localizedStrings["Connection"] = "Connection"; >+localizedStrings["Connection Close Frame"] = "Connection Close Frame"; > localizedStrings["Console"] = "Console"; > localizedStrings["Console Evaluation"] = "Console Evaluation"; > localizedStrings["Console Evaluation %d"] = "Console Evaluation %d"; >@@ -197,6 +199,7 @@ localizedStrings["Container Regions"] = "Container Regions"; > localizedStrings["Content"] = "Content"; > localizedStrings["Content Flow"] = "Content Flow"; > localizedStrings["Content Security Policy violation of directive: %s"] = "Content Security Policy violation of directive: %s"; >+localizedStrings["Continuation Frame"] = "Continuation Frame"; > localizedStrings["Continue script execution (%s or %s)"] = "Continue script execution (%s or %s)"; > localizedStrings["Continue to Here"] = "Continue to Here"; > localizedStrings["Controls"] = "Controls"; >@@ -581,8 +584,10 @@ localizedStrings["Path"] = "Path"; > localizedStrings["Pause Playback"] = "Pause Playback"; > localizedStrings["Pause Reason"] = "Pause Reason"; > localizedStrings["Pause script execution (%s or %s)"] = "Pause script execution (%s or %s)"; >+localizedStrings["Ping Frame"] = "Ping Frame"; > localizedStrings["Play Sound"] = "Play Sound"; > localizedStrings["Polite"] = "Polite"; >+localizedStrings["Pong Frame"] = "Pong Frame"; > localizedStrings["Port"] = "Port"; > localizedStrings["Position"] = "Position"; > localizedStrings["Position X"] = "Position X"; >@@ -771,6 +776,7 @@ localizedStrings["Tabs"] = "Tabs"; > localizedStrings["Take snapshot"] = "Take snapshot"; > localizedStrings["Template Content"] = "Template Content"; > localizedStrings["Text"] = "Text"; >+localizedStrings["Text Frame"] = "Text Frame"; > localizedStrings["Text Node"] = "Text Node"; > localizedStrings["Text Only"] = "Text Only"; > localizedStrings["The selector â%sâ is invalid.\nClick to revert to the previous selector."] = "The selector â%sâ is invalid.\nClick to revert to the previous selector."; >@@ -841,6 +847,7 @@ localizedStrings["Warning: "] = "Warning: "; > localizedStrings["Warnings"] = "Warnings"; > localizedStrings["Watch Expressions"] = "Watch Expressions"; > localizedStrings["Web Inspector"] = "Web Inspector"; >+localizedStrings["WebSocket connection established"] = "WebSocket connection established"; > localizedStrings["Weight"] = "Weight"; > localizedStrings["Whitespace"] = "Whitespace"; > localizedStrings["Whitespace Characters:"] = "Whitespace Characters:"; >diff --git a/Source/WebInspectorUI/UserInterface/Controllers/FrameResourceManager.js b/Source/WebInspectorUI/UserInterface/Controllers/FrameResourceManager.js >index 0c6f80f..af65784 100644 >--- a/Source/WebInspectorUI/UserInterface/Controllers/FrameResourceManager.js >+++ b/Source/WebInspectorUI/UserInterface/Controllers/FrameResourceManager.js >@@ -206,13 +206,19 @@ WebInspector.FrameResourceManager = class FrameResourceManager extends WebInspec > this._webSocketIdentifierToURL.set(requestId, url); > } > >- webSocketWillSendHandshakeRequest(requestId, timestamp, request) >+ webSocketWillSendHandshakeRequest(requestId, timestamp, walltime, request) > { > let url = this._webSocketIdentifierToURL.get(requestId); > console.assert(url); > if (!url) > return; > >+ // When remote debugging an older versions of iOS, walltime parameter isn't present. >+ if (!NetworkAgent.hasEventParameter("webSocketWillSendHandshakeRequest", "walltime")) { >+ request = walltime; >+ walltime = NaN; >+ } >+ > // FIXME: <webkit.org/b/168475> Web Inspector: Correctly display iframe's and worker's WebSockets > let frameIdentifier = WebInspector.frameResourceManager.mainFrame.id; > let loaderIdentifier = WebInspector.frameResourceManager.mainFrame.id; >@@ -223,7 +229,8 @@ WebInspector.FrameResourceManager = class FrameResourceManager extends WebInspec > let elapsedTime = WebInspector.timelineManager.computeElapsedTime(timestamp); > let initiatorSourceCodeLocation = null; > >- let resource = new WebInspector.WebSocketResource(url, loaderIdentifier, targetId, requestId, request.headers, requestData, elapsedTime, initiatorSourceCodeLocation); >+ let resource = new WebInspector.WebSocketResource(url, loaderIdentifier, targetId, requestId, request.headers, requestData, timestamp, walltime, elapsedTime, initiatorSourceCodeLocation); >+ > frame.addResource(resource); > > this._resourceRequestIdentifierMap.set(requestId, resource); >@@ -280,13 +287,15 @@ WebInspector.FrameResourceManager = class FrameResourceManager extends WebInspec > if (!resource) > return; > >- let isIncoming = !!response.mask; >+ // Data going from the client to the server is always masked. >+ let isOutgoing = !!response.mask; >+ > let data = response.payloadData; > let opcode = response.opcode; > > let elapsedTime = WebInspector.timelineManager.computeElapsedTime(timestamp); > >- resource.addFrame(data, isIncoming, opcode, timestamp, elapsedTime); >+ resource.addFrame(data, isOutgoing, opcode, timestamp, elapsedTime); > } > > markResourceRequestAsServedFromMemoryCache(requestIdentifier) >diff --git a/Source/WebInspectorUI/UserInterface/Images/ArrowUp.svg b/Source/WebInspectorUI/UserInterface/Images/ArrowUp.svg >new file mode 100644 >index 0000000..d651845 >--- /dev/null >+++ b/Source/WebInspectorUI/UserInterface/Images/ArrowUp.svg >@@ -0,0 +1,5 @@ >+<?xml version="1.0"?> >+<!-- Copyright © 2017 Apple Inc. All rights reserved. --> >+<svg xmlns="http://www.w3.org/2000/svg" id="root" version="1.1" width="16" height="16" viewBox="0 0 16 16"> >+ <path fill="none" stroke="currentColor" stroke-width="1" d="M 8 2 L 2 11 H 6 v 4 h 4 V 11 h 4 Z"/> >+</svg> >diff --git a/Source/WebInspectorUI/UserInterface/Main.html b/Source/WebInspectorUI/UserInterface/Main.html >index cdac162..e9f5cd8 100644 >--- a/Source/WebInspectorUI/UserInterface/Main.html >+++ b/Source/WebInspectorUI/UserInterface/Main.html >@@ -201,6 +201,7 @@ > <link rel="stylesheet" href="Views/VisualStyleTabbedPropertiesRow.css"> > <link rel="stylesheet" href="Views/VisualStyleTimingEditor.css"> > <link rel="stylesheet" href="Views/VisualStyleUnitSlider.css"> >+ <link rel="stylesheet" href="Views/WebSocketContentView.css"> > > <link rel="stylesheet" href="Controllers/CodeMirrorCompletionController.css"> > <link rel="stylesheet" href="Controllers/CodeMirrorDragToAdjustNumberController.css"> >@@ -674,6 +675,7 @@ > <script src="Views/TypeTokenView.js"></script> > <script src="Views/TypeTreeElement.js"></script> > <script src="Views/TypeTreeView.js"></script> >+ <script src="Views/WebSocketContentView.js"></script> > <script src="Views/WorkerTreeElement.js"></script> > > <script src="Views/VisualStyleDetailsPanel.js"></script> >diff --git a/Source/WebInspectorUI/UserInterface/Models/WebSocketResource.js b/Source/WebInspectorUI/UserInterface/Models/WebSocketResource.js >index c345900..7071b80 100644 >--- a/Source/WebInspectorUI/UserInterface/Models/WebSocketResource.js >+++ b/Source/WebInspectorUI/UserInterface/Models/WebSocketResource.js >@@ -25,13 +25,15 @@ > > WebInspector.WebSocketResource = class WebSocketResource extends WebInspector.Resource > { >- constructor(url, loaderIdentifier, targetId, requestIdentifier, requestHeaders, requestData, requestSentTimestamp, initiatorSourceCodeLocation) >+ constructor(url, loaderIdentifier, targetId, requestIdentifier, requestHeaders, requestData, timestamp, walltime, requestSentTimestamp, initiatorSourceCodeLocation) > { > const type = WebInspector.Resource.Type.WebSocket; > const mimeType = null; > const requestMethod = "GET"; > super(url, mimeType, type, loaderIdentifier, targetId, requestIdentifier, requestMethod, requestHeaders, requestData, requestSentTimestamp, initiatorSourceCodeLocation); > >+ this._timestamp = timestamp; >+ this._walltime = walltime; > this._readyState = WebInspector.WebSocketResource.ReadyState.Connecting; > this._frames = []; > } >@@ -39,6 +41,12 @@ WebInspector.WebSocketResource = class WebSocketResource extends WebInspector.Re > // Public > > get frames() { return this._frames; } >+ get walltime() { return this._walltime; } >+ >+ get openTime() >+ { >+ return this._walltime - this._timestamp; >+ } > > get readyState() > { >@@ -56,11 +64,13 @@ WebInspector.WebSocketResource = class WebSocketResource extends WebInspector.Re > this.dispatchEventToListeners(WebInspector.WebSocketResource.Event.ReadyStateChanged, {previousState, state}); > } > >- addFrame(data, isIncoming, opcode, timestamp, elapsedTime) >+ addFrame(data, isOutgoing, opcode, timestamp, elapsedTime) > { >- let frame = {data, isIncoming, opcode, timestamp, elapsedTime}; >+ let frame = {data, isOutgoing, opcode, walltime: this.openTime + timestamp}; > this._frames.push(frame); > >+ this.increaseSize(data.length, elapsedTime); >+ > this.dispatchEventToListeners(WebInspector.WebSocketResource.Event.FrameAdded, frame); > } > }; >@@ -75,3 +85,12 @@ WebInspector.WebSocketResource.ReadyState = { > Connecting: Symbol("web-socket-ready-state-connecting"), > Open: Symbol("web-socket-ready-state-open"), > }; >+ >+WebInspector.WebSocketResource.OpCodes = { >+ ContinuationFrame: 0, >+ TextFrame: 1, >+ BinaryFrame: 2, >+ ConnectionCloseFrame: 8, >+ PingFrame: 9, >+ PongFrame: 10 >+}; >diff --git a/Source/WebInspectorUI/UserInterface/Protocol/NetworkObserver.js b/Source/WebInspectorUI/UserInterface/Protocol/NetworkObserver.js >index f2e4c0d..59b8648 100644 >--- a/Source/WebInspectorUI/UserInterface/Protocol/NetworkObserver.js >+++ b/Source/WebInspectorUI/UserInterface/Protocol/NetworkObserver.js >@@ -67,9 +67,9 @@ WebInspector.NetworkObserver = class NetworkObserver > WebInspector.frameResourceManager.webSocketCreated(requestId, url); > } > >- webSocketWillSendHandshakeRequest(requestId, timestamp, request) >+ webSocketWillSendHandshakeRequest(requestId, timestamp, walltime, request) > { >- WebInspector.frameResourceManager.webSocketWillSendHandshakeRequest(requestId, timestamp, request); >+ WebInspector.frameResourceManager.webSocketWillSendHandshakeRequest(requestId, timestamp, walltime, request); > } > > webSocketHandshakeResponseReceived(requestId, timestamp, response) >@@ -87,13 +87,13 @@ WebInspector.NetworkObserver = class NetworkObserver > WebInspector.frameResourceManager.webSocketFrameReceived(requestId, timestamp, response); > } > >- webSocketFrameError(requestId, timestamp, errorMessage) >+ webSocketFrameSent(requestId, timestamp, response) > { >- // FIXME: Not implemented. >+ WebInspector.frameResourceManager.webSocketFrameSent(requestId, timestamp, response); > } > >- webSocketFrameSent(requestId, timestamp, response) >+ webSocketFrameError(requestId, timestamp, errorMessage) > { >- WebInspector.frameResourceManager.webSocketFrameSent(requestId, timestamp, response); >+ // FIXME: Not implemented. > } > }; >diff --git a/Source/WebInspectorUI/UserInterface/Views/NetworkSidebarPanel.js b/Source/WebInspectorUI/UserInterface/Views/NetworkSidebarPanel.js >index 4273bd4..92a7057 100644 >--- a/Source/WebInspectorUI/UserInterface/Views/NetworkSidebarPanel.js >+++ b/Source/WebInspectorUI/UserInterface/Views/NetworkSidebarPanel.js >@@ -168,13 +168,10 @@ WebInspector.NetworkSidebarPanel = class NetworkSidebarPanel extends WebInspecto > closeButton.addEventListener(WebInspector.TreeElementStatusButton.Event.Clicked, this._treeElementCloseButtonClicked, this); > fragment.appendChild(closeButton.element); > >- // FIXME: <webkit.org/b/169011> Web Inspector: Show individual messages in the content pane for a WebSocket >- if (treeElement.resource.type !== WebInspector.Resource.Type.WebSocket) { >- let goToButton = new WebInspector.TreeElementStatusButton(WebInspector.createGoToArrowButton()); >- goToButton[WebInspector.NetworkSidebarPanel.TreeElementSymbol] = treeElement; >- goToButton.addEventListener(WebInspector.TreeElementStatusButton.Event.Clicked, this._treeElementGoToArrowWasClicked, this); >- fragment.appendChild(goToButton.element); >- } >+ let goToButton = new WebInspector.TreeElementStatusButton(WebInspector.createGoToArrowButton()); >+ goToButton[WebInspector.NetworkSidebarPanel.TreeElementSymbol] = treeElement; >+ goToButton.addEventListener(WebInspector.TreeElementStatusButton.Event.Clicked, this._treeElementGoToArrowWasClicked, this); >+ fragment.appendChild(goToButton.element); > > treeElement.status = fragment; > } >diff --git a/Source/WebInspectorUI/UserInterface/Views/ResourceClusterContentView.js b/Source/WebInspectorUI/UserInterface/Views/ResourceClusterContentView.js >index 0f12833..5404d79 100644 >--- a/Source/WebInspectorUI/UserInterface/Views/ResourceClusterContentView.js >+++ b/Source/WebInspectorUI/UserInterface/Views/ResourceClusterContentView.js >@@ -84,7 +84,7 @@ WebInspector.ResourceClusterContentView = class ResourceClusterContentView exten > break; > > case WebInspector.Resource.Type.WebSocket: >- // FIXME: <webkit.org/b/169011> Web Inspector: Show individual messages in the content pane for a WebSocket >+ this._responseContentView = new WebInspector.WebSocketContentView(this._resource); > break; > > default: >diff --git a/Source/WebInspectorUI/UserInterface/Views/WebSocketContentView.css b/Source/WebInspectorUI/UserInterface/Views/WebSocketContentView.css >new file mode 100644 >index 0000000..9f87505 >--- /dev/null >+++ b/Source/WebInspectorUI/UserInterface/Views/WebSocketContentView.css >@@ -0,0 +1,72 @@ >+/* >+ * Copyright (C) 2017 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+.web-socket.content-view > .data-grid { >+ height: 100%; >+} >+ >+.web-socket.content-view > .data-grid table.data { >+ height: auto; >+ background-image: none; >+} >+ >+.web-socket.content-view > .data-grid td.data-column, >+.web-socket.content-view .data-grid td.data-column > div { >+ height: auto; >+ white-space: pre-wrap; >+} >+ >+.web-socket.content-view > .data-grid .data-column > div { >+ padding-left: 18px; >+} >+ >+.web-socket.content-view .icon { >+ position: absolute; >+ left: 4px; >+ margin-right: 2px; >+ margin-top: -1px; >+} >+ >+.web-socket.content-view .outgoing .icon { >+ background-image: url("../Images/ArrowUp.svg"); >+} >+ >+.web-socket.content-view .data-grid.variable-height-rows table.data tr:nth-child(odd) { >+ background-color: unset; >+} >+ >+.web-socket.content-view .data-grid table.data tr.revealed { >+ border-bottom: 0.5px solid hsla(0, 0%, 0%, 0.1); >+} >+ >+.web-socket.content-view .data-grid.variable-height-rows table.data tr.outgoing { >+ background-color: hsl(80, 85%, 92%); >+ color: hsl(120, 100%, 16%); >+} >+ >+.web-socket.content-view .data-grid.variable-height-rows table.data tr.non-text-frame { >+ background-color: hsl(50, 100%, 90%); >+ color: hsl(3, 96%, 27%); >+} >diff --git a/Source/WebInspectorUI/UserInterface/Views/WebSocketContentView.js b/Source/WebInspectorUI/UserInterface/Views/WebSocketContentView.js >new file mode 100644 >index 0000000..d8fd027 >--- /dev/null >+++ b/Source/WebInspectorUI/UserInterface/Views/WebSocketContentView.js >@@ -0,0 +1,134 @@ >+/* >+ * Copyright (C) 2017 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+WebInspector.WebSocketContentView = class WebSocketContentView extends WebInspector.ContentView >+{ >+ constructor(resource) >+ { >+ console.assert(resource instanceof WebInspector.WebSocketResource, resource); >+ >+ super(resource); >+ >+ this._resource = resource; >+ this._framesRendered = 0; >+ this._showTimeColumn = !isNaN(resource.walltime); >+ >+ this.element.classList.add("web-socket", "resource"); >+ >+ let columns = {data: {}}; >+ columns.data.title = WebInspector.UIString("Data"); >+ columns.data.sortable = false; >+ columns.data.icon = true; >+ columns.data.width = "85%"; >+ >+ if (this._showTimeColumn) >+ columns.time = {title: WebInspector.UIString("Time"), sortable: true}; >+ >+ this._dataGrid = new WebInspector.DataGrid(columns); >+ this._dataGrid.variableHeightRows = true; >+ this.addSubview(this._dataGrid); >+ >+ this._addRow(WebInspector.UIString("WebSocket connection established"), this._resource.walltime, ["non-text-frame"]); >+ >+ this._dataGrid.updateLayout(); >+ } >+ >+ // Static >+ >+ static textForOpcode(opcode) >+ { >+ const opCodesDescription = { >+ [WebInspector.WebSocketResource.OpCodes.ContinuationFrame]: WebInspector.UIString("Continuation Frame"), >+ [WebInspector.WebSocketResource.OpCodes.TextFrame]: WebInspector.UIString("Text Frame"), >+ [WebInspector.WebSocketResource.OpCodes.BinaryFrame]: WebInspector.UIString("Binary Frame"), >+ [WebInspector.WebSocketResource.OpCodes.ConnectionCloseFrame]: WebInspector.UIString("Connection Close Frame"), >+ [WebInspector.WebSocketResource.OpCodes.PingFrame]: WebInspector.UIString("Ping Frame"), >+ [WebInspector.WebSocketResource.OpCodes.PongFrame]: WebInspector.UIString("Pong Frame"), >+ }; >+ >+ return opCodesDescription[opcode]; >+ } >+ >+ // Public >+ >+ shown() >+ { >+ this._updateFrames(); >+ this._resource.addEventListener(WebInspector.WebSocketResource.Event.FrameAdded, this._updateFrames, this); >+ } >+ >+ hidden() >+ { >+ this._resource.removeEventListener(WebInspector.WebSocketResource.Event.FrameAdded, this._updateFrames, this); >+ } >+ >+ addFrame(data, isOutgoing, opcode, time) >+ { >+ let nodeText; >+ if (opcode === WebInspector.WebSocketResource.OpCodes.TextFrame) >+ nodeText = data; >+ else >+ nodeText = WebInspector.WebSocketContentView.textForOpcode(opcode); >+ >+ let classNames = [ >+ isOutgoing ? "outgoing" : "incoming", >+ opcode === WebInspector.WebSocketResource.OpCodes.TextFrame ? "text-frame" : "non-text-frame" >+ ]; >+ >+ this._addRow(nodeText, time, classNames); >+ } >+ >+ // Private >+ >+ _updateFrames() >+ { >+ let framesLength = this._resource.frames.length; >+ for (let index = this._framesRendered; index < framesLength; index++) { >+ let frame = this._resource.frames[index]; >+ let {data, isOutgoing, opcode, walltime} = frame; >+ this.addFrame(data, isOutgoing, opcode, walltime); >+ } >+ this._framesRendered = framesLength; >+ } >+ >+ _addRow(data, time, classNames) >+ { >+ let node; >+ if (this._showTimeColumn) >+ node = new WebInspector.DataGridNode({data, time: this._timeStringFromTimestamp(time)}); >+ else >+ node = new WebInspector.DataGridNode({data}); >+ >+ this._dataGrid.appendChild(node); >+ >+ if (classNames && classNames.length > 0) >+ node.element.classList.add(...classNames); >+ } >+ >+ _timeStringFromTimestamp(timestamp) >+ { >+ return new Date(timestamp * 1000).toLocaleTimeString(); >+ } >+};
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
joepeck
:
review+
joepeck
:
commit-queue-
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 169011
:
303792
|
303794
|
303795
|
303843
|
303966
|
303974