Bug 518924. Fix memory leak in NPAPI async callback test and re-enable
authorJonathan Griffin <jgriffin@mozilla.com>
Mon, 25 Jan 2010 12:20:30 -0800
changeset 37490 bedba3a902e58f3bceb533f497b1cd0f34861ebd
parent 37489 71f78cfd324d5d20f7e02497fc7ad3434ee8640d
child 37491 569db7addb37a9080cee004954c46cdc0bd0925e
push idunknown
push userunknown
push dateunknown
bugs518924
milestone1.9.3a1pre
Bug 518924. Fix memory leak in NPAPI async callback test and re-enable
modules/plugin/test/mochitest/Makefile.in
modules/plugin/test/testplugin/nptest.cpp
--- a/modules/plugin/test/mochitest/Makefile.in
+++ b/modules/plugin/test/mochitest/Makefile.in
@@ -65,20 +65,20 @@ include $(topsrcdir)/config/rules.mk
 		test_pluginstream_post.html \
 		test_pluginstream_poststream.html \
 		test_pluginstream_seek.html \
 		test_pluginstream_newstream.html \
 		test_multipleinstanceobjects.html \
 		test_streamNotify.html \
 		test_instantiation.html \
 		test_cookies.html \
+		test_npn_timers.html \
+		test_npn_asynccall.html \
 		$(NULL)
 
-#		test_npn_timers.html \ disabled for leaking
-#		test_npn_asynccall.html \ disabled for leaking
 #		test_npruntime_npnsetexception.html \ Disabled for e10s
 
 ifdef MOZ_IPC
 _MOCHITEST_FILES += \
 		test_crashing.html \
 		test_crashing2.html \
 		crashing_subpage.html \
 		$(NULL)
--- a/modules/plugin/test/testplugin/nptest.cpp
+++ b/modules/plugin/test/testplugin/nptest.cpp
@@ -2420,16 +2420,17 @@ asyncCallback(void* cookie)
       NPObject* windowObject;
       NPN_GetValue(npp, NPNVWindowNPObject, &windowObject);
       if (!windowObject)
         return;
       NPVariant arg, rval;
       BOOLEAN_TO_NPVARIANT(id->asyncCallbackResult, arg);
       NPN_Invoke(npp, windowObject, NPN_GetStringIdentifier(id->asyncTestScriptCallback.c_str()), &arg, 1, &rval);
       NPN_ReleaseVariantValue(&arg);
+      NPN_ReleaseObject(windowObject);
       break;
   }
 }
 
 static bool
 asyncCallbackTest(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result)
 {
   NPP npp = static_cast<TestNPObject*>(npobj)->npp;