Title: [211674] trunk/Tools
Revision
211674
Author
[email protected]
Date
2017-02-04 13:46:21 -0800 (Sat, 04 Feb 2017)

Log Message

Plug some leaks in TestController and UIScriptContext.
<https://webkit.org/b/167839>

Reviewed by Alexey Proskuryakov.

Fix a couple of the leaks seen on the leaks bot.

* TestRunnerShared/UIScriptContext/UIScriptContext.cpp:
(UIScriptContext::runUIScript):
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::handleCheckOfUserMediaPermissionForOrigin):
(WTR::TestController::decidePolicyForUserMediaPermissionRequestIfPossible):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (211673 => 211674)


--- trunk/Tools/ChangeLog	2017-02-04 21:40:33 UTC (rev 211673)
+++ trunk/Tools/ChangeLog	2017-02-04 21:46:21 UTC (rev 211674)
@@ -1,3 +1,18 @@
+2017-02-04  Andreas Kling  <[email protected]>
+
+        Plug some leaks in TestController and UIScriptContext.
+        <https://webkit.org/b/167839>
+
+        Reviewed by Alexey Proskuryakov.
+
+        Fix a couple of the leaks seen on the leaks bot.
+
+        * TestRunnerShared/UIScriptContext/UIScriptContext.cpp:
+        (UIScriptContext::runUIScript):
+        * WebKitTestRunner/TestController.cpp:
+        (WTR::TestController::handleCheckOfUserMediaPermissionForOrigin):
+        (WTR::TestController::decidePolicyForUserMediaPermissionRequestIfPossible):
+
 2017-02-03  Jeremy Jones  <[email protected]>
 
         WK1 mouse events are missing movementX and movementY for pointerlock.

Modified: trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptContext.cpp (211673 => 211674)


--- trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptContext.cpp	2017-02-04 21:40:33 UTC (rev 211673)
+++ trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptContext.cpp	2017-02-04 21:46:21 UTC (rev 211674)
@@ -67,7 +67,8 @@
     
     if (!hasOutstandingAsyncTasks()) {
         JSValueRef stringifyException = nullptr;
-        requestUIScriptCompletion(JSValueToStringCopy(m_context.get(), result, &stringifyException));
+        JSRetainPtr<JSStringRef> stringified(Adopt, JSValueToStringCopy(m_context.get(), result, &stringifyException));
+        requestUIScriptCompletion(stringified.get());
         tryToCompleteUIScriptForCurrentParentCallback();
     }
 }

Modified: trunk/Tools/WebKitTestRunner/TestController.cpp (211673 => 211674)


--- trunk/Tools/WebKitTestRunner/TestController.cpp	2017-02-04 21:40:33 UTC (rev 211673)
+++ trunk/Tools/WebKitTestRunner/TestController.cpp	2017-02-04 21:46:21 UTC (rev 211674)
@@ -1959,8 +1959,9 @@
 {
     auto originHash = userMediaOriginHash(userMediaDocumentOrigin, topLevelDocumentOrigin);
     auto salt = saltForOrigin(frame, originHash);
+    WKRetainPtr<WKStringRef> saltString = adoptWK(WKStringCreateWithUTF8CString(salt.utf8().data()));
 
-    WKUserMediaPermissionCheckSetUserMediaAccessInfo(checkRequest, WKStringCreateWithUTF8CString(salt.utf8().data()), settingsForOrigin(originHash).persistentPermission());
+    WKUserMediaPermissionCheckSetUserMediaAccessInfo(checkRequest, saltString.get(), settingsForOrigin(originHash).persistentPermission());
 }
 
 void TestController::handleUserMediaPermissionRequest(WKFrameRef frame, WKSecurityOriginRef userMediaDocumentOrigin, WKSecurityOriginRef topLevelDocumentOrigin, WKUserMediaPermissionRequestRef request)
@@ -2010,8 +2011,8 @@
             continue;
         }
 
-        WKRetainPtr<WKArrayRef> audioDeviceUIDs = WKUserMediaPermissionRequestAudioDeviceUIDs(request);
-        WKRetainPtr<WKArrayRef> videoDeviceUIDs = WKUserMediaPermissionRequestVideoDeviceUIDs(request);
+        WKRetainPtr<WKArrayRef> audioDeviceUIDs = adoptWK(WKUserMediaPermissionRequestAudioDeviceUIDs(request));
+        WKRetainPtr<WKArrayRef> videoDeviceUIDs = adoptWK(WKUserMediaPermissionRequestVideoDeviceUIDs(request));
 
         if (!WKArrayGetSize(videoDeviceUIDs.get()) && !WKArrayGetSize(audioDeviceUIDs.get())) {
             WKUserMediaPermissionRequestDeny(request, kWKNoConstraints);
@@ -2022,13 +2023,13 @@
         if (WKArrayGetSize(videoDeviceUIDs.get()))
             videoDeviceUID = reinterpret_cast<WKStringRef>(WKArrayGetItemAtIndex(videoDeviceUIDs.get(), 0));
         else
-            videoDeviceUID = WKStringCreateWithUTF8CString("");
+            videoDeviceUID = adoptWK(WKStringCreateWithUTF8CString(""));
 
         WKRetainPtr<WKStringRef> audioDeviceUID;
         if (WKArrayGetSize(audioDeviceUIDs.get()))
             audioDeviceUID = reinterpret_cast<WKStringRef>(WKArrayGetItemAtIndex(audioDeviceUIDs.get(), 0));
         else
-            audioDeviceUID = WKStringCreateWithUTF8CString("");
+            audioDeviceUID = adoptWK(WKStringCreateWithUTF8CString(""));
 
         WKUserMediaPermissionRequestAllow(request, audioDeviceUID.get(), videoDeviceUID.get());
     }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to