vm: fix race condition with `timeout` param
This fixes a race condition in the watchdog timer used for vm timeouts. The condition would terminate the main stack's execution instead of the code running under the sandbox.
This also fixes the displayErrors
parameter in the runIn... family of functions.
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
tests and/or benchmarks are included -
commit message follows commit guidelines
Affected core subsystem(s)
- vm
Notes
The code dealing with displayErrors
was dead. When this module was first written it looked like this:
if (try_catch.HasCaught() && try_catch.HasTerminated()) {
V8::CancelTerminateExecution(args.GetIsolate());
return ThrowError("Script execution timed out.");
}
if (result.IsEmpty()) {
// Error occurred during execution of the script.
DisplayExceptionLine(try_catch.Message());
try_catch.ReThrow();
return;
}
But 55b87c02 modified the first if in such a way that the second if would never be true. So I went ahead and fixed that while I was in there, but that caused a bunch of errors in the repl tests because the output changed. I disabled displayErrors
in the repl because the output isn't too useful in that context anyway.