WebKit Bugzilla
Attachment 358838 Details for
Bug 193340
: Cleanup possible WK*Copy/Create leaks in WebKitTestRunner
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
[PATCH] Proposed Fix
wktr-1.patch (text/plain), 5.90 KB, created by
Joseph Pecoraro
on 2019-01-10 14:46:43 PST
(
hide
)
Description:
[PATCH] Proposed Fix
Filename:
MIME Type:
Creator:
Joseph Pecoraro
Created:
2019-01-10 14:46:43 PST
Size:
5.90 KB
patch
obsolete
>diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index 878fe252611..ec0c7524226 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,22 @@ >+2019-01-10 Joseph Pecoraro <pecoraro@apple.com> >+ >+ Cleanup possible WK*Copy/Create leaks in WebKitTestRunner >+ https://bugs.webkit.org/show_bug.cgi?id=193340 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * 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-10 Joseph Pecoraro <pecoraro@apple.com> > > Leak of WKWebProcessPlugInHitTestResult (160 bytes) in com.apple.WebKit.WebContent running layout tests >diff --git a/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp b/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp >index 351ee066cc4..e415f905130 100644 >--- a/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp >+++ b/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp >@@ -428,11 +428,15 @@ void InjectedBundle::didReceiveMessageToPage(WKBundlePageRef page, WKStringRef m > > 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; > } >diff --git a/Tools/WebKitTestRunner/WebNotificationProvider.cpp b/Tools/WebKitTestRunner/WebNotificationProvider.cpp >index b009b36a3ac..e43f662a7a4 100644 >--- a/Tools/WebKitTestRunner/WebNotificationProvider.cpp >+++ b/Tools/WebKitTestRunner/WebNotificationProvider.cpp >@@ -126,7 +126,7 @@ void WebNotificationProvider::closeWebNotification(WKNotificationRef notificatio > > 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()); >diff --git a/Tools/WebKitTestRunner/mac/TestControllerMac.mm b/Tools/WebKitTestRunner/mac/TestControllerMac.mm >index d575010ab8b..583eed4f196 100644 >--- a/Tools/WebKitTestRunner/mac/TestControllerMac.mm >+++ b/Tools/WebKitTestRunner/mac/TestControllerMac.mm >@@ -293,22 +293,22 @@ static NSSet *systemHiddenFontFamilySet() > > 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()
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 193340
: 358838