Lots of leaks under WebContext::pluginInfoStoreDidLoadPlugins()
authorandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 1 Aug 2013 22:27:10 +0000 (22:27 +0000)
committerandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 1 Aug 2013 22:27:10 +0000 (22:27 +0000)
https://bugs.webkit.org/show_bug.cgi?id=119412

Reviewed by Simon Fraser.

For some sick reason, the WKContextClient plugInInformationBecameAvailable callback function
expects a +1 reference to the plug-in array. Isolate that hack to WebContextClient so that
we don't leak the array if there is no WKContextClient.

* UIProcess/WebContext.cpp:
(WebKit::WebContext::pluginInfoStoreDidLoadPlugins):
* UIProcess/WebContextClient.cpp:
(WebKit::WebContextClient::plugInInformationBecameAvailable):

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

Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/WebContext.cpp
Source/WebKit2/UIProcess/WebContextClient.cpp

index 9523d48..47874b8 100644 (file)
@@ -1,3 +1,19 @@
+2013-08-01  Anders Carlsson  <andersca@apple.com>
+
+        Lots of leaks under WebContext::pluginInfoStoreDidLoadPlugins()
+        https://bugs.webkit.org/show_bug.cgi?id=119412
+
+        Reviewed by Simon Fraser.
+
+        For some sick reason, the WKContextClient plugInInformationBecameAvailable callback function
+        expects a +1 reference to the plug-in array. Isolate that hack to WebContextClient so that
+        we don't leak the array if there is no WKContextClient.
+        
+        * UIProcess/WebContext.cpp:
+        (WebKit::WebContext::pluginInfoStoreDidLoadPlugins):
+        * UIProcess/WebContextClient.cpp:
+        (WebKit::WebContextClient::plugInInformationBecameAvailable):
+
 2013-08-01  Kwang Yul Seo  <skyul@company100.net>
 
         Remove return statement in void function
index 50ac23f..e1ef102 100644 (file)
@@ -1248,7 +1248,7 @@ void WebContext::pluginInfoStoreDidLoadPlugins(PluginInfoStore* store)
         pluginArray.append(ImmutableDictionary::adopt(map));
     }
 
-    m_client.plugInInformationBecameAvailable(this, ImmutableArray::adopt(pluginArray).leakRef());
+    m_client.plugInInformationBecameAvailable(this, ImmutableArray::adopt(pluginArray).get());
 }
 #endif
 
index 3da2bdb..df13e87 100644 (file)
@@ -51,6 +51,9 @@ void WebContextClient::plugInInformationBecameAvailable(WebContext* context, Imm
     if (!m_client.plugInInformationBecameAvailable)
         return;
 
+    // FIXME: The API contract expects us to hand a reference to the array here. This is wrong.
+    plugInInfo->ref();
+
     m_client.plugInInformationBecameAvailable(toAPI(context), toAPI(plugInInfo), m_client.clientInfo);
 }