diff --git a/js/src/xpconnect/loader/mozJSComponentLoader.cpp b/js/src/xpconnect/loader/mozJSComponentLoader.cpp index a742c5eebbc..dbf9e373ce4 100644 --- a/js/src/xpconnect/loader/mozJSComponentLoader.cpp +++ b/js/src/xpconnect/loader/mozJSComponentLoader.cpp @@ -1143,6 +1143,8 @@ JSCLAutoContext::JSCLAutoContext(JSRuntime* rt) } if (mContext) { + mSavedOptions = JS_GetOptions(mContext); + JS_SetOptions(mContext, mSavedOptions | JSOPTION_XML); mContextThread = JS_GetContextThread(mContext); if (mContextThread) { JS_BeginRequest(mContext); @@ -1156,9 +1158,11 @@ JSCLAutoContext::JSCLAutoContext(JSRuntime* rt) JSCLAutoContext::~JSCLAutoContext() { - if (mContext && mContextThread) { + if (mContext) { JS_ClearNewbornRoots(mContext); - JS_EndRequest(mContext); + JS_SetOptions(mContext, mSavedOptions); + if (mContextThread) + JS_EndRequest(mContext); } if (mPopNeeded) { diff --git a/js/src/xpconnect/loader/mozJSComponentLoader.h b/js/src/xpconnect/loader/mozJSComponentLoader.h index 4e486a26a3d..97a9295ef82 100644 --- a/js/src/xpconnect/loader/mozJSComponentLoader.h +++ b/js/src/xpconnect/loader/mozJSComponentLoader.h @@ -111,6 +111,7 @@ private: nsresult mError; JSBool mPopNeeded; intN mContextThread; + uint32 mSavedOptions; };