Bug 193951 - Web Inspector: expose a way of determining if a detached frontend is for a remote target
Summary: Web Inspector: expose a way of determining if a detached frontend is for a re...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Devin Rousso
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2019-01-28 20:07 PST by Devin Rousso
Modified: 2019-04-05 05:43 PDT (History)
7 users (show)

See Also:


Attachments
Patch (7.07 KB, patch)
2019-01-28 20:10 PST, Devin Rousso
bburg: review-
bburg: commit-queue-
Details | Formatted Diff | Diff
Patch (21.14 KB, patch)
2019-01-28 23:05 PST, Devin Rousso
no flags Details | Formatted Diff | Diff
Patch (21.12 KB, patch)
2019-01-28 23:34 PST, Devin Rousso
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Devin Rousso 2019-01-28 20:07:35 PST
.
Comment 1 Devin Rousso 2019-01-28 20:07:51 PST
<rdar://problem/47621366>
Comment 2 Devin Rousso 2019-01-28 20:10:24 PST
Created attachment 360427 [details]
Patch
Comment 3 Blaze Burg 2019-01-28 21:35:13 PST
Comment on attachment 360427 [details]
Patch

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

Looks good in principle but let's make it less hacky.

> Source/WebKit/ChangeLog:18
> +        * UIProcess/mac/WKInspectorWindow.mm:

This file is now SPI so it belongs in UIProcess/API/Cocoa/. Please move accordingly.

> Source/WebKit/UIProcess/WebInspectorProxy.h:108
> +    static RetainPtr<NSWindow> createFrontendWindow(NSRect savedWindowFrame, bool isRemote);

When in C++, please make this an enum class rather than boolean. The style promoted by Simon tends to be

enum class InspectionTargetIsRemote { Yes, No }

or 

enum class ForRemoteTarget { Yes, No }

I prefer the latter.

> Source/WebKit/UIProcess/mac/WKInspectorWindow.h:33
> +@property (nonatomic, getter=isRemote) BOOL remote;

This is too terse; it could be referring to a remote NSWindow or something. Please change to isForRemoteTarget.

> Source/WebKit/UIProcess/mac/WKInspectorWindow.mm:29
> +#if WK_API_ENABLED && !TARGET_OS_IPHONE

Technically, it's OK to use PLATFORM(MAC) in implementation files.

> Source/WebKit/UIProcess/mac/WKInspectorWindow.mm:33
> +- (BOOL)isRemote

It seems random to put this property on the NSWindow. Better to have _WKInspector hold the truth on this matter. It should be OK for WKInspectorWindow to have an ivar / property for the associated _WKInspector and query that.

> Source/WebKit/UIProcess/mac/WebInspectorProxyMac.mm:238
> +    [window setRemote:isRemote];

You can get the _WKInspector via [m_objCAdapter.get() inspector]
Comment 4 Devin Rousso 2019-01-28 23:00:51 PST
Comment on attachment 360427 [details]
Patch

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

>> Source/WebKit/UIProcess/mac/WKInspectorWindow.mm:33
>> +- (BOOL)isRemote
> 
> It seems random to put this property on the NSWindow. Better to have _WKInspector hold the truth on this matter. It should be OK for WKInspectorWindow to have an ivar / property for the associated _WKInspector and query that.

I think the issue with this is that we don't have an equivalent `_WKRemoteInspector` (I don't think we create a `_WKInspector` for remote targets).
Comment 5 Devin Rousso 2019-01-28 23:05:22 PST
Created attachment 360443 [details]
Patch
Comment 6 Devin Rousso 2019-01-28 23:34:51 PST
Created attachment 360445 [details]
Patch
Comment 7 Joseph Pecoraro 2019-01-29 13:52:45 PST
Comment on attachment 360445 [details]
Patch

r=me
Comment 8 Blaze Burg 2019-01-29 13:58:03 PST
After some discussion we agreed that the initial approach (bool ivar on WKInspectorWindow) is the way to go for now. _WKInspector does not exist for inspector views for remote targets.
Comment 9 WebKit Commit Bot 2019-01-29 14:40:50 PST
Comment on attachment 360445 [details]
Patch

Clearing flags on attachment: 360445

Committed r240685: <https://trac.webkit.org/changeset/240685>
Comment 10 WebKit Commit Bot 2019-01-29 14:40:52 PST
All reviewed patches have been landed.  Closing bug.
Comment 11 David Kilzer (:ddkilzer) 2019-04-05 05:43:26 PDT
(In reply to WebKit Commit Bot from comment #9)
> Comment on attachment 360445 [details]
> Patch
> 
> Clearing flags on attachment: 360445
> 
> Committed r240685: <https://trac.webkit.org/changeset/240685>

Follow-up fix to Xcode project file:

Committed r243932: <https://trac.webkit.org/changeset/243932>