Bug 181361 - [Cocoa] Web Inspector: Provide a way for clients to check if an NSWindow is a Web Inspector window
Summary: [Cocoa] Web Inspector: Provide a way for clients to check if an NSWindow is a...
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: Joseph Pecoraro
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2018-01-05 19:57 PST by Joseph Pecoraro
Modified: 2018-01-19 07:09 PST (History)
8 users (show)

See Also:


Attachments
[PATCH] Proposed Fix (16.84 KB, patch)
2018-01-05 20:06 PST, Joseph Pecoraro
no flags Details | Formatted Diff | Diff
[PATCH] Proposed Fix (16.90 KB, patch)
2018-01-05 20:09 PST, Joseph Pecoraro
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Joseph Pecoraro 2018-01-05 19:57:41 PST
Provide a way for clients to check if an NSWindow is a Web Inspector window

Currently these are just NSWindows without any reliable way to identify that they are Web Inspector windows.
Comment 1 Joseph Pecoraro 2018-01-05 20:03:10 PST
<rdar://problem/36332865>
Comment 2 Joseph Pecoraro 2018-01-05 20:06:24 PST
Created attachment 330630 [details]
[PATCH] Proposed Fix
Comment 3 Joseph Pecoraro 2018-01-05 20:09:41 PST
Created attachment 330631 [details]
[PATCH] Proposed Fix

Sorted the Xcode project.
Comment 4 Joseph Pecoraro 2018-01-05 20:10:10 PST
Comment on attachment 330631 [details]
[PATCH] Proposed Fix

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

> Source/WebKit/ChangeLog:15
> +        (-[NSWindow _web_isWebInspectorWindow]):
> +        Method to determing if a window is being used for Web Inspector content.

I used a category for its convenience, but there could be some arguments against this:

  - This doesn't take into account WebKitLegacy NSWindows.
  - This can just be a isWebInspectorWindow(NSWindow*) utility function exported somewhere instead of a category on NSWindow.

Reviewers, let me know if you think another approach would be preferred.
Comment 5 Radar WebKit Bug Importer 2018-01-05 20:36:13 PST
<rdar://problem/36333041>
Comment 6 Darin Adler 2018-01-07 22:43:03 PST
Comment on attachment 330631 [details]
[PATCH] Proposed Fix

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

> Source/WebKit/Shared/API/Cocoa/_WKNSWindowExtras.h:34
> +- (BOOL)_web_isWebInspectorWindow;

"web" was our prefix in Legacy WebKit.

For Modern WebKit, our prefix is "WK". So maybe this should be _WK_isWebInspectorWindow?
Comment 7 Joseph Pecoraro 2018-01-08 13:38:10 PST
(In reply to Darin Adler from comment #6)
> Comment on attachment 330631 [details]
> [PATCH] Proposed Fix
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=330631&action=review
> 
> > Source/WebKit/Shared/API/Cocoa/_WKNSWindowExtras.h:34
> > +- (BOOL)_web_isWebInspectorWindow;
> 
> "web" was our prefix in Legacy WebKit.
> 
> For Modern WebKit, our prefix is "WK". So maybe this should be
> _WK_isWebInspectorWindow?

We seem to continue to use the "_web_" prefix in the Modern WebKit API. For all NS* categories we use "_web_". While there are instances of "_wk_" they appear to only be on our own WK* classes.

I closed matched these:

Shared/Cocoa/WKNSURLExtras.h
> @interface NSURL (WKExtras)
> + (instancetype)_web_URLWithWTFString:(const String&)string;
> + (instancetype)_web_URLWithWTFString:(const String&)string relativeToURL:(NSURL *)baseURL;
> - (String)_web_originalDataAsWTFString;
> @end

Shared/API/Cocoa/_WKNSFileManagerExtras.h
> @interface NSFileManager (WKExtras)
> + (NSString *)_web_createTemporaryFileForQuickLook:(NSString *)fileName;
> @end
Comment 8 WebKit Commit Bot 2018-01-08 14:01:16 PST
Comment on attachment 330631 [details]
[PATCH] Proposed Fix

Clearing flags on attachment: 330631

Committed r226536: <https://trac.webkit.org/changeset/226536>
Comment 9 WebKit Commit Bot 2018-01-08 14:01:18 PST
All reviewed patches have been landed.  Closing bug.
Comment 10 mitz 2018-01-19 07:09:38 PST
Comment on attachment 330631 [details]
[PATCH] Proposed Fix

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

>>> Source/WebKit/Shared/API/Cocoa/_WKNSWindowExtras.h:34
>>> +- (BOOL)_web_isWebInspectorWindow;
>> 
>> "web" was our prefix in Legacy WebKit.
>> 
>> For Modern WebKit, our prefix is "WK". So maybe this should be _WK_isWebInspectorWindow?
> 
> We seem to continue to use the "_web_" prefix in the Modern WebKit API. For all NS* categories we use "_web_". While there are instances of "_wk_" they appear to only be on our own WK* classes.
> 
> I closed matched these:
> 
> Shared/Cocoa/WKNSURLExtras.h

This declaration is missing an availability annotation.