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), 11.64 KB, created by
Nikita Vasilyev
on 2017-02-16 00:35:48 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Nikita Vasilyev
Created:
2017-02-16 00:35:48 PST
Size:
11.64 KB
patch
obsolete
>diff --git a/Source/WebInspectorUI/ChangeLog b/Source/WebInspectorUI/ChangeLog >index 43e3dd1..b728331 100644 >--- a/Source/WebInspectorUI/ChangeLog >+++ b/Source/WebInspectorUI/ChangeLog >@@ -1,3 +1,41 @@ >+2017-02-16 Nikita Vasilyev <nvasilyev@apple.com> >+ >+ Web Inspector: Show Web Socket connections in Network tab >+ https://bugs.webkit.org/show_bug.cgi?id=167520 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Show Web Socket connections in Network and Resources tabs. Display HTTP headers >+ of Web Socket handshake request in the details sidebar. >+ >+ This patch does not implement Web Socket message inspection yet. >+ >+ * UserInterface/Controllers/FrameResourceManager.js: >+ (WebInspector.FrameResourceManager.prototype.initialize): >+ (WebInspector.FrameResourceManager.prototype.webSocketCreated): >+ (WebInspector.FrameResourceManager.prototype.webSocketWillSendHandshakeRequest): >+ webSocketWillSendHandshakeRequest doesn't recieve a request URL as one of its parameters. >+ Store URLs recived from webSocketCreated method in _webSocketIdentifierToUrl map. >+ >+ (WebInspector.FrameResourceManager.prototype.webSocketHandshakeResponseReceived): >+ (WebInspector.FrameResourceManager.prototype.webSocketClosed): >+ Mark resource as finished when Web Socket handshake is complete or Web Socket is closed. >+ This may change in the future. >+ >+ * UserInterface/Main.html: >+ * UserInterface/Views/WebSocketContentView.js: Added. >+ (WebInspector.WebSocketContentView): >+ * UserInterface/Views/ResourceClusterContentView.js: >+ (WebInspector.ResourceClusterContentView.prototype.get responseContentView): >+ Add an empty content view which will later display Web Socket sent and recieved messages. >+ >+ * UserInterface/Protocol/NetworkObserver.js: >+ (WebInspector.NetworkObserver.prototype.webSocketCreated): >+ (WebInspector.NetworkObserver.prototype.webSocketWillSendHandshakeRequest): >+ (WebInspector.NetworkObserver.prototype.webSocketHandshakeResponseReceived): >+ (WebInspector.NetworkObserver.prototype.webSocketClosed): >+ Add newly added FrameResourceManager methods. >+ > 2017-02-15 Devin Rousso <dcrousso+webkit@gmail.com> > > Web Inspector: Split console should be allowed when docked bottom on Elements/Resources/Debugger/Storage tabs >diff --git a/Source/WebInspectorUI/UserInterface/Controllers/FrameResourceManager.js b/Source/WebInspectorUI/UserInterface/Controllers/FrameResourceManager.js >index 7ee5864..f3ec2fe 100644 >--- a/Source/WebInspectorUI/UserInterface/Controllers/FrameResourceManager.js >+++ b/Source/WebInspectorUI/UserInterface/Controllers/FrameResourceManager.js >@@ -49,6 +49,7 @@ WebInspector.FrameResourceManager = class FrameResourceManager extends WebInspec > this._mainFrame = null; > this._resourceRequestIdentifierMap = {}; > this._orphanedResources = new Map; >+ this._webSocketIdentifierToUrl = new Map; > > if (this._mainFrame !== oldMainFrame) > this._mainFrameDidChange(oldMainFrame); >@@ -204,6 +205,57 @@ WebInspector.FrameResourceManager = class FrameResourceManager extends WebInspec > this._resourceRequestIdentifierMap[requestIdentifier] = resource; > } > >+ webSocketCreated(requestIdentifier, url) >+ { >+ this._webSocketIdentifierToUrl.set(requestIdentifier, url); >+ } >+ >+ webSocketWillSendHandshakeRequest(requestIdentifier, timestamp, requestHeaders) >+ { >+ let url = this._webSocketIdentifierToUrl.get(requestIdentifier); >+ console.assert(url); >+ if (!url) >+ return; >+ >+ let frameIdentifier = WebInspector.frameResourceManager.mainFrame.id; >+ let loaderIdentifier = WebInspector.frameResourceManager.mainFrame.id; >+ let frame = this.frameForIdentifier(frameIdentifier); >+ let targetId; >+ let requestMethod = "GET"; >+ >+ // HTTP Post data. >+ let requestData = null; >+ >+ let elapsedTime = WebInspector.timelineManager.computeElapsedTime(timestamp); >+ let initiatorSourceCodeLocation = null; >+ >+ // COMPATIBILITY (iOS 8): Timeline timestamps for legacy backends are computed >+ // dynamically from the first backend timestamp received. For navigations we >+ // need to reset that base timestamp, and an appropriate timestamp to use is >+ // the new main resource's will be sent timestamp. So save this value on the >+ // resource in case it becomes a main resource. >+ var originalRequestWillBeSentTimestamp = timestamp; >+ >+ let resource = new WebInspector.Resource(url, null, WebInspector.Resource.Type.WebSocket, loaderIdentifier, targetId, requestIdentifier, requestMethod, requestHeaders, requestData, elapsedTime , initiatorSourceCodeLocation, originalRequestWillBeSentTimestamp); >+ frame.addResource(resource); >+ >+ // Associate the resource with the requestIdentifier so it can be found in future loading events. >+ this._resourceRequestIdentifierMap[requestIdentifier] = resource; >+ } >+ >+ webSocketHandshakeResponseReceived(requestIdentifier, timestamp, payloadData, opcode, mask) >+ { >+ var resource = this._resourceRequestIdentifierMap[requestIdentifier]; >+ console.assert(resource); >+ if (!resource) >+ return; >+ >+ var elapsedTime = WebInspector.timelineManager.computeElapsedTime(timestamp); >+ resource.markAsFinished(elapsedTime); >+ >+ delete this._resourceRequestIdentifierMap[requestIdentifier]; >+ } >+ > markResourceRequestAsServedFromMemoryCache(requestIdentifier) > { > // Called from WebInspector.NetworkObserver. >@@ -293,6 +345,20 @@ WebInspector.FrameResourceManager = class FrameResourceManager extends WebInspec > resource.updateForResponse(response.url, response.mimeType, type, response.headers, response.status, response.statusText, elapsedTime, response.timing); > } > >+ webSocketClosed(requestIdentifier, timestamp) >+ { >+ var resource = this._resourceRequestIdentifierMap[requestIdentifier]; >+ console.assert(resource); >+ if (!resource) >+ return; >+ >+ var elapsedTime = WebInspector.timelineManager.computeElapsedTime(timestamp); >+ resource.markAsFinished(elapsedTime); >+ >+ this._webSocketIdentifierToUrl.delete(requestIdentifier); >+ delete this._resourceRequestIdentifierMap[requestIdentifier]; >+ } >+ > resourceRequestDidReceiveData(requestIdentifier, dataLength, encodedDataLength, timestamp) > { > // Called from WebInspector.NetworkObserver. >diff --git a/Source/WebInspectorUI/UserInterface/Main.html b/Source/WebInspectorUI/UserInterface/Main.html >index 364c27a..7db6378 100644 >--- a/Source/WebInspectorUI/UserInterface/Main.html >+++ b/Source/WebInspectorUI/UserInterface/Main.html >@@ -674,6 +674,7 @@ > <script src="Views/TypeTreeElement.js"></script> > <script src="Views/TypeTreeView.js"></script> > <script src="Views/WorkerTreeElement.js"></script> >+ <script src="Views/WebSocketContentView.js"></script> > > <script src="Views/VisualStyleDetailsPanel.js"></script> > <script src="Views/VisualStylePropertyEditor.js"></script> >diff --git a/Source/WebInspectorUI/UserInterface/Protocol/NetworkObserver.js b/Source/WebInspectorUI/UserInterface/Protocol/NetworkObserver.js >index 70f2346..6090e69 100644 >--- a/Source/WebInspectorUI/UserInterface/Protocol/NetworkObserver.js >+++ b/Source/WebInspectorUI/UserInterface/Protocol/NetworkObserver.js >@@ -62,24 +62,25 @@ WebInspector.NetworkObserver = class NetworkObserver > WebInspector.frameResourceManager.resourceRequestWasServedFromMemoryCache(requestId, frameId, loaderId, resource, timestamp, initiator); > } > >- webSocketWillSendHandshakeRequest(requestId, timestamp, request) >+ webSocketCreated(requestId, url) > { >- // FIXME: Not implemented. >+ WebInspector.frameResourceManager.webSocketCreated(requestId, url); > } > >- webSocketHandshakeResponseReceived(requestId, timestamp, response) >+ webSocketWillSendHandshakeRequest(requestId, timestamp, request) > { >- // FIXME: Not implemented. >+ WebInspector.frameResourceManager.webSocketWillSendHandshakeRequest(requestId, timestamp, request.headers); > } > >- webSocketCreated(requestId, url) >+ webSocketHandshakeResponseReceived(requestId, timestamp, response) > { >- // FIXME: Not implemented. >+ let {payloadData, opcode, mask} = response; >+ WebInspector.frameResourceManager.webSocketHandshakeResponseReceived(requestId, timestamp, payloadData, opcode, mask); > } > > webSocketClosed(requestId, timestamp) > { >- // FIXME: Not implemented. >+ WebInspector.frameResourceManager.webSocketClosed(requestId, timestamp); > } > > webSocketFrameReceived(requestId, timestamp, response) >diff --git a/Source/WebInspectorUI/UserInterface/Views/ResourceClusterContentView.js b/Source/WebInspectorUI/UserInterface/Views/ResourceClusterContentView.js >index 3f084df..5404d79 100644 >--- a/Source/WebInspectorUI/UserInterface/Views/ResourceClusterContentView.js >+++ b/Source/WebInspectorUI/UserInterface/Views/ResourceClusterContentView.js >@@ -83,6 +83,10 @@ WebInspector.ResourceClusterContentView = class ResourceClusterContentView exten > this._responseContentView = new WebInspector.FontResourceContentView(this._resource); > break; > >+ case WebInspector.Resource.Type.WebSocket: >+ this._responseContentView = new WebInspector.WebSocketContentView(this._resource); >+ break; >+ > default: > this._responseContentView = new WebInspector.GenericResourceContentView(this._resource); > break; >diff --git a/Source/WebInspectorUI/UserInterface/Views/WebSocketContentView.js b/Source/WebInspectorUI/UserInterface/Views/WebSocketContentView.js >new file mode 100644 >index 0000000..834cfd9 >--- /dev/null >+++ b/Source/WebInspectorUI/UserInterface/Views/WebSocketContentView.js >@@ -0,0 +1,38 @@ >+/* >+ * 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 TextResourceContentView extends WebInspector.ContentView >+{ >+ constructor(resource) >+ { >+ console.assert(resource instanceof WebInspector.Resource, resource); >+ >+ super(resource); >+ this._resource = resource; >+ this.element.classList.add("web-socket", "resource"); >+ >+ // FIXME: Not implemented. >+ } >+};
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-
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 167520
:
301652
|
301724
|
301851
|
301852
|
302065
|
303030
|
303035
|
303177
|
303366
|
303371
|
303374
|
303391