Commit 5d595814 authored by Hongchan Choi's avatar Hongchan Choi Committed by Commit Bot

Do not resume OfflineAudioContext when it is cleared

Previously OfflineAudioContext::resumeContext() method did not check
if the context is cleared by ExecutionContext::ContextDestroyed().
Such case is possible when the audio context is a part of a detached
iframe.

This CL changes the check so we can verify if the context's resources
is still available. Otherwise, we can reject the resume promise
resolver.

Test: Locally confirmed ASAN does not crash with the repro case.
Bug: 1048373
Change-Id: I96a601dcf63963525d95cfc5089fd4a3b0176687
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2042409
Commit-Queue: Hongchan Choi <hongchan@chromium.org>
Commit-Queue: Kentaro Hara <haraken@chromium.org>
Auto-Submit: Hongchan Choi <hongchan@chromium.org>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Cr-Commit-Position: refs/heads/master@{#739085}
parent 5d85a5c5
...@@ -329,8 +329,9 @@ ScriptPromise OfflineAudioContext::resumeContext(ScriptState* script_state) { ...@@ -329,8 +329,9 @@ ScriptPromise OfflineAudioContext::resumeContext(ScriptState* script_state) {
return promise; return promise;
} }
// If the context is in a closed state, reject the promise. // If the context is in a closed state or it really is closed (cleared),
if (ContextState() == AudioContextState::kClosed) { // reject the promise.
if (IsContextClosed()) {
resolver->Reject(MakeGarbageCollected<DOMException>( resolver->Reject(MakeGarbageCollected<DOMException>(
DOMExceptionCode::kInvalidStateError, DOMExceptionCode::kInvalidStateError,
"cannot resume a closed offline context")); "cannot resume a closed offline context"));
......
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