Commit 60d31b45 authored by Adrienne Walker's avatar Adrienne Walker Committed by Commit Bot

indexeddb: check ScriptState context before using

This fixes a null pointer crash where the ScriptState's context is not
valid and is not checked before being passed to ExecutionContext::From.

Bug: 1099813
Change-Id: Ibdb5d33b6383f904a6f0ddb3b0eb0c6489b561d8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2283926
Auto-Submit: enne <enne@chromium.org>
Reviewed-by: default avatarDaniel Murphy <dmurph@chromium.org>
Commit-Queue: Victor Costan <pwnall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#786224}
parent acd073d1
...@@ -80,15 +80,19 @@ class WebIDBGetDBNamesCallbacksImpl : public WebIDBCallbacks { ...@@ -80,15 +80,19 @@ class WebIDBGetDBNamesCallbacksImpl : public WebIDBCallbacks {
} }
~WebIDBGetDBNamesCallbacksImpl() override { ~WebIDBGetDBNamesCallbacksImpl() override {
if (promise_resolver_) { if (!promise_resolver_)
probe::AsyncTaskCanceled( return;
ExecutionContext::From(promise_resolver_->GetScriptState()),
&async_task_id_); auto* script_state = promise_resolver_->GetScriptState();
promise_resolver_->Reject(MakeGarbageCollected<DOMException>( if (!script_state->ContextIsValid())
DOMExceptionCode::kUnknownError, return;
"An unexpected shutdown occured before the "
"databases() promise could be resolved")); probe::AsyncTaskCanceled(ExecutionContext::From(script_state),
} &async_task_id_);
promise_resolver_->Reject(MakeGarbageCollected<DOMException>(
DOMExceptionCode::kUnknownError,
"An unexpected shutdown occured before the "
"databases() promise could be resolved"));
} }
void SetState(base::WeakPtr<WebIDBCursorImpl> cursor, void SetState(base::WeakPtr<WebIDBCursorImpl> cursor,
......
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