Bug 230573 - [Cocoa] backport showConsole() and showResources() for RemoteWebInspectorUI
Summary: [Cocoa] backport showConsole() and showResources() for RemoteWebInspectorUI
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit API (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: BJ Burg
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-09-21 13:12 PDT by BJ Burg
Modified: 2021-09-27 09:19 PDT (History)
7 users (show)

See Also:


Attachments
Patch v1.0 (8.21 KB, patch)
2021-09-21 13:46 PDT, BJ Burg
no flags Details | Formatted Diff | Diff
Patch v1.1 (17.29 KB, patch)
2021-09-21 16:33 PDT, BJ Burg
no flags Details | Formatted Diff | Diff
Patch v1.2 (17.16 KB, patch)
2021-09-22 08:26 PDT, BJ Burg
hi: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description BJ Burg 2021-09-21 13:12:33 PDT
.
Comment 1 Radar WebKit Bug Importer 2021-09-21 13:13:45 PDT
<rdar://problem/83365814>
Comment 2 BJ Burg 2021-09-21 13:14:57 PDT
In the process of writing an API test for _WKInspectorExtensionDelegate, I realized that there is no way to reliably select extension tabs and select non-extension tabs. For the purposes of testing (and future API unification), we should hoist showResources() and showConsole() to the _WKInspectorExtensionHost protocol.
Comment 3 BJ Burg 2021-09-21 13:46:05 PDT
Created attachment 438850 [details]
Patch v1.0
Comment 4 Patrick Angle 2021-09-21 14:17:37 PDT
Comment on attachment 438850 [details]
Patch v1.0

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

> Source/WebKit/ChangeLog:19
> +        * UIProcess/API/Cocoa/_WKInspectorExtensionHost.h:
> +        Hoist showResources() and showConsole() to this shared protocol.
> +        This doesn't really have anything to do with extensions, but it will
> +        suffice until a more generic protocol is created for APIs that should
> +        exist for both _WKInspector and _WKInspectorRemoteViewController.

It is a shame that we don't have a separate generic protocol for this stuff yet, particularly given that `close` is already declared here, which also isn't directly extension related either. I'm torn on perpetuating this misdirection further. Is there any reason we either go ahead and create that more generic protocol or rename this protocol to better reflect what it is?
Comment 5 BJ Burg 2021-09-21 16:33:16 PDT
Created attachment 438884 [details]
Patch v1.1
Comment 6 BJ Burg 2021-09-21 19:11:17 PDT
(In reply to Patrick Angle from comment #4)
> Comment on attachment 438850 [details]
> Patch v1.0
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=438850&action=review
> 
> > Source/WebKit/ChangeLog:19
> > +        * UIProcess/API/Cocoa/_WKInspectorExtensionHost.h:
> > +        Hoist showResources() and showConsole() to this shared protocol.
> > +        This doesn't really have anything to do with extensions, but it will
> > +        suffice until a more generic protocol is created for APIs that should
> > +        exist for both _WKInspector and _WKInspectorRemoteViewController.
> 
> It is a shame that we don't have a separate generic protocol for this stuff
> yet, particularly given that `close` is already declared here, which also
> isn't directly extension related either. I'm torn on perpetuating this
> misdirection further. Is there any reason we either go ahead and create that
> more generic protocol or rename this protocol to better reflect what it is?

The new patch v1.1 incorporates this suggestion.
Comment 7 Patrick Angle 2021-09-21 22:06:27 PDT
Comment on attachment 438884 [details]
Patch v1.1

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

Provisional r+ from me

> Source/WebKit/WebKit.xcodeproj/project.pbxproj:6
> +	objectVersion = 54;

Probably don’t want to increment this? I imagine we will want to do that in a separate bug and across the entire project even if this is intended. I know this has caused issues on older Xcode versions in the past.
Comment 8 BJ Burg 2021-09-22 08:26:40 PDT
Created attachment 438951 [details]
Patch v1.2

Latest patch v1.2 addresses all comments to date.
Comment 9 Devin Rousso 2021-09-22 11:27:36 PDT
Comment on attachment 438951 [details]
Patch v1.2

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

> Source/WebKit/UIProcess/API/Cocoa/_WKInspectorIBActions.h:46
> + * This will open the associated Web Inspector if it is not already open.

Is this actually true?

> Source/WebKit/UIProcess/API/Cocoa/_WKInspectorIBActions.h:52
> + * This will open the associated Web Inspector if it is not already open.

ditto (:46)
Comment 10 BJ Burg 2021-09-24 13:33:48 PDT
(In reply to Devin Rousso from comment #9)
> Comment on attachment 438951 [details]
> Patch v1.2
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=438951&action=review
> 
> > Source/WebKit/UIProcess/API/Cocoa/_WKInspectorIBActions.h:46
> > + * This will open the associated Web Inspector if it is not already open.
> 
> Is this actually true?
> 
> > Source/WebKit/UIProcess/API/Cocoa/_WKInspectorIBActions.h:52
> > + * This will open the associated Web Inspector if it is not already open.
> 
> ditto (:46)

No. I have removed the comment in the newest patch version.

Most of the IBActions have no effect unless the inspector frontend is loaded. Ultimately they will wait for frontend to finish loading in InspectorFrontendAPIDispatcher.

It is recommended for API users to call -show before doing more things with _WKInspector.
Comment 11 Devin Rousso 2021-09-24 14:07:14 PDT
Comment on attachment 438951 [details]
Patch v1.2

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

r=me based on described changes to API doc

>>> Source/WebKit/UIProcess/API/Cocoa/_WKInspectorIBActions.h:46
>>> + * This will open the associated Web Inspector if it is not already open.
>> 
>> Is this actually true?
> 
> No. I have removed the comment in the newest patch version.
> 
> Most of the IBActions have no effect unless the inspector frontend is loaded. Ultimately they will wait for frontend to finish loading in InspectorFrontendAPIDispatcher.
> 
> It is recommended for API users to call -show before doing more things with _WKInspector.

Gotcha.  That sounds fine :)
Comment 12 BJ Burg 2021-09-27 09:19:15 PDT
Committed r283119 (242177@main): <https://commits.webkit.org/242177@main>