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

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

Issue 2257963002: DevTools: Better view of web sockets binary frames' data Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: DevTools: Better view of web sockets binary frames' data Created 4 years, 2 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 | « AUTHORS ('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 d7cf56ffc14e0aabd53fec33b84486b0ba1ca7e6..488c57430388289d168c5832e370a282a61169d4 100644
--- a/third_party/WebKit/Source/devtools/front_end/network/ResourceWebSocketFrameView.js
+++ b/third_party/WebKit/Source/devtools/front_end/network/ResourceWebSocketFrameView.js
@@ -209,13 +209,30 @@ WebInspector.ResourceWebSocketFrameNode = function(url, frame)
timeNode.title = time.toLocaleString();
this._isTextFrame = frame.opCode === WebInspector.ResourceWebSocketFrameView.OpCodes.TextFrame;
- if (!this._isTextFrame)
+ if (!this._isTextFrame) {
this._dataText = WebInspector.ResourceWebSocketFrameView.opCodeDescription(frame.opCode, frame.mask);
allada 2016/10/20 00:06:48 Since we are not using this._dataText as our sourc
+ if (frame.opCode === WebInspector.ResourceWebSocketFrameView.OpCodes.BinaryFrame)
+ this._escapeBinaryFrameData(frame);
+ }
WebInspector.SortableDataGridNode.call(this, {data: this._dataText, length: length, time: timeNode});
}
WebInspector.ResourceWebSocketFrameNode.prototype = {
+
+ _escapeBinaryFrameData: function(frame) {
allada 2016/10/20 00:06:48 On second thought, lets inline this function. It's
allada 2016/10/20 00:06:48 I'm sorry I should have clarified a little more...
+ if (frame.text.length > 5000) {
allada 2016/10/20 00:06:48 Single line if statements we do not add curly brac
+ return;
+ }
+
+ function escapeChar(match) {
allada 2016/10/20 00:06:48 We need to add docs: /** * @param {string} match
+ var charCode = match.charCodeAt(0);
+ return "\\x" + (charCode <= 0xF ? "0" : "") + charCode.toString(16);
+ }
+
+ this._dataText = frame.text.replace(/[^\x20-\x7E\n\r]/g, escapeChar);
allada 2016/10/20 00:06:48 Can we put this above the above function? We often
+ },
+
/**
* @override
*/
« no previous file with comments | « AUTHORS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698