Diff
Modified: trunk/Source/WebCore/ChangeLog (244306 => 244307)
--- trunk/Source/WebCore/ChangeLog 2019-04-15 23:36:25 UTC (rev 244306)
+++ trunk/Source/WebCore/ChangeLog 2019-04-15 23:48:55 UTC (rev 244307)
@@ -1,3 +1,12 @@
+2019-04-15 Jer Noble <[email protected]>
+
+ Add a DiagnosticLogging method taking an arbitrary dictionary of values.
+ https://bugs.webkit.org/show_bug.cgi?id=196773
+
+ Reviewed by Alex Christensen.
+
+ * page/DiagnosticLoggingClient.h:
+
2019-04-15 Justin Fan <[email protected]>
Let WTF::convertSafely deduce types from arguments.
Modified: trunk/Source/WebCore/loader/EmptyClients.cpp (244306 => 244307)
--- trunk/Source/WebCore/loader/EmptyClients.cpp 2019-04-15 23:36:25 UTC (rev 244306)
+++ trunk/Source/WebCore/loader/EmptyClients.cpp 2019-04-15 23:48:55 UTC (rev 244307)
@@ -131,6 +131,7 @@
void logDiagnosticMessageWithResult(const String&, const String&, DiagnosticLoggingResultType, ShouldSample) final { }
void logDiagnosticMessageWithValue(const String&, const String&, double, unsigned, ShouldSample) final { }
void logDiagnosticMessageWithEnhancedPrivacy(const String&, const String&, ShouldSample) final { }
+ void logDiagnosticMessageWithValueDictionary(const String&, const String&, const ValueDictionary&, ShouldSample) final { }
};
#if ENABLE(DRAG_SUPPORT)
Modified: trunk/Source/WebCore/page/DiagnosticLoggingClient.h (244306 => 244307)
--- trunk/Source/WebCore/page/DiagnosticLoggingClient.h 2019-04-15 23:36:25 UTC (rev 244306)
+++ trunk/Source/WebCore/page/DiagnosticLoggingClient.h 2019-04-15 23:48:55 UTC (rev 244307)
@@ -28,7 +28,9 @@
#include "DiagnosticLoggingResultType.h"
#include <wtf/FastMalloc.h>
#include <wtf/Forward.h>
+#include <wtf/HashMap.h>
#include <wtf/RandomNumber.h>
+#include <wtf/Variant.h>
namespace WebCore {
@@ -42,6 +44,11 @@
virtual void logDiagnosticMessageWithValue(const String& message, const String& description, double value, unsigned significantFigures, ShouldSample) = 0;
virtual void logDiagnosticMessageWithEnhancedPrivacy(const String& message, const String& description, ShouldSample) = 0;
+ using ValuePayload = Variant<String, uint64_t, int64_t, bool, double>;
+ using ValueDictionary = HashMap<String, ValuePayload>;
+
+ virtual void logDiagnosticMessageWithValueDictionary(const String& message, const String& description, const ValueDictionary&, ShouldSample) = 0;
+
static bool shouldLogAfterSampling(ShouldSample);
virtual ~DiagnosticLoggingClient() = default;
Modified: trunk/Source/WebCore/testing/Internals.cpp (244306 => 244307)
--- trunk/Source/WebCore/testing/Internals.cpp 2019-04-15 23:36:25 UTC (rev 244306)
+++ trunk/Source/WebCore/testing/Internals.cpp 2019-04-15 23:48:55 UTC (rev 244307)
@@ -56,6 +56,7 @@
#include "DOMStringList.h"
#include "DOMWindow.h"
#include "DeprecatedGlobalSettings.h"
+#include "DiagnosticLoggingClient.h"
#include "DisabledAdaptations.h"
#include "DisplayList.h"
#include "Document.h"
@@ -4999,4 +5000,24 @@
PlatformMediaSessionManager::sharedManager().processDidResume();
}
+void Internals::testDictionaryLogging()
+{
+ auto* document = contextDocument();
+ if (!document)
+ return;
+
+ auto* page = document->page();
+ if (!page)
+ return;
+
+ DiagnosticLoggingClient::ValueDictionary dictionary;
+ dictionary.set("stringKey"_s, String("stringValue"));
+ dictionary.set("uint64Key"_s, std::numeric_limits<uint64_t>::max());
+ dictionary.set("int64Key"_s, std::numeric_limits<int64_t>::min());
+ dictionary.set("boolKey"_s, true);
+ dictionary.set("doubleKey"_s, 2.7182818284590452353602874);
+
+ page->diagnosticLoggingClient().logDiagnosticMessageWithValueDictionary("testMessage"_s, "testDescription"_s, dictionary, ShouldSample::No);
+}
+
} // namespace WebCore
Modified: trunk/Source/WebCore/testing/Internals.h (244306 => 244307)
--- trunk/Source/WebCore/testing/Internals.h 2019-04-15 23:36:25 UTC (rev 244306)
+++ trunk/Source/WebCore/testing/Internals.h 2019-04-15 23:48:55 UTC (rev 244307)
@@ -814,6 +814,8 @@
void processWillSuspend();
void processDidResume();
+ void testDictionaryLogging();
+
private:
explicit Internals(Document&);
Document* contextDocument() const;
Modified: trunk/Source/WebCore/testing/Internals.idl (244306 => 244307)
--- trunk/Source/WebCore/testing/Internals.idl 2019-04-15 23:36:25 UTC (rev 244306)
+++ trunk/Source/WebCore/testing/Internals.idl 2019-04-15 23:48:55 UTC (rev 244307)
@@ -744,4 +744,6 @@
void processWillSuspend();
void processDidResume();
+
+ void testDictionaryLogging();
};
Modified: trunk/Source/WebKit/ChangeLog (244306 => 244307)
--- trunk/Source/WebKit/ChangeLog 2019-04-15 23:36:25 UTC (rev 244306)
+++ trunk/Source/WebKit/ChangeLog 2019-04-15 23:48:55 UTC (rev 244307)
@@ -1,3 +1,45 @@
+2019-04-15 Jer Noble <[email protected]>
+
+ Add a DiagnosticLogging method taking an arbitrary dictionary of values.
+ https://bugs.webkit.org/show_bug.cgi?id=196773
+
+ Reviewed by Alex Christensen.
+
+ In addition to adding the new logging delegate method (and piping everything into it),
+ add a new APIObject class to represent a signed integer.
+
+ * Shared/API/APINumber.h:
+ * Shared/API/APIObject.h:
+ * Shared/Cocoa/APIObject.mm:
+ (API::Object::newObject):
+ * Shared/Cocoa/WKNSNumber.mm:
+ (-[WKNSNumber dealloc]):
+ (-[WKNSNumber objCType]):
+ (-[WKNSNumber getValue:]):
+ (-[WKNSNumber longLongValue]):
+ (-[WKNSNumber _apiObject]):
+ * Shared/UserData.cpp:
+ (WebKit::UserData::encode):
+ (WebKit::UserData::decode):
+ * UIProcess/API/APIDiagnosticLoggingClient.h:
+ * UIProcess/API/C/WKPageDiagnosticLoggingClient.h:
+ * UIProcess/API/Cocoa/_WKDiagnosticLoggingDelegate.h:
+ * UIProcess/Cocoa/DiagnosticLoggingClient.h:
+ * UIProcess/Cocoa/DiagnosticLoggingClient.mm:
+ (WebKit::DiagnosticLoggingClient::logDiagnosticMessageWithValueDictionary):
+ * UIProcess/ProvisionalPageProxy.cpp:
+ (WebKit::ProvisionalPageProxy::didReceiveMessage):
+ * UIProcess/WebPageDiagnosticLoggingClient.cpp:
+ (WebKit::WebPageDiagnosticLoggingClient::logDiagnosticMessageWithValueDictionary):
+ * UIProcess/WebPageDiagnosticLoggingClient.h:
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::logDiagnosticMessageWithValueDictionary):
+ * UIProcess/WebPageProxy.h:
+ * UIProcess/WebPageProxy.messages.in:
+ * WebProcess/WebCoreSupport/WebDiagnosticLoggingClient.cpp:
+ (WebKit::WebDiagnosticLoggingClient::logDiagnosticMessageWithValueDictionary):
+ * WebProcess/WebCoreSupport/WebDiagnosticLoggingClient.h:
+
2019-04-15 Dean Jackson <[email protected]>
Provide option to not create a longpress gesture recognizer
Modified: trunk/Source/WebKit/Shared/API/APINumber.h (244306 => 244307)
--- trunk/Source/WebKit/Shared/API/APINumber.h 2019-04-15 23:36:25 UTC (rev 244306)
+++ trunk/Source/WebKit/Shared/API/APINumber.h 2019-04-15 23:48:55 UTC (rev 244307)
@@ -69,6 +69,7 @@
typedef Number<bool, API::Object::Type::Boolean> Boolean;
typedef Number<double, API::Object::Type::Double> Double;
typedef Number<uint64_t, API::Object::Type::UInt64> UInt64;
+typedef Number<int64_t, API::Object::Type::Int64> Int64;
} // namespace API
Modified: trunk/Source/WebKit/Shared/API/APIObject.h (244306 => 244307)
--- trunk/Source/WebKit/Shared/API/APIObject.h 2019-04-15 23:36:25 UTC (rev 244306)
+++ trunk/Source/WebKit/Shared/API/APIObject.h 2019-04-15 23:48:55 UTC (rev 244307)
@@ -88,6 +88,7 @@
Boolean,
Double,
UInt64,
+ Int64,
// Geometry types
Point,
Modified: trunk/Source/WebKit/Shared/Cocoa/APIObject.mm (244306 => 244307)
--- trunk/Source/WebKit/Shared/Cocoa/APIObject.mm 2019-04-15 23:36:25 UTC (rev 244306)
+++ trunk/Source/WebKit/Shared/Cocoa/APIObject.mm 2019-04-15 23:48:55 UTC (rev 244307)
@@ -163,6 +163,7 @@
case Type::Boolean:
case Type::Double:
case Type::UInt64:
+ case Type::Int64:
wrapper = [WKNSNumber alloc];
((WKNSNumber *)wrapper)->_type = type;
break;
Modified: trunk/Source/WebKit/Shared/Cocoa/WKNSNumber.mm (244306 => 244307)
--- trunk/Source/WebKit/Shared/Cocoa/WKNSNumber.mm 2019-04-15 23:36:25 UTC (rev 244306)
+++ trunk/Source/WebKit/Shared/Cocoa/WKNSNumber.mm 2019-04-15 23:48:55 UTC (rev 244307)
@@ -33,6 +33,7 @@
API::ObjectStorage<API::Boolean> _boolean;
API::ObjectStorage<API::Double> _double;
API::ObjectStorage<API::UInt64> _uint64;
+ API::ObjectStorage<API::Int64> _int64;
} _number;
}
@@ -51,6 +52,10 @@
_number._uint64->~Number<uint64_t, API::Object::Type::UInt64>();
break;
+ case API::Object::Type::Int64:
+ _number._int64->~Number<int64_t, API::Object::Type::Int64>();
+ break;
+
default:
ASSERT_NOT_REACHED();
}
@@ -75,6 +80,10 @@
return @encode(uint64_t);
break;
+ case API::Object::Type::Int64:
+ return @encode(int64_t);
+ break;
+
default:
ASSERT_NOT_REACHED();
}
@@ -97,6 +106,10 @@
*reinterpret_cast<uint64_t*>(value) = _number._uint64->value();
break;
+ case API::Object::Type::Int64:
+ *reinterpret_cast<int64_t*>(value) = _number._int64->value();
+ break;
+
default:
ASSERT_NOT_REACHED();
}
@@ -128,6 +141,14 @@
return super.unsignedLongLongValue;
}
+- (long long)longLongValue
+{
+ if (_type == API::Object::Type::Int64)
+ return _number._int64->value();
+
+ return super.longLongValue;
+}
+
// MARK: NSCopying protocol implementation
- (id)copyWithZone:(NSZone *)zone
@@ -152,6 +173,10 @@
return *_number._uint64;
break;
+ case API::Object::Type::Int64:
+ return *_number._int64;
+ break;
+
default:
ASSERT_NOT_REACHED();
}
Modified: trunk/Source/WebKit/Shared/UserData.cpp (244306 => 244307)
--- trunk/Source/WebKit/Shared/UserData.cpp 2019-04-15 23:36:25 UTC (rev 244306)
+++ trunk/Source/WebKit/Shared/UserData.cpp 2019-04-15 23:48:55 UTC (rev 244307)
@@ -310,6 +310,10 @@
static_cast<const API::UInt64&>(object).encode(encoder);
break;
+ case API::Object::Type::Int64:
+ static_cast<const API::Int64&>(object).encode(encoder);
+ break;
+
case API::Object::Type::UserContentURLPattern: {
auto& urlPattern = static_cast<const API::UserContentURLPattern&>(object);
encoder << urlPattern.patternString();
@@ -572,6 +576,11 @@
return false;
break;
+ case API::Object::Type::Int64:
+ if (!API::Int64::decode(decoder, result))
+ return false;
+ break;
+
case API::Object::Type::UserContentURLPattern: {
String string;
if (!decoder.decode(string))
Modified: trunk/Source/WebKit/UIProcess/API/APIDiagnosticLoggingClient.h (244306 => 244307)
--- trunk/Source/WebKit/UIProcess/API/APIDiagnosticLoggingClient.h 2019-04-15 23:36:25 UTC (rev 244306)
+++ trunk/Source/WebKit/UIProcess/API/APIDiagnosticLoggingClient.h 2019-04-15 23:48:55 UTC (rev 244307)
@@ -23,8 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef APIDiagnosticLoggingClient_h
-#define APIDiagnosticLoggingClient_h
+#pragma once
#include <WebCore/DiagnosticLoggingResultType.h>
#include <wtf/text/WTFString.h>
@@ -35,6 +34,8 @@
namespace API {
+class Dictionary;
+
class DiagnosticLoggingClient {
public:
virtual ~DiagnosticLoggingClient() { }
@@ -43,9 +44,8 @@
virtual void logDiagnosticMessageWithResult(WebKit::WebPageProxy*, const WTF::String& message, const WTF::String& description, WebCore::DiagnosticLoggingResultType) = 0;
virtual void logDiagnosticMessageWithValue(WebKit::WebPageProxy*, const WTF::String& message, const WTF::String& description, const WTF::String& value) = 0;
virtual void logDiagnosticMessageWithEnhancedPrivacy(WebKit::WebPageProxy*, const WTF::String& message, const WTF::String& description) = 0;
+
+ virtual void logDiagnosticMessageWithValueDictionary(WebKit::WebPageProxy*, const WTF::String& message, const WTF::String& description, Ref<API::Dictionary>&&) = 0;
};
} // namespace API
-
-#endif // APIDiagnosticLoggingClient_h
-
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/_WKDiagnosticLoggingDelegate.h (244306 => 244307)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/_WKDiagnosticLoggingDelegate.h 2019-04-15 23:36:25 UTC (rev 244306)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/_WKDiagnosticLoggingDelegate.h 2019-04-15 23:48:55 UTC (rev 244307)
@@ -40,5 +40,6 @@
- (void)_webView:(WKWebView *)webView logDiagnosticMessageWithResult:(NSString *)message description:(NSString *)description result:(_WKDiagnosticLoggingResultType)result;
- (void)_webView:(WKWebView *)webView logDiagnosticMessageWithValue:(NSString *)message description:(NSString *)description value:(NSString *) value;
- (void)_webView:(WKWebView *)webView logDiagnosticMessageWithEnhancedPrivacy:(NSString *)message description:(NSString *)description WK_API_AVAILABLE(macos(10.13), ios(11.0));
+- (void)_webView:(WKWebView *)webView logDiagnosticMessage:(NSString *)message description:(NSString *)description valueDictionary:(NSDictionary *)valueDictionary WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
@end
Modified: trunk/Source/WebKit/UIProcess/Cocoa/DiagnosticLoggingClient.h (244306 => 244307)
--- trunk/Source/WebKit/UIProcess/Cocoa/DiagnosticLoggingClient.h 2019-04-15 23:36:25 UTC (rev 244306)
+++ trunk/Source/WebKit/UIProcess/Cocoa/DiagnosticLoggingClient.h 2019-04-15 23:48:55 UTC (rev 244307)
@@ -51,6 +51,7 @@
void logDiagnosticMessageWithResult(WebPageProxy*, const String& message, const String& description, WebCore::DiagnosticLoggingResultType) override;
void logDiagnosticMessageWithValue(WebPageProxy*, const String& message, const String& description, const String& value) override;
void logDiagnosticMessageWithEnhancedPrivacy(WebPageProxy*, const String& message, const String& description) override;
+ void logDiagnosticMessageWithValueDictionary(WebPageProxy*, const String& message, const String& description, Ref<API::Dictionary>&&) override;
WKWebView *m_webView;
WeakObjCPtr<id <_WKDiagnosticLoggingDelegate>> m_delegate;
@@ -60,6 +61,7 @@
unsigned webviewLogDiagnosticMessageWithResult : 1;
unsigned webviewLogDiagnosticMessageWithValue : 1;
unsigned webviewLogDiagnosticMessageWithEnhancedPrivacy : 1;
+ unsigned webviewLogDiagnosticMessageWithValueDictionary : 1;
} m_delegateMethods;
};
Modified: trunk/Source/WebKit/UIProcess/Cocoa/DiagnosticLoggingClient.mm (244306 => 244307)
--- trunk/Source/WebKit/UIProcess/Cocoa/DiagnosticLoggingClient.mm 2019-04-15 23:36:25 UTC (rev 244306)
+++ trunk/Source/WebKit/UIProcess/Cocoa/DiagnosticLoggingClient.mm 2019-04-15 23:48:55 UTC (rev 244307)
@@ -26,6 +26,7 @@
#import "config.h"
#import "DiagnosticLoggingClient.h"
+#import "APIDictionary.h"
#import "WKSharedAPICast.h"
#import "_WKDiagnosticLoggingDelegate.h"
@@ -49,6 +50,7 @@
m_delegateMethods.webviewLogDiagnosticMessageWithResult = [delegate respondsToSelector:@selector(_webView:logDiagnosticMessageWithResult:description:result:)];
m_delegateMethods.webviewLogDiagnosticMessageWithValue = [delegate respondsToSelector:@selector(_webView:logDiagnosticMessageWithValue:description:value:)];
m_delegateMethods.webviewLogDiagnosticMessageWithEnhancedPrivacy = [delegate respondsToSelector:@selector(_webView:logDiagnosticMessageWithEnhancedPrivacy:description:)];
+ m_delegateMethods.webviewLogDiagnosticMessageWithValueDictionary = [delegate respondsToSelector:@selector(_webView:logDiagnosticMessage:description:valueDictionary:)];
}
void DiagnosticLoggingClient::logDiagnosticMessage(WebKit::WebPageProxy*, const WTF::String& message, const WTF::String& description)
@@ -87,4 +89,11 @@
[m_delegate.get() _webView:m_webView logDiagnosticMessageWithEnhancedPrivacy:message description:description];
}
+void DiagnosticLoggingClient::logDiagnosticMessageWithValueDictionary(WebPageProxy*, const String& message, const String& description, Ref<API::Dictionary>&& valueDictionary)
+{
+ if (m_delegateMethods.webviewLogDiagnosticMessageWithValueDictionary)
+ [m_delegate.get() _webView:m_webView logDiagnosticMessage:message description:description valueDictionary:static_cast<NSDictionary*>(valueDictionary->wrapper())];
+}
+
+
} // namespace WebKit
Modified: trunk/Source/WebKit/UIProcess/ProvisionalPageProxy.cpp (244306 => 244307)
--- trunk/Source/WebKit/UIProcess/ProvisionalPageProxy.cpp 2019-04-15 23:36:25 UTC (rev 244306)
+++ trunk/Source/WebKit/UIProcess/ProvisionalPageProxy.cpp 2019-04-15 23:48:55 UTC (rev 244307)
@@ -381,6 +381,7 @@
|| decoder.messageName() == Messages::WebPageProxy::BackForwardAddItem::name()
|| decoder.messageName() == Messages::WebPageProxy::LogDiagnosticMessage::name()
|| decoder.messageName() == Messages::WebPageProxy::LogDiagnosticMessageWithEnhancedPrivacy::name()
+ || decoder.messageName() == Messages::WebPageProxy::LogDiagnosticMessageWithValueDictionary::name()
|| decoder.messageName() == Messages::WebPageProxy::SetNetworkRequestsInProgress::name()
#if USE(QUICK_LOOK)
|| decoder.messageName() == Messages::WebPageProxy::DidStartLoadForQuickLookDocumentInMainFrame::name()
Modified: trunk/Source/WebKit/UIProcess/WebPageDiagnosticLoggingClient.h (244306 => 244307)
--- trunk/Source/WebKit/UIProcess/WebPageDiagnosticLoggingClient.h 2019-04-15 23:36:25 UTC (rev 244306)
+++ trunk/Source/WebKit/UIProcess/WebPageDiagnosticLoggingClient.h 2019-04-15 23:48:55 UTC (rev 244307)
@@ -52,6 +52,7 @@
void logDiagnosticMessageWithResult(WebPageProxy*, const String& message, const String& description, WebCore::DiagnosticLoggingResultType) override;
void logDiagnosticMessageWithValue(WebPageProxy*, const String& message, const String& description, const String& value) override;
void logDiagnosticMessageWithEnhancedPrivacy(WebPageProxy*, const String& message, const String& description) override;
+ void logDiagnosticMessageWithValueDictionary(WebKit::WebPageProxy*, const WTF::String& message, const WTF::String& description, Ref<API::Dictionary>&&) override { }
};
} // namespace WebKit
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (244306 => 244307)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2019-04-15 23:36:25 UTC (rev 244306)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2019-04-15 23:48:55 UTC (rev 244307)
@@ -6532,6 +6532,27 @@
effectiveClient->logDiagnosticMessageWithEnhancedPrivacy(this, message, description);
}
+void WebPageProxy::logDiagnosticMessageWithValueDictionary(const String& message, const String& description, const WebCore::DiagnosticLoggingClient::ValueDictionary& valueDictionary, WebCore::ShouldSample shouldSample)
+{
+ auto* effectiveClient = effectiveDiagnosticLoggingClient(shouldSample);
+ if (!effectiveClient)
+ return;
+
+ auto apiDictionary = API::Dictionary::create();
+
+ for (auto& keyValuePair : valueDictionary) {
+ apiDictionary->add(keyValuePair.key, WTF::switchOn(keyValuePair.value,
+ [](const String& value) -> Ref<Object> { return API::String::create(value); },
+ [](uint64_t value) -> Ref<Object> { return API::UInt64::create(value); },
+ [](int64_t value) -> Ref<Object> { return API::Int64::create(value); },
+ [](bool value) -> Ref<Object> { return API::Boolean::create(value); },
+ [](double value) -> Ref<Object> { return API::Double::create(value); }
+ ));
+ }
+
+ effectiveClient->logDiagnosticMessageWithValueDictionary(this, message, description, WTFMove(apiDictionary));
+}
+
void WebPageProxy::logScrollingEvent(uint32_t eventType, MonotonicTime timestamp, uint64_t data)
{
PerformanceLoggingClient::ScrollingEvent event = static_cast<PerformanceLoggingClient::ScrollingEvent>(eventType);
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (244306 => 244307)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.h 2019-04-15 23:36:25 UTC (rev 244306)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h 2019-04-15 23:48:55 UTC (rev 244307)
@@ -70,6 +70,7 @@
#include <WebCore/ActivityState.h>
#include <WebCore/AutoplayEvent.h>
#include <WebCore/Color.h>
+#include <WebCore/DiagnosticLoggingClient.h>
#include <WebCore/DragActions.h>
#include <WebCore/EventTrackingRegions.h>
#include <WebCore/FontAttributes.h>
@@ -1345,6 +1346,7 @@
void logDiagnosticMessageWithResult(const String& message, const String& description, uint32_t result, WebCore::ShouldSample);
void logDiagnosticMessageWithValue(const String& message, const String& description, double value, unsigned significantFigures, WebCore::ShouldSample);
void logDiagnosticMessageWithEnhancedPrivacy(const String& message, const String& description, WebCore::ShouldSample);
+ void logDiagnosticMessageWithValueDictionary(const String& message, const String& description, const WebCore::DiagnosticLoggingClient::ValueDictionary&, WebCore::ShouldSample);
// Performance logging.
void logScrollingEvent(uint32_t eventType, MonotonicTime, uint64_t);
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in (244306 => 244307)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in 2019-04-15 23:36:25 UTC (rev 244306)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in 2019-04-15 23:48:55 UTC (rev 244307)
@@ -242,6 +242,7 @@
LogDiagnosticMessageWithResult(String message, String description, uint32_t result, enum:bool WebCore::ShouldSample shouldSample)
LogDiagnosticMessageWithValue(String message, String description, double value, unsigned significantFigures, enum:bool WebCore::ShouldSample shouldSample)
LogDiagnosticMessageWithEnhancedPrivacy(String message, String description, enum:bool WebCore::ShouldSample shouldSample)
+ LogDiagnosticMessageWithValueDictionary(String message, String description, WebCore::DiagnosticLoggingClient::ValueDictionary value, enum:bool WebCore::ShouldSample shouldSample)
# Performance logging
LogScrollingEvent(uint32_t eventType, MonotonicTime timestamp, uint64_t data)
Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebDiagnosticLoggingClient.cpp (244306 => 244307)
--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebDiagnosticLoggingClient.cpp 2019-04-15 23:36:25 UTC (rev 244306)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebDiagnosticLoggingClient.cpp 2019-04-15 23:48:55 UTC (rev 244307)
@@ -83,4 +83,14 @@
m_page.send(Messages::WebPageProxy::LogDiagnosticMessageWithEnhancedPrivacy(message, description, ShouldSample::No));
}
+void WebDiagnosticLoggingClient::logDiagnosticMessageWithValueDictionary(const String& message, const String& description, const ValueDictionary& value, ShouldSample shouldSample)
+{
+ ASSERT(!m_page.corePage() || m_page.corePage()->settings().diagnosticLoggingEnabled());
+
+ if (!shouldLogAfterSampling(shouldSample))
+ return;
+
+ m_page.send(Messages::WebPageProxy::LogDiagnosticMessageWithValueDictionary(message, description, value, ShouldSample::No));
+}
+
} // namespace WebKit
Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebDiagnosticLoggingClient.h (244306 => 244307)
--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebDiagnosticLoggingClient.h 2019-04-15 23:36:25 UTC (rev 244306)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebDiagnosticLoggingClient.h 2019-04-15 23:48:55 UTC (rev 244307)
@@ -43,6 +43,7 @@
void logDiagnosticMessageWithResult(const String& message, const String& description, WebCore::DiagnosticLoggingResultType, WebCore::ShouldSample) override;
void logDiagnosticMessageWithValue(const String& message, const String& description, double value, unsigned significantFigures, WebCore::ShouldSample) override;
void logDiagnosticMessageWithEnhancedPrivacy(const String& message, const String& description, WebCore::ShouldSample) override;
+ void logDiagnosticMessageWithValueDictionary(const String& message, const String& description, const ValueDictionary&, WebCore::ShouldSample) override;
WebPage& m_page;
};
Modified: trunk/Tools/ChangeLog (244306 => 244307)
--- trunk/Tools/ChangeLog 2019-04-15 23:36:25 UTC (rev 244306)
+++ trunk/Tools/ChangeLog 2019-04-15 23:48:55 UTC (rev 244307)
@@ -1,3 +1,14 @@
+2019-04-15 Alex Christensen <[email protected]>
+
+ Add a DiagnosticLogging method taking an arbitrary dictionary of values.
+ https://bugs.webkit.org/show_bug.cgi?id=196773
+
+ Reviewed by Jer Noble.
+
+ * TestWebKitAPI/Tests/WebKitCocoa/WKWebViewDiagnosticLogging.mm:
+ (-[TestLoggingDelegate _webView:logDiagnosticMessage:description:valueDictionary:]):
+ (TEST):
+
2019-04-15 Aakash Jain <[email protected]>
ews-build should clearly indicate flaky test failures
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebViewDiagnosticLogging.mm (244306 => 244307)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebViewDiagnosticLogging.mm 2019-04-15 23:36:25 UTC (rev 244306)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebViewDiagnosticLogging.mm 2019-04-15 23:48:55 UTC (rev 244307)
@@ -28,14 +28,30 @@
#import "PlatformUtilities.h"
#import "Test.h"
#import "TestNavigationDelegate.h"
+#import "WKWebViewConfigurationExtras.h"
+#import <WebKit/WKPreferencesPrivate.h>
#import <WebKit/WKWebViewPrivate.h>
#import <WebKit/_WKDiagnosticLoggingDelegate.h>
#import <wtf/RetainPtr.h>
+static bool isDone;
+
@interface TestLoggingDelegate : NSObject <_WKDiagnosticLoggingDelegate>
@end
@implementation TestLoggingDelegate
+
+- (void)_webView:(WKWebView *)webView logDiagnosticMessage:(NSString *)message description:(NSString *)description valueDictionary:(NSDictionary *)valueDictionary
+{
+ EXPECT_TRUE([[valueDictionary objectForKey:@"stringKey"] isEqualToString:@"stringValue"]);
+ EXPECT_TRUE([[valueDictionary objectForKey:@"uint64Key"] unsignedLongLongValue] == std::numeric_limits<uint64_t>::max());
+ EXPECT_TRUE([[valueDictionary objectForKey:@"int64Key"] longLongValue] == std::numeric_limits<int64_t>::min());
+ EXPECT_TRUE([[valueDictionary objectForKey:@"boolKey"] boolValue]);
+ EXPECT_TRUE([[valueDictionary objectForKey:@"doubleKey"] doubleValue] == 2.7182818284590452353602874);
+
+ isDone = true;
+}
+
@end
TEST(WKWebView, PrivateSessionDiagnosticLoggingDelegate)
@@ -69,3 +85,13 @@
EXPECT_EQ(nil, webView.get()._diagnosticLoggingDelegate);
}
+TEST(WKWebView, DiagnosticLoggingDictionary)
+{
+ auto webView = adoptNS([[WKWebView alloc] initWithFrame:CGRectZero configuration:[WKWebViewConfiguration _test_configurationWithTestPlugInClassName:@"WebProcessPlugInWithInternals"]]);
+ auto testLoggingDelegate = adoptNS([TestLoggingDelegate new]);
+ [webView _setDiagnosticLoggingDelegate:testLoggingDelegate.get()];
+ [webView configuration].preferences._diagnosticLoggingEnabled = YES;
+
+ [webView loadHTMLString:@"<script>window.internals.testDictionaryLogging()</script>" baseURL:nil];
+ TestWebKitAPI::Util::run(&isDone);
+}