[iOS WK2] Fix some leaks in TestRunnerWKWebView and UIScriptContext
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 9 Oct 2015 21:34:56 +0000 (21:34 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 9 Oct 2015 21:34:56 +0000 (21:34 +0000)
https://bugs.webkit.org/show_bug.cgi?id=149960

Reviewed by Tim Horton.

Use adoptWK(), and null out some members (file is not using ARC).

* WebKitTestRunner/UIScriptContext/UIScriptContext.cpp:
(UIScriptContext::uiScriptComplete):
* WebKitTestRunner/cocoa/TestRunnerWKWebView.mm:
(-[TestRunnerWKWebView dealloc]):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@190819 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/ChangeLog
Tools/WebKitTestRunner/UIScriptContext/UIScriptContext.cpp
Tools/WebKitTestRunner/cocoa/TestRunnerWKWebView.mm

index c06a4b6be0b1f1d8f86bb6a70974afc89d9cbcdc..cb71d25459ed5b141a9f7aab73a1ec0d551ed5f3 100644 (file)
@@ -1,3 +1,17 @@
+2015-10-09  Simon Fraser  <simon.fraser@apple.com>
+
+        [iOS WK2] Fix some leaks in TestRunnerWKWebView and UIScriptContext
+        https://bugs.webkit.org/show_bug.cgi?id=149960
+
+        Reviewed by Tim Horton.
+        
+        Use adoptWK(), and null out some members (file is not using ARC).
+
+        * WebKitTestRunner/UIScriptContext/UIScriptContext.cpp:
+        (UIScriptContext::uiScriptComplete):
+        * WebKitTestRunner/cocoa/TestRunnerWKWebView.mm:
+        (-[TestRunnerWKWebView dealloc]):
+
 2015-10-09  Csaba Osztrogon√°c  <ossy@webkit.org>
 
         Remove ENABLE_SUID_SANDBOX_LINUX cruft
index b57f3753cd2cb56de89b7f214df8a5b33710c6f0..e676aa28137a62d51a6bb734ba5639cddfdf55c4 100644 (file)
@@ -138,7 +138,7 @@ void UIScriptContext::fireCallback(unsigned callbackID)
 
 void UIScriptContext::uiScriptComplete(JSStringRef result)
 {
-    WKRetainPtr<WKStringRef> uiScriptResult = WKStringCreateWithJSString(result);
+    WKRetainPtr<WKStringRef> uiScriptResult = adoptWK(WKStringCreateWithJSString(result));
     m_delegate.uiScriptDidComplete(uiScriptResult.get(), m_currentScriptCallbackID);
     m_currentScriptCallbackID = 0;
 }
index 60364d41fc8908ef6bc33a54825a6a8eef944f4f..76cfe0c53120ca890e8d30428736a5224eab9354 100644 (file)
 
 - (void)dealloc
 {
-    [super dealloc];
     [[NSNotificationCenter defaultCenter] removeObserver:self];
+
+    self.willBeginZoomingCallback = nil;
+    self.didEndZoomingCallback = nil;
+    self.didShowKeyboardCallback = nil;
+    self.didHideKeyboardCallback = nil;
+
+    self.zoomToScaleCompletionHandler = nil;
+    self.showKeyboardCompletionHandler = nil;
+
+    [super dealloc];
 }
 
 - (void)zoomToScale:(double)scale animated:(BOOL)animated completionHandler:(void (^)(void))completionHandler