Title: [253189] trunk/Source/WebKit
Revision
253189
Author
[email protected]
Date
2019-12-05 17:12:15 -0800 (Thu, 05 Dec 2019)

Log Message

[Cocoa] _WKInspector uses wrong WKWebView in -setDiagnosticLoggingDelegate:
https://bugs.webkit.org/show_bug.cgi?id=204928

Reviewed by Timothy Hatcher.

I feel like I've made this mistake before. To make the right thing more obvious,
add a property named inspectorWebView that returns the Inspector WKWebView.

* UIProcess/API/Cocoa/_WKInspector.mm:
(-[_WKInspector inspectorWebView]):
(-[_WKInspector _setDiagnosticLoggingDelegate:]):
* UIProcess/WebInspectorProxy.h:
(WebKit::WebInspectorProxy::inspectorPage const):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (253188 => 253189)


--- trunk/Source/WebKit/ChangeLog	2019-12-06 01:08:57 UTC (rev 253188)
+++ trunk/Source/WebKit/ChangeLog	2019-12-06 01:12:15 UTC (rev 253189)
@@ -1,3 +1,19 @@
+2019-12-05  Brian Burg  <[email protected]>
+
+        [Cocoa] _WKInspector uses wrong WKWebView in -setDiagnosticLoggingDelegate:
+        https://bugs.webkit.org/show_bug.cgi?id=204928
+
+        Reviewed by Timothy Hatcher.
+
+        I feel like I've made this mistake before. To make the right thing more obvious,
+        add a property named inspectorWebView that returns the Inspector WKWebView.
+
+        * UIProcess/API/Cocoa/_WKInspector.mm:
+        (-[_WKInspector inspectorWebView]):
+        (-[_WKInspector _setDiagnosticLoggingDelegate:]):
+        * UIProcess/WebInspectorProxy.h:
+        (WebKit::WebInspectorProxy::inspectorPage const):
+
 2019-12-05  Chris Dumez  <[email protected]>
 
         Use sendWithAsyncReply() for WebPage::TryClose IPC

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


--- trunk/Source/WebKit/UIProcess/API/Cocoa/_WKInspector.mm	2019-12-06 01:08:57 UTC (rev 253188)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/_WKInspector.mm	2019-12-06 01:12:15 UTC (rev 253189)
@@ -44,6 +44,13 @@
     return nil;
 }
 
+- (WKWebView *)inspectorWebView
+{
+    if (auto* page = _inspector->inspectorPage())
+        return fromWebPageProxy(*page);
+    return nil;
+}
+
 - (BOOL)isConnected
 {
     return _inspector->isConnected();
@@ -135,7 +142,11 @@
 
 - (void)_setDiagnosticLoggingDelegate:(id<_WKDiagnosticLoggingDelegate>)delegate
 {
-    self.webView._diagnosticLoggingDelegate = delegate;
+    auto inspectorWebView = self.inspectorWebView;
+    if (!inspectorWebView)
+        return;
+
+    inspectorWebView._diagnosticLoggingDelegate = delegate;
     _inspector->setDiagnosticLoggingAvailable(!!delegate);
 }
 

Modified: trunk/Source/WebKit/UIProcess/WebInspectorProxy.h (253188 => 253189)


--- trunk/Source/WebKit/UIProcess/WebInspectorProxy.h	2019-12-06 01:08:57 UTC (rev 253188)
+++ trunk/Source/WebKit/UIProcess/WebInspectorProxy.h	2019-12-06 01:12:15 UTC (rev 253189)
@@ -89,6 +89,7 @@
 
     // Public APIs
     WebPageProxy* inspectedPage() const { return m_inspectedPage; }
+    WebPageProxy* inspectorPage() const { return m_inspectorPage; }
 
     bool isConnected() const { return !!m_inspectorPage; }
     bool isVisible() const { return m_isVisible; }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to