Bug 518924. Fix memory leak in NPAPI async callback test and re-enable
--- 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;