Commit f497404a authored by Hiroshige Hayashizaki's avatar Hiroshige Hayashizaki Committed by Commit Bot

Check TryCatch::CanContinue() in module scripts

Bug: 1129793, 1114601
Change-Id: Ifc26c2c9e75b25d4ff001395b4faf072c41974c1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2485411Reviewed-by: default avatarKouhei Ueno <kouhei@chromium.org>
Reviewed-by: default avatarYuki Shiino <yukishiino@chromium.org>
Commit-Queue: Hiroshige Hayashizaki <hiroshige@chromium.org>
Cr-Commit-Position: refs/heads/master@{#827929}
parent 699de95c
......@@ -727,11 +727,20 @@ ScriptEvaluationResult V8ScriptRunner::EvaluateModule(
// Do not perform a microtask checkpoint here. A checkpoint is performed
// only after module error handling to ensure proper timing with and
// without top-level await.
v8::MaybeLocal<v8::Value> maybe_result =
record->Evaluate(script_state->GetContext());
if (!try_catch.CanContinue())
return ScriptEvaluationResult::FromModuleAborted();
v8::Local<v8::Value> v8_result;
if (!record->Evaluate(script_state->GetContext()).ToLocal(&v8_result)) {
if (!maybe_result.ToLocal(&v8_result)) {
DCHECK(try_catch.HasCaught());
result =
ScriptEvaluationResult::FromModuleException(try_catch.Exception());
} else {
DCHECK(!try_catch.HasCaught());
result = ScriptEvaluationResult::FromModuleSuccess(v8_result);
}
......
This is a testharness.js-based test.
PASS Worker is terminated during top-level script evaluation
FAIL Worker is terminated during top-level script evaluation (module) assert_unreached: onerror Reached unreachable code
PASS Worker is terminated during importScripts() call
PASS Worker is terminated during nested importScripts() call
PASS Worker is terminated during dynamic import()
PASS Worker is terminated during dynamic import() (module)
Harness: the test ran to completion.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment