Title: [273471] trunk/Source/WebKit
Revision
273471
Author
bb...@apple.com
Date
2021-02-24 22:10:40 -0800 (Wed, 24 Feb 2021)

Log Message

[Cocoa] Web Inspector: expose the extension host that is used to load _WKInspectorExtension tabs
https://bugs.webkit.org/show_bug.cgi?id=222344
<rdar://problem/74678778>

Reviewed by Devin Rousso.

Clients need access to the WKWebView that hosts extension content in order to implement message passing
and event delivery to the extension panel iframes. (Currently, that WebView is
the same underlying WKWebView for the whole interface, but that is open to change.)

* UIProcess/API/Cocoa/_WKInspectorExtensionHost.h: New property.

* UIProcess/API/Cocoa/_WKInspectorPrivate.h:
* UIProcess/API/Cocoa/_WKInspector.mm:
(-[_WKInspector extensionHostWebView]): Added.
(-[_WKInspector handle]): Deleted.

* UIProcess/API/Cocoa/_WKRemoteWebInspectorViewController.mm:
(-[_WKRemoteWebInspectorViewController extensionHostWebView]): Added.
(-[_WKRemoteWebInspectorViewController handle]): Deleted.

* Shared/API/Cocoa/WKBrowsingContextHandle.mm:
(-[WKBrowsingContextHandle description]):
Drive-by, add the standard -description for debugging purposes.

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (273470 => 273471)


--- trunk/Source/WebKit/ChangeLog	2021-02-25 05:59:46 UTC (rev 273470)
+++ trunk/Source/WebKit/ChangeLog	2021-02-25 06:10:40 UTC (rev 273471)
@@ -1,3 +1,30 @@
+2021-02-24  BJ Burg  <bb...@apple.com>
+
+        [Cocoa] Web Inspector: expose the extension host that is used to load _WKInspectorExtension tabs
+        https://bugs.webkit.org/show_bug.cgi?id=222344
+        <rdar://problem/74678778>
+
+        Reviewed by Devin Rousso.
+
+        Clients need access to the WKWebView that hosts extension content in order to implement message passing
+        and event delivery to the extension panel iframes. (Currently, that WebView is
+        the same underlying WKWebView for the whole interface, but that is open to change.)
+
+        * UIProcess/API/Cocoa/_WKInspectorExtensionHost.h: New property.
+
+        * UIProcess/API/Cocoa/_WKInspectorPrivate.h:
+        * UIProcess/API/Cocoa/_WKInspector.mm:
+        (-[_WKInspector extensionHostWebView]): Added.
+        (-[_WKInspector handle]): Deleted.
+
+        * UIProcess/API/Cocoa/_WKRemoteWebInspectorViewController.mm:
+        (-[_WKRemoteWebInspectorViewController extensionHostWebView]): Added.
+        (-[_WKRemoteWebInspectorViewController handle]): Deleted.
+
+        * Shared/API/Cocoa/WKBrowsingContextHandle.mm:
+        (-[WKBrowsingContextHandle description]):
+        Drive-by, add the standard -description for debugging purposes.
+
 2021-02-24  Alex Christensen  <achristen...@webkit.org>
 
         Add stubs to enable SafariForWebKitDevelopment to launch

Modified: trunk/Source/WebKit/Shared/API/Cocoa/WKBrowsingContextHandle.mm (273470 => 273471)


--- trunk/Source/WebKit/Shared/API/Cocoa/WKBrowsingContextHandle.mm	2021-02-25 05:59:46 UTC (rev 273470)
+++ trunk/Source/WebKit/Shared/API/Cocoa/WKBrowsingContextHandle.mm	2021-02-25 06:10:40 UTC (rev 273471)
@@ -93,4 +93,9 @@
     return [[WKBrowsingContextHandle allocWithZone:zone] _initWithPageProxyID:_pageProxyID andWebPageID:_webPageID];
 }
 
