Commit 86f50378 authored by Adam Rice's avatar Adam Rice Committed by Commit Bot

Inline BarrierCallbackForPut::RejectWithState

It's necessary to have a ScriptState::Scope active in order to call
CreateTypeError().
https://chromium-review.googlesource.com/c/chromium/src/+/954765
removed this from BarrierCallbackForPut::OnError, causing crashes.

Fix by inlining BarrierCallbackForPut::RejectWithState so that the
TypeError is once against created within the ScriptState::Scope.

BUG=824621

Change-Id: I7683ac83fd23e4ed9b1b4e2063481d54c37ee3d0
Reviewed-on: https://chromium-review.googlesource.com/975202Reviewed-by: default avatarMatt Falkenhagen <falken@chromium.org>
Commit-Queue: Adam Rice <ricea@chromium.org>
Cr-Commit-Position: refs/heads/master@{#545045}
parent 246f8fd2
...@@ -309,16 +309,17 @@ class Cache::BarrierCallbackForPut final ...@@ -309,16 +309,17 @@ class Cache::BarrierCallbackForPut final
return; return;
completed_ = true; completed_ = true;
ScriptState* state = resolver_->GetScriptState(); ScriptState* state = resolver_->GetScriptState();
RejectWithState(state, V8ThrowException::CreateTypeError( ScriptState::Scope scope(state);
state->GetIsolate(), error_message)); resolver_->Reject(
V8ThrowException::CreateTypeError(state->GetIsolate(), error_message));
} }
void Abort() { void Abort() {
if (!StillActive()) if (!StillActive())
return; return;
completed_ = true; completed_ = true;
RejectWithState(resolver_->GetScriptState(), ScriptState::Scope scope(resolver_->GetScriptState());
DOMException::Create(kAbortError)); resolver_->Reject(DOMException::Create(kAbortError));
} }
virtual void Trace(blink::Visitor* visitor) { virtual void Trace(blink::Visitor* visitor) {
...@@ -337,12 +338,6 @@ class Cache::BarrierCallbackForPut final ...@@ -337,12 +338,6 @@ class Cache::BarrierCallbackForPut final
return true; return true;
} }
template <typename T>
void RejectWithState(ScriptState* state, T value) {
ScriptState::Scope scope(state);
resolver_->Reject(value);
}
// Report the script stats if this cache storage is for service worker // Report the script stats if this cache storage is for service worker
// execution context and it's in installation phase. // execution context and it's in installation phase.
void MaybeReportInstalledScripts() { void MaybeReportInstalledScripts() {
......
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