Always report uncaught exceptions to avoid bad interactions with the JS interpreter. bug 343596, r+sr=jst

git-svn-id: svn://10.0.0.236/trunk@201609 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
mrbkap%gmail.com
2006-07-05 21:43:46 +00:00
parent eb94ea8b7a
commit f589fe7b13

View File

@@ -802,11 +802,12 @@ nsScriptLoader::EvaluateScript(nsScriptLoadRequest* aRequest,
// Put the old script back in case it wants to do anything else.
mCurrentScript = oldCurrent;
JSContext *cx = nsnull; // Initialize this to keep GCC happy.
if (stid == nsIProgrammingLanguage::JAVASCRIPT) {
JS_BeginRequest((JSContext *)context->GetNativeContext());
cx = (JSContext *)context->GetNativeContext();
::JS_BeginRequest(cx);
::JS_ReportPendingException(cx);
}
if (NS_FAILED(rv) && stid == nsIProgrammingLanguage::JAVASCRIPT)
::JS_ReportPendingException((JSContext *)context->GetNativeContext());
context->SetProcessingScriptTag(oldProcessingScriptTag);
@@ -816,9 +817,11 @@ nsScriptLoader::EvaluateScript(nsScriptLoadRequest* aRequest,
GetCurrentNativeCallContext(getter_AddRefs(ncc));
if (ncc) {
NS_ASSERTION(!::JS_IsExceptionPending(cx),
"JS_ReportPendingException wasn't called");
ncc->SetExceptionWasThrown(PR_FALSE);
}
JS_EndRequest((JSContext *)context->GetNativeContext());
::JS_EndRequest(cx);
}
return rv;
}