Commit 56fe2437 authored by Andreas Haas's avatar Andreas Haas Committed by Commit Bot

[wasm][streaming] Do not reject promise upon abort without reason

This is the V8 side change of crrev.com/c/876103.

Message:
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.

CC=mtrofin@chromium.org
R=titzer@chromium.org

Bug: chromium:803838
Cq-Include-Trybots: master.tryserver.chromium.linux:linux_chromium_rel_ng
Change-Id: Ie5cc85c72b60383e9221318c18a4e1812d230692
Reviewed-on: https://chromium-review.googlesource.com/876091Reviewed-by: 's avatarBen Titzer <titzer@chromium.org>
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#50749}
parent 5cef3ddd
...@@ -7690,6 +7690,12 @@ void WasmModuleObjectBuilderStreaming::Abort(Local<Value> exception) { ...@@ -7690,6 +7690,12 @@ void WasmModuleObjectBuilderStreaming::Abort(Local<Value> exception) {
if (promise->State() != v8::Promise::kPending) return; if (promise->State() != v8::Promise::kPending) return;
if (i::FLAG_wasm_stream_compilation) streaming_decoder_->Abort(); if (i::FLAG_wasm_stream_compilation) streaming_decoder_->Abort();
// If there is no exception, then we do not reject the promise. The reason is
// that 'no exception' indicates that we are in a ScriptForbiddenScope, which
// means that it is not allowed to reject the promise at the moment, or
// execute any other JavaScript code.
if (exception.IsEmpty()) return;
Local<Promise::Resolver> resolver = promise.As<Promise::Resolver>(); Local<Promise::Resolver> resolver = promise.As<Promise::Resolver>();
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate_); i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate_);
i::HandleScope scope(i_isolate); i::HandleScope scope(i_isolate);
......
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