Diff
Modified: trunk/Source/WebCore/ChangeLog (252701 => 252702)
--- trunk/Source/WebCore/ChangeLog 2019-11-20 20:33:39 UTC (rev 252701)
+++ trunk/Source/WebCore/ChangeLog 2019-11-20 20:35:09 UTC (rev 252702)
@@ -1,3 +1,19 @@
+2019-11-19 Brian Burg <[email protected]>
+
+ [Cocoa] Add _WKRemoteWebInspectorViewController SPI to set diagnostic logging delegate
+ https://bugs.webkit.org/show_bug.cgi?id=204371
+
+ Reviewed by Devin Rousso.
+
+ Expose whether a diagnostic logging delegate has been configured for the frontend's WKWebView.
+ In a later patch, WI.DiagnosticController will start and stop recording as availability changes.
+
+ * inspector/InspectorFrontendClient.h:
+ (WebCore::InspectorFrontendClient::diagnosticLoggingAvailable):
+ * inspector/InspectorFrontendHost.cpp:
+ (WebCore::InspectorFrontendHost::diagnosticLoggingAvailable):
+ * inspector/InspectorFrontendHost.h:
+
2019-11-20 Simon Fraser <[email protected]>
Turn off antialiasing when rendering with Ahem, for testing
Modified: trunk/Source/WebCore/inspector/InspectorFrontendClient.h (252701 => 252702)
--- trunk/Source/WebCore/inspector/InspectorFrontendClient.h 2019-11-20 20:33:39 UTC (rev 252701)
+++ trunk/Source/WebCore/inspector/InspectorFrontendClient.h 2019-11-20 20:35:09 UTC (rev 252702)
@@ -87,6 +87,7 @@
#if ENABLE(INSPECTOR_TELEMETRY)
virtual bool supportsDiagnosticLogging() { return false; }
+ virtual bool diagnosticLoggingAvailable() { return false; }
virtual void logDiagnosticEvent(const String& /* eventName */, const DiagnosticLoggingClient::ValueDictionary&) { }
#endif
Modified: trunk/Source/WebCore/inspector/InspectorFrontendHost.cpp (252701 => 252702)
--- trunk/Source/WebCore/inspector/InspectorFrontendHost.cpp 2019-11-20 20:33:39 UTC (rev 252701)
+++ trunk/Source/WebCore/inspector/InspectorFrontendHost.cpp 2019-11-20 20:35:09 UTC (rev 252702)
@@ -522,6 +522,11 @@
}
#if ENABLE(INSPECTOR_TELEMETRY)
+bool InspectorFrontendHost::diagnosticLoggingAvailable()
+{
+ return m_client && m_client->diagnosticLoggingAvailable();
+}
+
static Optional<DiagnosticLoggingClient::ValuePayload> valuePayloadFromJSONValue(const RefPtr<JSON::Value>& value)
{
switch (value->type()) {
@@ -577,6 +582,6 @@
m_client->logDiagnosticEvent(makeString("WebInspector."_s, eventName), dictionary);
}
-#endif
+#endif // ENABLE(INSPECTOR_TELEMETRY)
} // namespace WebCore
Modified: trunk/Source/WebCore/inspector/InspectorFrontendHost.h (252701 => 252702)
--- trunk/Source/WebCore/inspector/InspectorFrontendHost.h 2019-11-20 20:33:39 UTC (rev 252701)
+++ trunk/Source/WebCore/inspector/InspectorFrontendHost.h 2019-11-20 20:35:09 UTC (rev 252702)
@@ -120,6 +120,7 @@
bool supportsDiagnosticLogging();
#if ENABLE(INSPECTOR_TELEMETRY)
+ bool diagnosticLoggingAvailable();
void logDiagnosticEvent(const String& eventName, const String& payload);
#endif
Modified: trunk/Source/WebKit/ChangeLog (252701 => 252702)
--- trunk/Source/WebKit/ChangeLog 2019-11-20 20:33:39 UTC (rev 252701)
+++ trunk/Source/WebKit/ChangeLog 2019-11-20 20:35:09 UTC (rev 252702)
@@ -1,3 +1,36 @@
+2019-11-19 Brian Burg <[email protected]>
+
+ [Cocoa] Add _WKRemoteWebInspectorViewController SPI to set diagnostic logging delegate
+ https://bugs.webkit.org/show_bug.cgi?id=204371
+
+ Reviewed by Devin Rousso.
+
+ * UIProcess/WebInspectorProxy.h:
+ * UIProcess/RemoteWebInspectorProxy.h:
+ * UIProcess/RemoteWebInspectorProxy.cpp:
+ (WebKit::RemoteWebInspectorProxy::setDiagnosticLoggingAvailable):
+ Hook up the plumbing to forward this state change to the frontend.
+
+ * UIProcess/API/Cocoa/_WKRemoteWebInspectorViewControllerPrivate.h: Added.
+ * UIProcess/API/Cocoa/_WKRemoteWebInspectorViewController.mm:
+ (-[_WKRemoteWebInspectorViewController _setDiagnosticLoggingDelegate:]):
+ Add new SPI to set the diagnostic logging delegate. This is preferable to directly
+ setting the delegate on the inspector WKWebView (via .webView._diagnosticLoggingDelegate),
+ because the controller can notify the frontend that diagnostic logging is now available.
+
+ * WebKit.xcodeproj/project.pbxproj: Add new header file and make it private.
+
+ * WebProcess/WebPage/WebInspectorUI.h:
+ * WebProcess/WebPage/WebInspectorUI.cpp:
+ (WebKit::WebInspectorUI::setDiagnosticLoggingAvailable):
+ Cache this value and use it for InspectorFrontendClient::diagnosticLoggingAvailable().
+
+ * WebProcess/WebPage/RemoteWebInspectorUI.messages.in:
+ * WebProcess/WebPage/RemoteWebInspectorUI.h:
+ * WebProcess/WebPage/RemoteWebInspectorUI.cpp:
+ (WebKit::RemoteWebInspectorUI::setDiagnosticLoggingAvailable):
+ Duplicate what is done for the local case.
+
2019-11-20 Jer Noble <[email protected]>
HTML5 audio .ended event not fired when app in background or phone screen is off
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/_WKRemoteWebInspectorViewController.mm (252701 => 252702)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/_WKRemoteWebInspectorViewController.mm 2019-11-20 20:33:39 UTC (rev 252701)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/_WKRemoteWebInspectorViewController.mm 2019-11-20 20:35:09 UTC (rev 252702)
@@ -143,6 +143,14 @@
[_delegate inspectorViewControllerInspectorDidClose:self];
}
+// MARK: _WKRemoteWebInspectorViewControllerPrivate methods
+
+- (void)_setDiagnosticLoggingDelegate:(id<_WKDiagnosticLoggingDelegate>)delegate
+{
+ self.webView._diagnosticLoggingDelegate = delegate;
+ m_remoteInspectorProxy->setDiagnosticLoggingAvailable(!!delegate);
+}
+
@end
#endif // PLATFORM(MAC)
Added: trunk/Source/WebKit/UIProcess/API/Cocoa/_WKRemoteWebInspectorViewControllerPrivate.h (0 => 252702)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/_WKRemoteWebInspectorViewControllerPrivate.h (rev 0)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/_WKRemoteWebInspectorViewControllerPrivate.h 2019-11-20 20:35:09 UTC (rev 252702)
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2019 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "_WKRemoteWebInspectorViewController.h"
+
+#if !TARGET_OS_IPHONE
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface _WKRemoteWebInspectorViewController (WKPrivate)
+
+@property (nonatomic, weak, setter=_setDiagnosticLoggingDelegate:) id<_WKDiagnosticLoggingDelegate> _diagnosticLoggingDelegate;
+
+@end
+
+
+NS_ASSUME_NONNULL_END
+
+#endif // !TARGET_OS_IPHONE
Modified: trunk/Source/WebKit/UIProcess/RemoteWebInspectorProxy.cpp (252701 => 252702)
--- trunk/Source/WebKit/UIProcess/RemoteWebInspectorProxy.cpp 2019-11-20 20:33:39 UTC (rev 252701)
+++ trunk/Source/WebKit/UIProcess/RemoteWebInspectorProxy.cpp 2019-11-20 20:35:09 UTC (rev 252702)
@@ -52,6 +52,15 @@
closeFrontendPageAndWindow();
}
+void RemoteWebInspectorProxy::setDiagnosticLoggingAvailable(bool available)
+{
+#if ENABLE(INSPECTOR_TELEMETRY)
+ m_inspectorPage->process().send(Messages::RemoteWebInspectorUI::SetDiagnosticLoggingAvailable(available), m_inspectorPage->webPageID());
+#else
+ UNUSED_PARAM(available);
+#endif
+}
+
void RemoteWebInspectorProxy::load(const String& debuggableType, const String& backendCommandsURL)
{
createFrontendPageAndWindow();
Modified: trunk/Source/WebKit/UIProcess/RemoteWebInspectorProxy.h (252701 => 252702)
--- trunk/Source/WebKit/UIProcess/RemoteWebInspectorProxy.h 2019-11-20 20:33:39 UTC (rev 252701)
+++ trunk/Source/WebKit/UIProcess/RemoteWebInspectorProxy.h 2019-11-20 20:35:09 UTC (rev 252702)
@@ -70,6 +70,8 @@
bool isUnderTest() const { return false; }
+ void setDiagnosticLoggingAvailable(bool);
+
void invalidate();
void load(const String& debuggableType, const String& backendCommandsURL);
Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (252701 => 252702)
--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj 2019-11-20 20:33:39 UTC (rev 252701)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj 2019-11-20 20:35:09 UTC (rev 252702)
@@ -1321,6 +1321,7 @@
990D28B11C65208D00986977 /* _WKAutomationSessionInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 990D28AF1C65203900986977 /* _WKAutomationSessionInternal.h */; };
990D28BB1C6539D300986977 /* AutomationSessionClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 990D28B71C6539A000986977 /* AutomationSessionClient.h */; };
990D28C01C6553F100986977 /* APIAutomationSessionClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 990D28B31C6526D400986977 /* APIAutomationSessionClient.h */; };
+ 990E1E092384AA57004602DF /* _WKRemoteWebInspectorViewControllerPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 990E1E082384A88B004602DF /* _WKRemoteWebInspectorViewControllerPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
99249AD51F1F1E5600B62FBB /* AutomationFrontendDispatchers.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 99249AD31F1F1E3300B62FBB /* AutomationFrontendDispatchers.cpp */; };
99249AD61F1F1E5F00B62FBB /* AutomationFrontendDispatchers.h in Headers */ = {isa = PBXBuildFile; fileRef = 99249AD41F1F1E3300B62FBB /* AutomationFrontendDispatchers.h */; };
994BADF41F7D781400B571E7 /* WKInspectorViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 994BADF11F7D77EA00B571E7 /* WKInspectorViewController.h */; };
@@ -4043,6 +4044,7 @@
990D28B31C6526D400986977 /* APIAutomationSessionClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APIAutomationSessionClient.h; sourceTree = "<group>"; };
990D28B71C6539A000986977 /* AutomationSessionClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AutomationSessionClient.h; sourceTree = "<group>"; };
990D28B81C6539A000986977 /* AutomationSessionClient.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AutomationSessionClient.mm; sourceTree = "<group>"; };
+ 990E1E082384A88B004602DF /* _WKRemoteWebInspectorViewControllerPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKRemoteWebInspectorViewControllerPrivate.h; sourceTree = "<group>"; };
99249AD31F1F1E3300B62FBB /* AutomationFrontendDispatchers.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = AutomationFrontendDispatchers.cpp; path = DerivedSources/WebKit2/AutomationFrontendDispatchers.cpp; sourceTree = BUILT_PRODUCTS_DIR; };
99249AD41F1F1E3300B62FBB /* AutomationFrontendDispatchers.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = AutomationFrontendDispatchers.h; path = DerivedSources/WebKit2/AutomationFrontendDispatchers.h; sourceTree = BUILT_PRODUCTS_DIR; };
9946EF851E7B026600541E79 /* WebAutomationSessionIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebAutomationSessionIOS.mm; sourceTree = "<group>"; };
@@ -6371,6 +6373,7 @@
7C89D2D61A6C6BE6003A5FDE /* _WKProcessPoolConfigurationInternal.h */,
A55BA80C1BA12BE1007CD33D /* _WKRemoteWebInspectorViewController.h */,
A55BA80D1BA12BE1007CD33D /* _WKRemoteWebInspectorViewController.mm */,
+ 990E1E082384A88B004602DF /* _WKRemoteWebInspectorViewControllerPrivate.h */,
1A002D3F196B329400B9AD44 /* _WKSessionState.h */,
1A002D3E196B329400B9AD44 /* _WKSessionState.mm */,
1A002D42196B337000B9AD44 /* _WKSessionStateInternal.h */,
@@ -9739,6 +9742,7 @@
1AA56F2911E92BC80061B882 /* PluginController.h in Headers */,
1A8EF4CB1252403700F7067F /* PluginControllerProxy.h in Headers */,
1A8EF96F1252AF6B00F7067F /* PluginControllerProxyMessages.h in Headers */,
+ 990E1E092384AA57004602DF /* _WKRemoteWebInspectorViewControllerPrivate.h in Headers */,
1A179780137EE82C00F97D45 /* PluginCreationParameters.h in Headers */,
7C3F8C91173AF52D007B7F39 /* PluginInformation.h in Headers */,
1AEFCC1211D01F96008219D3 /* PluginInfoStore.h in Headers */,
Modified: trunk/Source/WebKit/WebProcess/WebPage/RemoteWebInspectorUI.cpp (252701 => 252702)
--- trunk/Source/WebKit/WebProcess/WebPage/RemoteWebInspectorUI.cpp 2019-11-20 20:33:39 UTC (rev 252701)
+++ trunk/Source/WebKit/WebProcess/WebPage/RemoteWebInspectorUI.cpp 2019-11-20 20:35:09 UTC (rev 252702)
@@ -180,6 +180,15 @@
{
m_page.corePage()->diagnosticLoggingClient().logDiagnosticMessageWithValueDictionary(eventName, "Remote Web Inspector Frontend Diagnostics"_s, dictionary, ShouldSample::No);
}
+
+void RemoteWebInspectorUI::setDiagnosticLoggingAvailable(bool available)
+{
+ // Inspector's diagnostic logging client should never be used unless the page setting is also enabled.
+ ASSERT(!available || supportsDiagnosticLogging());
+ m_diagnosticLoggingAvailable = available;
+
+ m_frontendAPIDispatcher.dispatchCommand("setDiagnosticLoggingAvailable"_s, m_diagnosticLoggingAvailable);
+}
#endif
} // namespace WebKit
Modified: trunk/Source/WebKit/WebProcess/WebPage/RemoteWebInspectorUI.h (252701 => 252702)
--- trunk/Source/WebKit/WebProcess/WebPage/RemoteWebInspectorUI.h 2019-11-20 20:33:39 UTC (rev 252701)
+++ trunk/Source/WebKit/WebProcess/WebPage/RemoteWebInspectorUI.h 2019-11-20 20:35:09 UTC (rev 252702)
@@ -53,6 +53,10 @@
void didAppend(const String& url);
void sendMessageToFrontend(const String&);
+#if ENABLE(INSPECTOR_TELEMETRY)
+ void setDiagnosticLoggingAvailable(bool);
+#endif
+
// WebCore::InspectorFrontendClient
void windowObjectCleared() override;
void frontendLoaded() override;
@@ -81,6 +85,7 @@
#if ENABLE(INSPECTOR_TELEMETRY)
bool supportsDiagnosticLogging() override;
+ bool diagnosticLoggingAvailable() override { return m_diagnosticLoggingAvailable; }
void logDiagnosticEvent(const String& eventName, const WebCore::DiagnosticLoggingClient::ValueDictionary&) override;
#endif
@@ -99,6 +104,10 @@
RefPtr<WebCore::InspectorFrontendHost> m_frontendHost;
String m_debuggableType;
String m_backendCommandsURL;
+
+#if ENABLE(INSPECTOR_TELEMETRY)
+ bool m_diagnosticLoggingAvailable { false };
+#endif
};
} // namespace WebKit
Modified: trunk/Source/WebKit/WebProcess/WebPage/RemoteWebInspectorUI.messages.in (252701 => 252702)
--- trunk/Source/WebKit/WebProcess/WebPage/RemoteWebInspectorUI.messages.in 2019-11-20 20:33:39 UTC (rev 252701)
+++ trunk/Source/WebKit/WebProcess/WebPage/RemoteWebInspectorUI.messages.in 2019-11-20 20:35:09 UTC (rev 252702)
@@ -1,4 +1,4 @@
-# Copyright (C) 2016 Apple Inc. All rights reserved.
+# Copyright (C) 2016-2019 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
@@ -23,6 +23,10 @@
messages -> RemoteWebInspectorUI {
Initialize(String debuggableType, String backendCommandsURL)
+#if ENABLE(INSPECTOR_TELEMETRY)
+ SetDiagnosticLoggingAvailable(bool available)
+#endif
+
DidSave(String url)
DidAppend(String url)
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebInspectorUI.cpp (252701 => 252702)
--- trunk/Source/WebKit/WebProcess/WebPage/WebInspectorUI.cpp 2019-11-20 20:33:39 UTC (rev 252701)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebInspectorUI.cpp 2019-11-20 20:35:09 UTC (rev 252702)
@@ -303,7 +303,11 @@
void WebInspectorUI::setDiagnosticLoggingAvailable(bool available)
{
- m_frontendAPIDispatcher.dispatchCommand("setDiagnosticLoggingAvailable"_s, available);
+ // Inspector's diagnostic logging client should never be used unless the page setting is also enabled.
+ ASSERT(!available || supportsDiagnosticLogging());
+ m_diagnosticLoggingAvailable = available;
+
+ m_frontendAPIDispatcher.dispatchCommand("setDiagnosticLoggingAvailable"_s, m_diagnosticLoggingAvailable);
}
#endif
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebInspectorUI.h (252701 => 252702)
--- trunk/Source/WebKit/WebProcess/WebPage/WebInspectorUI.h 2019-11-20 20:33:39 UTC (rev 252701)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebInspectorUI.h 2019-11-20 20:35:09 UTC (rev 252702)
@@ -82,6 +82,10 @@
void sendMessageToFrontend(const String&);
+#if ENABLE(INSPECTOR_TELEMETRY)
+ void setDiagnosticLoggingAvailable(bool avaliable);
+#endif
+
// WebCore::InspectorFrontendClient
void windowObjectCleared() override;
void frontendLoaded() override;
@@ -118,8 +122,8 @@
#if ENABLE(INSPECTOR_TELEMETRY)
bool supportsDiagnosticLogging() override;
+ bool diagnosticLoggingAvailable() override { return m_diagnosticLoggingAvailable; }
void logDiagnosticEvent(const WTF::String& eventName, const WebCore::DiagnosticLoggingClient::ValueDictionary&) override;
- void setDiagnosticLoggingAvailable(bool avaliable);
#endif
void sendMessageToBackend(const String&) override;
@@ -146,6 +150,10 @@
bool m_underTest { false };
bool m_dockingUnavailable { false };
bool m_isVisible { false };
+#if ENABLE(INSPECTOR_TELEMETRY)
+ bool m_diagnosticLoggingAvailable { false };
+#endif
+
DockSide m_dockSide { DockSide::Undocked };
unsigned m_inspectionLevel { 1 };
};