Bug 204775

Summary: Web Inspector: provide a way to log messages from the network process
Product: WebKit Reporter: Devin Rousso <hi>
Component: Web InspectorAssignee: Devin Rousso <hi>
Status: RESOLVED FIXED    
Severity: Normal CC: achristensen, bburg, cdumez, dbates, ews-watchlist, hi, inspector-bugzilla-changes, japhet, joepeck, keith_miller, mark.lam, mkwst, msaboff, saam, tzagallo, webkit-bug-importer, wilander
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: All   
OS: All   
See Also: https://bugs.webkit.org/show_bug.cgi?id=209810
Bug Depends on:    
Bug Blocks: 209763    
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Patch none

Description Devin Rousso 2019-12-02 18:06:40 PST
This could be used for ITP and AdClickAttribution debugging to start, rather than requiring the developer use Console.app and filter for specific channel names.
Comment 1 Devin Rousso 2019-12-02 18:47:59 PST
Created attachment 384676 [details]
Patch
Comment 2 EWS Watchlist 2019-12-02 18:48:39 PST
This patch modifies the inspector protocol generator. Please ensure that you have rebaselined any generator test results (i.e., by running `Tools/Scripts/run-inspector-generator-tests --reset-results`)

This patch modifies the inspector protocol. Please ensure that any frontend changes appropriately use feature checks for new protocol features.
Comment 3 Devin Rousso 2019-12-10 11:12:48 PST
Comment on attachment 384676 [details]
Patch

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

> Source/WebInspectorUI/ChangeLog:3
> +        Web Inspector: provide a way to log messages from the network process

We should also add items to the device settings menu for ITP and Ad Click Attribution debug logging so that they can be controlled when remotely inspecting.

> Source/WebKit/WebProcess/Network/NetworkProcessConnection.cpp:274
> +        frame->addConsoleMessage(source, level, message);

We should consider only sending a message to already open inspectors, so that messages aren't shown if an inspector is attached to a tab way later since messages are cached.
Comment 4 BJ Burg 2019-12-10 11:21:22 PST
Comment on attachment 384676 [details]
Patch

r=me. Per our discussion, the approach looks good, but need to fix tests that are failing EWS.
Comment 5 BJ Burg 2020-01-06 12:20:57 PST
Please rebase so we can land it.
Comment 6 Devin Rousso 2020-03-28 10:55:41 PDT
Created attachment 394829 [details]
Patch
Comment 7 Devin Rousso 2020-03-28 15:51:21 PDT
Created attachment 394845 [details]
Patch
Comment 8 Alex Christensen 2020-03-28 19:59:30 PDT
Comment on attachment 394845 [details]
Patch

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

> Source/WebKit/NetworkProcess/NetworkProcess.cpp:2668
> +void NetworkProcess::broadcastConsoleMessage(JSC::MessageSource source, JSC::MessageLevel level, const String& message)

This looks good, but you should consider adding a SessionID as a parameter and only broadcasting to web processes with the same session id.  Otherwise you'll be sending private browsing logs to regular browsing pages and vice versa.
Comment 9 Devin Rousso 2020-03-30 10:59:57 PDT
Comment on attachment 394845 [details]
Patch

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

>> Source/WebKit/NetworkProcess/NetworkProcess.cpp:2668
>> +void NetworkProcess::broadcastConsoleMessage(JSC::MessageSource source, JSC::MessageLevel level, const String& message)
> 
> This looks good, but you should consider adding a SessionID as a parameter and only broadcasting to web processes with the same session id.  Otherwise you'll be sending private browsing logs to regular browsing pages and vice versa.

Good point!  Thanks for taking a look :)
Comment 10 Devin Rousso 2020-03-30 12:37:23 PDT
Created attachment 394948 [details]
Patch
Comment 11 EWS 2020-03-30 15:01:54 PDT
Committed r259236: <https://trac.webkit.org/changeset/259236>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 394948 [details].
Comment 12 Radar WebKit Bug Importer 2020-03-30 15:02:14 PDT
<rdar://problem/61075075>