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
Родитель d390f7b37a
Коммит f1fd210898
1 изменённых файлов: 8 добавлений и 13 удалений

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

@ -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,14 +1187,12 @@ 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) {
if (!script && exception) {
JS_GetPendingException(cx, exception);
JS_ClearPendingException(cx);
}
}
}
if (!script) {
#ifdef DEBUG_shaver_off
@ -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