Commit dbd136e4 authored by Andreas Haas's avatar Andreas Haas Committed by Commit Bot

[wasm][streaming] Call Abort without reason when executed in ScriptForbiddenScope

It can happen that WebAssembly.compileStreaming gets aborted when we
are not allowed to execute JavaScript code, and therefore are also not
allowed to reject the promise returned by WebAssembly.compileStreaming.
This can happen e.g. when the Chrome tab gets refreshed, which aborts
all downloads.

With this CL we do not pass a reason to Abort if we are not allowed to
execute JavaScript code. On the V8 side we can check the reason passed
to Abort and do not reject the promise if there is no reason passed.

The V8 side change is at crrev.com/c/876091

R=mtrofin@chromium.org

Bug: chromium:803838
Change-Id: I55727f97fac38790cadc34ec5284131e13642f20
Reviewed-on: https://chromium-review.googlesource.com/876103Reviewed-by: default avatarMichael Lippautz <mlippautz@chromium.org>
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#531863}
parent 70d7b68f
......@@ -96,8 +96,16 @@ class FetchDataLoaderAsWasmModule final : public FetchDataLoader,
// what they are.
void AbortCompilation() {
ScriptState::Scope scope(script_state_.get());
builder_.Abort(V8ThrowException::CreateTypeError(
script_state_->GetIsolate(), "Could not download wasm module"));
if (!ScriptForbiddenScope::IsScriptForbidden()) {
builder_.Abort(V8ThrowException::CreateTypeError(
script_state_->GetIsolate(), "Could not download wasm module"));
} else {
// We are not allowed to execute a script, which indicates that we should
// not reject the promise of the streaming compilation. By passing no
// abort reason, we indicate the V8 side that the promise should not get
// rejected.
builder_.Abort(v8::Local<v8::Value>());
}
}
Member<BytesConsumer> consumer_;
Member<FetchDataLoader::Client> client_;
......
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