Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(215)

Unified Diff: third_party/WebKit/Source/devtools/front_end/network/ResourceWebSocketFrameView.js

Issue 1912973002: [DevTools] JSONView parsing smarter (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/network/RequestPreviewView.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/devtools/front_end/network/ResourceWebSocketFrameView.js
diff --git a/third_party/WebKit/Source/devtools/front_end/network/ResourceWebSocketFrameView.js b/third_party/WebKit/Source/devtools/front_end/network/ResourceWebSocketFrameView.js
index 25d9bc977822d19f5946dcba18f3c7530f0632b0..af2f2c3897a0c74ed72329cba65af416ced62534 100644
--- a/third_party/WebKit/Source/devtools/front_end/network/ResourceWebSocketFrameView.js
+++ b/third_party/WebKit/Source/devtools/front_end/network/ResourceWebSocketFrameView.js
@@ -47,10 +47,14 @@ WebInspector.ResourceWebSocketFrameView = function(request)
this._dataGrid.setName("ResourceWebSocketFrameView");
this._dataGrid.addEventListener(WebInspector.DataGrid.Events.SelectedNode, this._onFrameSelected, this);
+ this._dataGrid.addEventListener(WebInspector.DataGrid.Events.DeselectedNode, this._onFrameDeselected, this);
this._splitWidget.setMainWidget(this._dataGrid.asWidget());
var view = new WebInspector.EmptyWidget("Select frame to browse its content.");
this._splitWidget.setSidebarWidget(view);
+
+ /** @type {?WebInspector.ResourceWebSocketFrameNode} */
+ this._selectedNode = null;
}
/** @enum {number} */
@@ -116,12 +120,41 @@ WebInspector.ResourceWebSocketFrameView.prototype = {
_onFrameSelected: function(event)
{
var selectedNode = /** @type {!WebInspector.ResourceWebSocketFrameNode} */ (event.target.selectedNode);
+ this._currentSelectedNode = selectedNode;
var contentProvider = selectedNode.contentProvider();
- contentProvider.requestContent().then(content => {
- var parsedJSON = content ? WebInspector.JSONView.parseJSON(content) : null;
- var view = parsedJSON ? new WebInspector.JSONView(parsedJSON) : new WebInspector.ResourceSourceFrame(contentProvider);
- this._splitWidget.setSidebarWidget(view);
- });
+ contentProvider.requestContent().then(contentHandler.bind(this));
+
+ /**
+ * @param {(string|null)} content
+ * @this {WebInspector.ResourceWebSocketFrameView}
+ */
+ function contentHandler(content) {
+ if (this._currentSelectedNode !== selectedNode)
+ return;
+ WebInspector.JSONView.parseJSON(content).then(handleJSONData.bind(this));
+ }
+
+ /**
+ * @param {?WebInspector.ParsedJSON} parsedJSON
+ * @this {WebInspector.ResourceWebSocketFrameView}
+ */
+ function handleJSONData(parsedJSON)
+ {
+ if (this._currentSelectedNode !== selectedNode)
+ return;
+ if (parsedJSON)
+ this._splitWidget.setSidebarWidget(new WebInspector.JSONView(parsedJSON));
+ else
+ this._splitWidget.setSidebarWidget(new WebInspector.ResourceSourceFrame(contentProvider));
+ }
+ },
+
+ /**
+ * @param {!WebInspector.Event} event
+ */
+ _onFrameDeselected: function(event)
+ {
+ this._currentSelectedNode = null;
},
refresh: function()
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/network/RequestPreviewView.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698