Bug 636811 - Use JSSCRIPT_NO_SCRIPT_RVAL in js component loader, r=mrbkap

This commit is contained in:
Michael Wu 2011-03-25 14:31:14 -07:00
parent 0e6972a633
commit c445f6e656

View File

@ -1071,11 +1071,9 @@ mozJSComponentLoader::GlobalForLocation(nsILocalFile *aComponentFile,
// If |exception| is non-null, then our caller wants us to propagate
// any exceptions out to our caller. Ensure that the engine doesn't
// eagerly report the exception.
uint32 oldopts = 0;
if (exception) {
oldopts = JS_GetOptions(cx);
JS_SetOptions(cx, oldopts | JSOPTION_DONT_REPORT_UNCAUGHT);
}
uint32 oldopts = JS_GetOptions(cx);
JS_SetOptions(cx, oldopts | JSOPTION_NO_SCRIPT_RVAL |
(exception ? JSOPTION_DONT_REPORT_UNCAUGHT : 0));
if (realFile) {
#ifdef HAVE_PR_MEMMAP
@ -1189,12 +1187,10 @@ mozJSComponentLoader::GlobalForLocation(nsILocalFile *aComponentFile,
// exception on this context.
// NB: The caller must stick exception into a rooted slot (probably on
// its context) as soon as possible to avoid GC hazards.
if (exception) {
JS_SetOptions(cx, oldopts);
if (!script) {
JS_GetPendingException(cx, exception);
JS_ClearPendingException(cx);
}
JS_SetOptions(cx, oldopts);
if (!script && exception) {
JS_GetPendingException(cx, exception);
JS_ClearPendingException(cx);
}
}
@ -1241,8 +1237,7 @@ mozJSComponentLoader::GlobalForLocation(nsILocalFile *aComponentFile,
// See bug 384168.
*aGlobal = global;
jsval retval;
if (!JS_ExecuteScriptVersion(cx, global, script, &retval, JSVERSION_LATEST)) {
if (!JS_ExecuteScriptVersion(cx, global, script, NULL, JSVERSION_LATEST)) {
#ifdef DEBUG_shaver_off
fprintf(stderr, "mJCL: failed to execute %s\n", nativePath.get());
#endif