From 249c87c806fbfc02f6d7aa62a68d8c3352e41987 Mon Sep 17 00:00:00 2001 From: Bob Owen Date: Wed, 16 Jul 2014 12:25:02 +0100 Subject: [PATCH] Bug 1037904 Part 6: Replace nsCxPusher in nsJSObjWrapper::NP_Enumerate. r=bholley --- dom/plugins/base/nsJSNPRuntime.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/dom/plugins/base/nsJSNPRuntime.cpp b/dom/plugins/base/nsJSNPRuntime.cpp index 1712a52e315..e0a658af196 100644 --- a/dom/plugins/base/nsJSNPRuntime.cpp +++ b/dom/plugins/base/nsJSNPRuntime.cpp @@ -850,15 +850,15 @@ nsJSObjWrapper::NP_Enumerate(NPObject *npobj, NPIdentifier **idarray, uint32_t *count) { NPP npp = NPPStack::Peek(); - JSContext *cx = GetJSContext(npp); + dom::AutoJSAPI jsapi; + if (NS_WARN_IF(!jsapi.InitWithLegacyErrorReporting(GetGlobalObject(npp)))) { + return false; + } + JSContext *cx = jsapi.cx(); *idarray = 0; *count = 0; - if (!cx) { - return false; - } - if (!npobj) { ThrowJSException(cx, "Null npobj in nsJSObjWrapper::NP_Enumerate!"); @@ -868,8 +868,6 @@ nsJSObjWrapper::NP_Enumerate(NPObject *npobj, NPIdentifier **idarray, nsJSObjWrapper *npjsobj = (nsJSObjWrapper *)npobj; - nsCxPusher pusher; - pusher.Push(cx); AutoJSExceptionReporter reporter(cx); JS::Rooted jsobj(cx, npjsobj->mJSObj); JSAutoCompartment ac(cx, jsobj);