Bug 466826 - 'Running mochitest asserts: ###!!! ASSERTION: should be executing script: 'mContext->fp', file /mozilla/dom/src/base/nsJSEnvironment.cpp, line 3318'. r=bz, sr=mrbkap, a=blocking1.9+

This commit is contained in:
Ben Turner 2008-12-28 17:42:35 -05:00
Родитель ef0674e4a6
Коммит 16fda7b2a3
1 изменённых файлов: 14 добавлений и 3 удалений

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

@ -1796,10 +1796,18 @@ nsGlobalWindow::SetNewDocument(nsIDocument* aDocument,
PRBool termFuncSet = PR_FALSE;
if (oldDoc == aDocument) {
JSContext *cx = nsContentUtils::GetCurrentJSContext();
// Suspend the current context's request before Pop() resumes the old
// context's request.
JSAutoSuspendRequest asr(cx);
// Pop our context here so that we get the correct one for the
// termination function.
cxPusher.Pop();
JSContext *oldCx = nsContentUtils::GetCurrentJSContext();
nsIScriptContext *callerScx;
if (cx && (callerScx = GetScriptContextFromJSContext(cx))) {
if (oldCx && (callerScx = GetScriptContextFromJSContext(oldCx))) {
// We're called from document.open() (and document.open() is
// called from JS), clear the scope etc in a termination
// function on the calling context to prevent clearing the
@ -1807,7 +1815,7 @@ nsGlobalWindow::SetNewDocument(nsIDocument* aDocument,
NS_ASSERTION(!currentInner->IsFrozen(),
"How does this opened window get into session history");
JSAutoRequest ar(cx);
JSAutoRequest ar(oldCx);
callerScx->SetTerminationFunction(ClearWindowScope,
static_cast<nsIDOMWindow *>
@ -1815,6 +1823,9 @@ nsGlobalWindow::SetNewDocument(nsIDocument* aDocument,
termFuncSet = PR_TRUE;
}
// Re-push our context.
cxPusher.Push(cx);
}
// Don't clear scope on our current inner window if it's going to be