mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 463122 - Propagate mozJSComponentLoader exceptions that occur while executing the script. r=mrbkap
This commit is contained in:
parent
188ae5dc61
commit
a18ebbe4ab
@ -964,10 +964,20 @@ mozJSComponentLoader::GlobalForLocation(nsILocalFile *aComponentFile,
|
||||
// See bug 384168.
|
||||
*aGlobal = global;
|
||||
|
||||
if (!JS_ExecuteScriptVersion(cx, global, script, NULL, JSVERSION_LATEST)) {
|
||||
uint32 oldopts = JS_GetOptions(cx);
|
||||
JS_SetOptions(cx, oldopts |
|
||||
(exception ? JSOPTION_DONT_REPORT_UNCAUGHT : 0));
|
||||
bool ok = JS_ExecuteScriptVersion(cx, global, script, NULL, JSVERSION_LATEST);
|
||||
JS_SetOptions(cx, oldopts);
|
||||
|
||||
if (!ok) {
|
||||
#ifdef DEBUG_shaver_off
|
||||
fprintf(stderr, "mJCL: failed to execute %s\n", nativePath.get());
|
||||
#endif
|
||||
if (exception) {
|
||||
JS_GetPendingException(cx, exception);
|
||||
JS_ClearPendingException(cx);
|
||||
}
|
||||
*aGlobal = nsnull;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
1
js/xpconnect/tests/unit/importer.jsm
Normal file
1
js/xpconnect/tests/unit/importer.jsm
Normal file
@ -0,0 +1 @@
|
||||
Components.utils.import("resource://test/syntax_error.jsm");
|
10
js/xpconnect/tests/unit/test_import_fail.js
Normal file
10
js/xpconnect/tests/unit/test_import_fail.js
Normal file
@ -0,0 +1,10 @@
|
||||
function run_test()
|
||||
{
|
||||
try {
|
||||
Components.utils.import("resource://test/importer.jsm");
|
||||
do_check_true(false, "import should not succeed.");
|
||||
} catch (x) {
|
||||
do_check_neq(x.fileName.indexOf("syntax_error.jsm"), -1);
|
||||
do_check_eq(x.lineNumber, 1);
|
||||
}
|
||||
}
|
@ -14,6 +14,7 @@ tail =
|
||||
[test_bug_442086.js]
|
||||
[test_file.js]
|
||||
[test_import.js]
|
||||
[test_import_fail.js]
|
||||
[test_js_weak_references.js]
|
||||
[test_reflect_parse.js]
|
||||
[test_localeCompare.js]
|
||||
|
Loading…
Reference in New Issue
Block a user