Always consume exceptions thrown by include's

This commit is contained in:
humbletim 2017-02-23 18:12:12 -05:00
parent 132a889f74
commit f82a0196a8

View file

@ -1365,12 +1365,12 @@ void ScriptEngine::include(const QStringList& includeFiles, QScriptValue callbac
doWithEnvironment(capturedEntityIdentifier, capturedSandboxURL, operation); doWithEnvironment(capturedEntityIdentifier, capturedSandboxURL, operation);
if (tryCatch.hasPending()) { if (tryCatch.hasPending()) {
// match previous include behavior where possible by logging, not propagating, exceptions. // match previous include behavior where possible by logging, not propagating, exceptions.
// for nested evaluations, exceptions are now allowed to propagate
auto err = tryCatch.pending(); auto err = tryCatch.pending();
emit unhandledException(err); emit unhandledException(err);
if (tryCatch.wouldEmit()) { // FIXME: to be revisited with next PR 21114-part3 for compat with require/module
tryCatch.consume(); //if (tryCatch.wouldEmit()) {
} tryCatch.consume();
//}
} }
} else { } else {
scriptWarningMessage("Script.include() skipping evaluation of previously included url:" + url.toString()); scriptWarningMessage("Script.include() skipping evaluation of previously included url:" + url.toString());