Bug 169649 - Web Inspector: WebSockets: Don't store binary frames in memory since they are never shown
Summary: Web Inspector: WebSockets: Don't store binary frames in memory since they are...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P3 Normal
Assignee: Nikita Vasilyev
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2017-03-14 18:03 PDT by Nikita Vasilyev
Modified: 2017-04-03 16:11 PDT (History)
4 users (show)

See Also:


Attachments
Patch (2.09 KB, patch)
2017-03-14 18:05 PDT, Nikita Vasilyev
buildbot: commit-queue-
Details | Formatted Diff | Diff
Archive of layout-test-results from ews125 for ios-simulator-wk2 (742.15 KB, application/zip)
2017-03-14 19:35 PDT, Build Bot
no flags Details
Patch (2.08 KB, patch)
2017-03-14 20:35 PDT, Nikita Vasilyev
bburg: review+
bburg: commit-queue-
Details | Formatted Diff | Diff
Patch (1.73 KB, patch)
2017-04-03 15:32 PDT, Nikita Vasilyev
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Nikita Vasilyev 2017-03-14 18:03:43 PDT
Web Socket binary frames are never displayed in the UI. There's no reason to clog Web Inspector's front-end memory with them.
Comment 1 Radar WebKit Bug Importer 2017-03-14 18:04:21 PDT
<rdar://problem/31053069>
Comment 2 Nikita Vasilyev 2017-03-14 18:05:15 PDT
Created attachment 304454 [details]
Patch
Comment 3 Joseph Pecoraro 2017-03-14 18:19:59 PDT
Comment on attachment 304454 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=304454&action=review

> Source/WebInspectorUI/UserInterface/Models/WebSocketResource.js:78
> +        // Binary data is never shown in the UI, don't clog memory with it.
> +        if (opcode === WebInspector.WebSocketResource.OpCodes.BinaryFrame)
> +            return "";

Can we show the binary data? A hex view would be neat. Instead of the empty string maybe we can show a stylized localized string, such as "(Binary Data)" or at least an emDash?

> Source/WebInspectorUI/UserInterface/Models/WebSocketResource.js:79
> +        else

Style: We normally do not include an else when the previous branch always returns.
Comment 4 Nikita Vasilyev 2017-03-14 18:36:58 PDT
Comment on attachment 304454 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=304454&action=review

>> Source/WebInspectorUI/UserInterface/Models/WebSocketResource.js:78
>> +            return "";
> 
> Can we show the binary data? A hex view would be neat. Instead of the empty string maybe we can show a stylized localized string, such as "(Binary Data)" or at least an emDash?

We can show binary data, but there could be several megabytes of it. If we make a UI for showing binary data, I'd make it available for Resources as well, not just WebSocketContentView. I'm curious to explore this but I think it's a low priority now.

We currently show "Binary Frame", not an empty string: https://github.com/WebKit/webkit/blob/master/Source/WebInspectorUI/UserInterface/Views/WebSocketContentView.js#L95-L98
Comment 5 Build Bot 2017-03-14 19:35:12 PDT
Comment on attachment 304454 [details]
Patch

Attachment 304454 [details] did not pass ios-sim-ews (ios-simulator-wk2):
Output: http://webkit-queues.webkit.org/results/3326029

New failing tests:
imported/w3c/web-platform-tests/IndexedDB/fire-success-event-exception.html
Comment 6 Build Bot 2017-03-14 19:35:14 PDT
Created attachment 304463 [details]
Archive of layout-test-results from ews125 for ios-simulator-wk2

The attached test failures were seen while running run-webkit-tests on the ios-sim-ews.
Bot: ews125  Port: ios-simulator-wk2  Platform: Mac OS X 10.11.6
Comment 7 Nikita Vasilyev 2017-03-14 20:35:53 PDT
Created attachment 304466 [details]
Patch

The test fail seems unrelated to my patch.
Comment 8 BJ Burg 2017-04-01 10:18:10 PDT
Comment on attachment 304466 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=304466&action=review

r=me

> Source/WebInspectorUI/UserInterface/Models/WebSocketResource.js:74
> +    _dataForWebSocketFrame(data, opcode)

I don't see any reason to make this a private member. Let's just inline this into addFrame.

> Source/WebInspectorUI/UserInterface/Models/WebSocketResource.js:78
> +            return "";

This should be null, not an empty string.
Comment 9 Nikita Vasilyev 2017-04-03 15:32:05 PDT
Created attachment 306130 [details]
Patch
Comment 10 WebKit Commit Bot 2017-04-03 16:11:28 PDT
Comment on attachment 306130 [details]
Patch

Clearing flags on attachment: 306130

Committed r214853: <http://trac.webkit.org/changeset/214853>
Comment 11 WebKit Commit Bot 2017-04-03 16:11:30 PDT
All reviewed patches have been landed.  Closing bug.