Title: [239871] trunk/Tools
- Revision
- 239871
- Author
- [email protected]
- Date
- 2019-01-11 13:04:09 -0800 (Fri, 11 Jan 2019)
Log Message
Cleanup possible WK*Copy/Create leaks in WebKitTestRunner
https://bugs.webkit.org/show_bug.cgi?id=193340
Patch by Joseph Pecoraro <[email protected]> on 2019-01-11
Reviewed by David Kilzer.
* WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
(WTR::InjectedBundle::didReceiveMessageToPage):
Pull the strings out into a WKRetainPtr.
* WebKitTestRunner/WebNotificationProvider.cpp:
(WTR::WebNotificationProvider::closeWebNotification):
Adopt the created value into the WKRetainPtr.
* WebKitTestRunner/mac/TestControllerMac.mm:
(WTR::generateWhitelist):
Immediately adopt a created value to avoid potential mistakes.
Modified Paths
Diff
Modified: trunk/Tools/ChangeLog (239870 => 239871)
--- trunk/Tools/ChangeLog 2019-01-11 21:02:28 UTC (rev 239870)
+++ trunk/Tools/ChangeLog 2019-01-11 21:04:09 UTC (rev 239871)
@@ -1,3 +1,22 @@
+2019-01-11 Joseph Pecoraro <[email protected]>
+
+ Cleanup possible WK*Copy/Create leaks in WebKitTestRunner
+ https://bugs.webkit.org/show_bug.cgi?id=193340
+
+ Reviewed by David Kilzer.
+
+ * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
+ (WTR::InjectedBundle::didReceiveMessageToPage):
+ Pull the strings out into a WKRetainPtr.
+
+ * WebKitTestRunner/WebNotificationProvider.cpp:
+ (WTR::WebNotificationProvider::closeWebNotification):
+ Adopt the created value into the WKRetainPtr.
+
+ * WebKitTestRunner/mac/TestControllerMac.mm:
+ (WTR::generateWhitelist):
+ Immediately adopt a created value to avoid potential mistakes.
+
2019-01-11 Dominik Infuehr <[email protected]>
Enable DFG on ARM/Linux again
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp (239870 => 239871)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp 2019-01-11 21:02:28 UTC (rev 239870)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp 2019-01-11 21:04:09 UTC (rev 239871)
@@ -428,11 +428,15 @@
if (WKStringIsEqualToUTF8CString(messageName, "ResourceLoadStatisticsTelemetryFinished")) {
WKDictionaryRef messageBodyDictionary = static_cast<WKDictionaryRef>(messageBody);
-
- unsigned totalPrevalentResources = (unsigned)WKUInt64GetValue(static_cast<WKUInt64Ref>(WKDictionaryGetItemForKey(messageBodyDictionary, WKStringCreateWithUTF8CString("TotalPrevalentResources"))));
- unsigned totalPrevalentResourcesWithUserInteraction = (unsigned)WKUInt64GetValue(static_cast<WKUInt64Ref>(WKDictionaryGetItemForKey(messageBodyDictionary, WKStringCreateWithUTF8CString("TotalPrevalentResourcesWithUserInteraction"))));
- unsigned top3SubframeUnderTopFrameOrigins = (unsigned)WKUInt64GetValue(static_cast<WKUInt64Ref>(WKDictionaryGetItemForKey(messageBodyDictionary, WKStringCreateWithUTF8CString("Top3SubframeUnderTopFrameOrigins"))));
-
+
+ WKRetainPtr<WKStringRef> totalPrevalentResourcesKey(AdoptWK, WKStringCreateWithUTF8CString("TotalPrevalentResources"));
+ WKRetainPtr<WKStringRef> totalPrevalentResourcesWithUserInteractionKey(AdoptWK, WKStringCreateWithUTF8CString("TotalPrevalentResourcesWithUserInteraction"));
+ WKRetainPtr<WKStringRef> top3SubframeUnderTopFrameOriginsKey(AdoptWK, WKStringCreateWithUTF8CString("Top3SubframeUnderTopFrameOrigins"));
+
+ unsigned totalPrevalentResources = (unsigned)WKUInt64GetValue(static_cast<WKUInt64Ref>(WKDictionaryGetItemForKey(messageBodyDictionary, totalPrevalentResourcesKey.get())));
+ unsigned totalPrevalentResourcesWithUserInteraction = (unsigned)WKUInt64GetValue(static_cast<WKUInt64Ref>(WKDictionaryGetItemForKey(messageBodyDictionary, totalPrevalentResourcesWithUserInteractionKey.get())));
+ unsigned top3SubframeUnderTopFrameOrigins = (unsigned)WKUInt64GetValue(static_cast<WKUInt64Ref>(WKDictionaryGetItemForKey(messageBodyDictionary, top3SubframeUnderTopFrameOriginsKey.get())));
+
m_testRunner->statisticsDidRunTelemetryCallback(totalPrevalentResources, totalPrevalentResourcesWithUserInteraction, top3SubframeUnderTopFrameOrigins);
return;
}
Modified: trunk/Tools/WebKitTestRunner/WebNotificationProvider.cpp (239870 => 239871)
--- trunk/Tools/WebKitTestRunner/WebNotificationProvider.cpp 2019-01-11 21:02:28 UTC (rev 239870)
+++ trunk/Tools/WebKitTestRunner/WebNotificationProvider.cpp 2019-01-11 21:04:09 UTC (rev 239871)
@@ -126,7 +126,7 @@
removeGlobalIDFromIDMap(m_localToGlobalNotificationIDMap, id);
- WKRetainPtr<WKUInt64Ref> wkID = WKUInt64Create(id);
+ WKRetainPtr<WKUInt64Ref> wkID(AdoptWK, WKUInt64Create(id));
WKRetainPtr<WKMutableArrayRef> array(AdoptWK, WKMutableArrayCreate());
WKArrayAppendItem(array.get(), wkID.get());
WKNotificationManagerProviderDidCloseNotifications(notificationManager, array.get());
Modified: trunk/Tools/WebKitTestRunner/mac/TestControllerMac.mm (239870 => 239871)
--- trunk/Tools/WebKitTestRunner/mac/TestControllerMac.mm 2019-01-11 21:02:28 UTC (rev 239870)
+++ trunk/Tools/WebKitTestRunner/mac/TestControllerMac.mm 2019-01-11 21:04:09 UTC (rev 239871)
@@ -293,22 +293,22 @@
static WKRetainPtr<WKArrayRef> generateWhitelist()
{
- WKMutableArrayRef result = WKMutableArrayCreate();
+ WKRetainPtr<WKMutableArrayRef> result = adoptWK(WKMutableArrayCreate());
for (NSString *fontFamily in allowedFontFamilySet()) {
NSArray *fontsForFamily = [[NSFontManager sharedFontManager] availableMembersOfFontFamily:fontFamily];
WKRetainPtr<WKStringRef> familyInFont = adoptWK(WKStringCreateWithUTF8CString([fontFamily UTF8String]));
- WKArrayAppendItem(result, familyInFont.get());
+ WKArrayAppendItem(result.get(), familyInFont.get());
for (NSArray *fontInfo in fontsForFamily) {
// Font name is the first entry in the array.
WKRetainPtr<WKStringRef> fontName = adoptWK(WKStringCreateWithUTF8CString([[fontInfo objectAtIndex:0] UTF8String]));
- WKArrayAppendItem(result, fontName.get());
+ WKArrayAppendItem(result.get(), fontName.get());
}
}
for (NSString *hiddenFontFamily in systemHiddenFontFamilySet())
- WKArrayAppendItem(result, adoptWK(WKStringCreateWithUTF8CString([hiddenFontFamily UTF8String])).get());
+ WKArrayAppendItem(result.get(), adoptWK(WKStringCreateWithUTF8CString([hiddenFontFamily UTF8String])).get());
- return adoptWK(result);
+ return result;
}
void TestController::platformInitializeContext()
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes