[Cocoa] Add SPI to check if a WKWebView has an inspector frontend
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 7 Jan 2019 20:20:42 +0000 (20:20 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 7 Jan 2019 20:20:42 +0000 (20:20 +0000)
https://bugs.webkit.org/show_bug.cgi?id=193162
<rdar://problem/24267143>

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2019-01-07
Reviewed by Alex Christensen.

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _hasInspectorFrontend]):
* UIProcess/API/Cocoa/WKWebViewPrivate.h:
* UIProcess/WebPageProxy.h:
(WebKit::WebPageProxy::hasInspectorFrontend const):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239691 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit/ChangeLog
Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h
Source/WebKit/UIProcess/WebPageProxy.h

index 6cfd088..4954a6d 100644 (file)
@@ -1,3 +1,17 @@
+2019-01-07  Joseph Pecoraro  <pecoraro@apple.com>
+
+        [Cocoa] Add SPI to check if a WKWebView has an inspector frontend
+        https://bugs.webkit.org/show_bug.cgi?id=193162
+        <rdar://problem/24267143>
+
+        Reviewed by Alex Christensen.
+
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (-[WKWebView _hasInspectorFrontend]):
+        * UIProcess/API/Cocoa/WKWebViewPrivate.h:
+        * UIProcess/WebPageProxy.h:
+        (WebKit::WebPageProxy::hasInspectorFrontend const):
+
 2019-01-07  Antti Koivisto  <antti@apple.com>
 
         UI process side scrollbars for UI side compositing on Mac
index 8e1d53d..cf1919c 100644 (file)
@@ -6957,6 +6957,11 @@ static WebCore::UserInterfaceLayoutDirection toUserInterfaceLayoutDirection(UISe
     _resolutionForShareSheetImmediateCompletionForTesting = resolved;
 }
 
+- (BOOL)_hasInspectorFrontend
+{
+    return _page && _page->hasInspectorFrontend();
+}
+
 - (_WKInspector *)_inspector
 {
     if (auto* inspector = _page->inspector())
index 85822cd..29ae793 100644 (file)
@@ -532,6 +532,7 @@ typedef NS_OPTIONS(NSUInteger, _WKRectEdge) {
 
 - (void)_setShareSheetCompletesImmediatelyWithResolutionForTesting:(BOOL)resolved WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
 
+@property (nonatomic, readonly) BOOL _hasInspectorFrontend WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
 @property (nonatomic, readonly) _WKInspector *_inspector WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
 @property (nonatomic, readonly) _WKFrameHandle *_mainFrame WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
 
index 78ea950..456c8a2 100644 (file)
@@ -389,6 +389,7 @@ public:
 
     void didChangeInspectorFrontendCount(unsigned count) { m_inspectorFrontendCount = count; }
     unsigned inspectorFrontendCount() const { return m_inspectorFrontendCount; }
+    bool hasInspectorFrontend() const { return m_inspectorFrontendCount > 0; }
 
     bool isControlledByAutomation() const { return m_controlledByAutomation; }
     void setControlledByAutomation(bool);