+- (NSString *)description
+{
+    return [NSString stringWithFormat:@"<%@: %p; pageProxyID = %llu; webPageID = %llu>", NSStringFromClass(self.class), self, _pageProxyID.toUInt64(), _webPageID.toUInt64()];
+}
+
 @end

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/_WKInspector.mm (273470 => 273471)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/_WKInspector.mm	2021-02-25 05:59:46 UTC (rev 273470)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/_WKInspector.mm	2021-02-25 06:10:40 UTC (rev 273471)
@@ -33,6 +33,7 @@
 #import "WebProcessProxy.h"
 #import "_WKFrameHandleInternal.h"
 #import "_WKInspectorPrivateForTesting.h"
+#import "_WKRemoteObjectRegistry.h"
 #import <WebCore/FrameIdentifier.h>
 #import <wtf/HashMap.h>
 #import <wtf/HashSet.h>
@@ -169,11 +170,6 @@
     _inspector->setDiagnosticLoggingAvailable(!!delegate);
 }
 
-- (WKBrowsingContextHandle *)handle
-{
-    return self.inspectorWebView._handle;
-}
-
 // MARK: _WKInspectorInternal methods
 
 - (API::Object&)_apiObject
@@ -183,6 +179,11 @@
 
 // MARK: _WKInspectorExtensionHost methods
 
+- (WKWebView *)extensionHostWebView
+{
+    return self.inspectorWebView;
+}
+
 - (void)registerExtensionWithID:(NSString *)extensionID displayName:(NSString *)displayName completionHandler:(void(^)(NSError *, _WKInspectorExtension *))completionHandler
 {
 #if ENABLE(INSPECTOR_EXTENSIONS)

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/_WKInspectorExtensionHost.h (273470 => 273471)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/_WKInspectorExtensionHost.h	2021-02-25 05:59:46 UTC (rev 273470)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/_WKInspectorExtensionHost.h	2021-02-25 06:10:40 UTC (rev 273471)
@@ -28,6 +28,7 @@
 
 NS_ASSUME_NONNULL_BEGIN
 
+@class WKWebView;
 @class _WKInspectorExtension;
 
 @protocol _WKInspectorExtensionHost <NSObject>
@@ -57,6 +58,12 @@
  * registered _WKInspectorExtensions to be unregistered and invalidated.
  */
 - (void)close;
+
+/**
+ * @abstract The web view that is used to host extension tabs created via _WKInspectorExtension.
+ * @discussion Browsing contexts for extension tabs are loaded in subframes of this web view.
+ */
+@property (nonatomic, readonly) WKWebView *extensionHostWebView;
 @end
 
 NS_ASSUME_NONNULL_END

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/_WKInspectorPrivate.h (273470 => 273471)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/_WKInspectorPrivate.h	2021-02-25 05:59:46 UTC (rev 273470)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/_WKInspectorPrivate.h	2021-02-25 06:10:40 UTC (rev 273471)
@@ -32,11 +32,5 @@
 
 @property (nonatomic, weak, setter=_setDiagnosticLoggingDelegate:) id<_WKDiagnosticLoggingDelegate> _diagnosticLoggingDelegate;
 
-/**
- * @abstract The browsing context handle associated with Web Inspector's user interface.
- * @discussion This can be used to identify the inspector page and any associated subframes
- * from within the injected bundle.
- */
-@property (nonatomic, readonly) WKBrowsingContextHandle *handle;
-
+@property (nonatomic, readonly) WKWebView *extensionHostWebView;
 @end

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/_WKRemoteWebInspectorViewController.mm (273470 => 273471)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/_WKRemoteWebInspectorViewController.mm	2021-02-25 05:59:46 UTC (rev 273470)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/_WKRemoteWebInspectorViewController.mm	2021-02-25 06:10:40 UTC (rev 273471)
@@ -159,6 +159,11 @@
 
 // MARK: _WKInspectorExtensionHost methods
 
+- (WKWebView *)extensionHostWebView
+{
+    return self.webView;
+}
+
 - (void)registerExtensionWithID:(NSString *)extensionID displayName:(NSString *)displayName completionHandler:(void(^)(NSError *, _WKInspectorExtension *))completionHandler
 {
 #if ENABLE(INSPECTOR_EXTENSIONS)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to