Fixing bug 417852. Push the context we're using to clear scopes on to make code down the road find the right context. r=dveditz@cruzio.com, sr=bzbarsky@mit.edu

This commit is contained in:
jst@mozilla.org 2008-02-21 15:51:02 -08:00
Родитель c95417266e
Коммит e6957e79eb
1 изменённых файлов: 12 добавлений и 1 удалений

Просмотреть файл

@ -1661,7 +1661,7 @@ nsJSContext::ExecuteScript(void *aScriptObject,
JSAutoRequest ar(mContext);
ok = ::JS_ExecuteScript(mContext,
(JSObject *)aScopeObject,
(JSScript*) ::JS_GetPrivate(mContext,
(JSScript*)::JS_GetPrivate(mContext,
(JSObject*)aScriptObject),
&val);
@ -3137,6 +3137,13 @@ nsJSContext::InitClasses(void *aGlobalObj)
void
nsJSContext::ClearScope(void *aGlobalObj, PRBool aClearFromProtoChain)
{
// Push our JSContext on our thread's context stack.
nsCOMPtr<nsIJSContextStack> stack =
do_GetService("@mozilla.org/js/xpc/ContextStack;1");
if (stack && NS_FAILED(stack->Push(mContext))) {
stack = nsnull;
}
if (aGlobalObj) {
JSObject *obj = (JSObject *)aGlobalObj;
JSAutoRequest ar(mContext);
@ -3167,8 +3174,12 @@ nsJSContext::ClearScope(void *aGlobalObj, PRBool aClearFromProtoChain)
::JS_ClearScope(mContext, o);
}
}
::JS_ClearRegExpStatics(mContext);
if (stack) {
stack->Pop(nsnull);
}
}
void