Title: [244703] trunk/Tools
Revision
244703
Author
[email protected]
Date
2019-04-26 11:32:46 -0700 (Fri, 26 Apr 2019)

Log Message

WebKitTestRunner leaks an NSDictionary and multiple JSStringRef objects
<https://webkit.org/b/197314>
<rdar://problem/50245252>

Reviewed by Simon Fraser.

* WebKitTestRunner/UIScriptControllerCocoa.mm:
(WTR::UIScriptController::lastUndoLabel const):
(WTR::UIScriptController::firstRedoLabel const):
- Use adopt(JSStringCreateWithCFString(...)) to fix leaks.

* WebKitTestRunner/ios/HIDEventGenerator.mm:
(-[HIDEventGenerator sendEventStream:completionBlock:]):
- Call -autorelease to fix leak of NSDictionary.

* WebKitTestRunner/ios/UIScriptControllerIOS.mm:
(WTR::UIScriptController::accessibilitySpeakSelectionContent const):
(WTR::UIScriptController::selectFormPopoverTitle const):
(WTR::UIScriptController::textContentType const):
(WTR::UIScriptController::formInputLabel const):
(WTR::UIScriptController::scrollingTreeAsText const):
- Use adopt(JSStringCreateWithCFString(...)) to fix leaks.

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (244702 => 244703)


--- trunk/Tools/ChangeLog	2019-04-26 18:32:41 UTC (rev 244702)
+++ trunk/Tools/ChangeLog	2019-04-26 18:32:46 UTC (rev 244703)
@@ -1,3 +1,28 @@
+2019-04-26  David Kilzer  <[email protected]>
+
+        WebKitTestRunner leaks an NSDictionary and multiple JSStringRef objects
+        <https://webkit.org/b/197314>
+        <rdar://problem/50245252>
+
+        Reviewed by Simon Fraser.
+
+        * WebKitTestRunner/UIScriptControllerCocoa.mm:
+        (WTR::UIScriptController::lastUndoLabel const):
+        (WTR::UIScriptController::firstRedoLabel const):
+        - Use adopt(JSStringCreateWithCFString(...)) to fix leaks.
+
+        * WebKitTestRunner/ios/HIDEventGenerator.mm:
+        (-[HIDEventGenerator sendEventStream:completionBlock:]):
+        - Call -autorelease to fix leak of NSDictionary.
+
+        * WebKitTestRunner/ios/UIScriptControllerIOS.mm:
+        (WTR::UIScriptController::accessibilitySpeakSelectionContent const):
+        (WTR::UIScriptController::selectFormPopoverTitle const):
+        (WTR::UIScriptController::textContentType const):
+        (WTR::UIScriptController::formInputLabel const):
+        (WTR::UIScriptController::scrollingTreeAsText const):
+        - Use adopt(JSStringCreateWithCFString(...)) to fix leaks.
+
 2019-04-26  Jonathan Bedard  <[email protected]>
 
         webkitpy: Running a single test will always use the default device

Modified: trunk/Tools/WebKitTestRunner/UIScriptControllerCocoa.mm (244702 => 244703)


--- trunk/Tools/WebKitTestRunner/UIScriptControllerCocoa.mm	2019-04-26 18:32:41 UTC (rev 244702)
+++ trunk/Tools/WebKitTestRunner/UIScriptControllerCocoa.mm	2019-04-26 18:32:46 UTC (rev 244703)
@@ -151,12 +151,12 @@
 
 JSRetainPtr<JSStringRef> UIScriptController::lastUndoLabel() const
 {
-    return JSStringCreateWithCFString((__bridge CFStringRef)platformUndoManager().undoActionName);
+    return adopt(JSStringCreateWithCFString((__bridge CFStringRef)platformUndoManager().undoActionName));
 }
 
 JSRetainPtr<JSStringRef> UIScriptController::firstRedoLabel() const
 {
-    return JSStringCreateWithCFString((__bridge CFStringRef)platformUndoManager().redoActionName);
+    return adopt(JSStringCreateWithCFString((__bridge CFStringRef)platformUndoManager().redoActionName));
 }
 
 NSUndoManager *UIScriptController::platformUndoManager() const

Modified: trunk/Tools/WebKitTestRunner/ios/HIDEventGenerator.mm (244702 => 244703)


--- trunk/Tools/WebKitTestRunner/ios/HIDEventGenerator.mm	2019-04-26 18:32:41 UTC (rev 244702)
+++ trunk/Tools/WebKitTestRunner/ios/HIDEventGenerator.mm	2019-04-26 18:32:46 UTC (rev 244703)
@@ -1138,7 +1138,7 @@
     }
     
     NSDictionary* threadData = @{
-        @"eventInfo": [eventInfo copy],
+        @"eventInfo": [[eventInfo copy] autorelease],
         @"completionBlock": [[completionBlock copy] autorelease]
     };
     

Modified: trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm (244702 => 244703)


--- trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm	2019-04-26 18:32:41 UTC (rev 244702)
+++ trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm	2019-04-26 18:32:46 UTC (rev 244703)
@@ -198,7 +198,7 @@
 JSRetainPtr<JSStringRef> UIScriptController::accessibilitySpeakSelectionContent() const
 {
     TestRunnerWKWebView *webView = TestController::singleton().mainWebView()->platformView();
-    return JSStringCreateWithCFString((CFStringRef)webView.accessibilitySpeakSelectionContent);
+    return adopt(JSStringCreateWithCFString((CFStringRef)webView.accessibilitySpeakSelectionContent));
 }
 
 void UIScriptController::simulateAccessibilitySettingsChangeNotification(JSValueRef callback)
@@ -499,19 +499,19 @@
 JSRetainPtr<JSStringRef> UIScriptController::selectFormPopoverTitle() const
 {
     TestRunnerWKWebView *webView = TestController::singleton().mainWebView()->platformView();
-    return JSStringCreateWithCFString((CFStringRef)webView.selectFormPopoverTitle);
+    return adopt(JSStringCreateWithCFString((CFStringRef)webView.selectFormPopoverTitle));
 }
 
 JSRetainPtr<JSStringRef> UIScriptController::textContentType() const
 {
     TestRunnerWKWebView *webView = TestController::singleton().mainWebView()->platformView();
-    return JSStringCreateWithCFString((CFStringRef)(webView.textContentTypeForTesting ?: @""));
+    return adopt(JSStringCreateWithCFString((CFStringRef)(webView.textContentTypeForTesting ?: @"")));
 }
 
 JSRetainPtr<JSStringRef> UIScriptController::formInputLabel() const
 {
     TestRunnerWKWebView *webView = TestController::singleton().mainWebView()->platformView();
-    return JSStringCreateWithCFString((CFStringRef)webView.formInputLabel);
+    return adopt(JSStringCreateWithCFString((CFStringRef)webView.formInputLabel));
 }
 
 void UIScriptController::selectFormAccessoryPickerRow(long rowIndex)
@@ -751,7 +751,7 @@
 JSRetainPtr<JSStringRef> UIScriptController::scrollingTreeAsText() const
 {
     TestRunnerWKWebView *webView = TestController::singleton().mainWebView()->platformView();
-    return JSStringCreateWithCFString((CFStringRef)[webView _scrollingTreeAsText]);
+    return adopt(JSStringCreateWithCFString((CFStringRef)[webView _scrollingTreeAsText]));
 }
 
 JSObjectRef UIScriptController::propertiesOfLayerWithID(uint64_t layerID) const
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to