mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-24 16:40:21 +00:00
LibWeb: Actually resolve promises in AudioContext
...instead of just dereferencing the function. Co-authored-by: Andrew Kaster <andrew@ladybird.org>
This commit is contained in:
parent
352acd7771
commit
5ab07f277c
Notes:
github-actions[bot]
2024-10-25 07:16:23 +00:00
Author: https://github.com/gmta Commit: https://github.com/LadybirdBrowser/ladybird/commit/5ab07f277c1 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1946
1 changed files with 4 additions and 4 deletions
|
@ -164,7 +164,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<JS::Promise>> AudioContext::resume()
|
|||
// 7.5.2: Clear [[pending resume promises]]. Additionally, remove those promises from
|
||||
// [[pending promises]].
|
||||
for (auto const& pending_resume_promise : m_pending_resume_promises) {
|
||||
*pending_resume_promise->resolve();
|
||||
WebIDL::resolve_promise(realm, pending_resume_promise, JS::js_undefined());
|
||||
m_pending_promises.remove_first_matching([&pending_resume_promise](auto& pending_promise) {
|
||||
return pending_promise == pending_resume_promise;
|
||||
});
|
||||
|
@ -172,7 +172,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<JS::Promise>> AudioContext::resume()
|
|||
m_pending_resume_promises.clear();
|
||||
|
||||
// 7.5.3: Resolve promise.
|
||||
*promise->resolve();
|
||||
WebIDL::resolve_promise(realm, promise, JS::js_undefined());
|
||||
|
||||
// 7.5.4: If the state attribute of the AudioContext is not already "running":
|
||||
if (state() != Bindings::AudioContextState::Running) {
|
||||
|
@ -229,7 +229,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<JS::Promise>> AudioContext::suspend()
|
|||
// 7.3: queue a media element task to execute the following steps:
|
||||
queue_a_media_element_task(JS::create_heap_function(heap(), [&realm, promise, this]() {
|
||||
// 7.3.1: Resolve promise.
|
||||
*promise->resolve();
|
||||
WebIDL::resolve_promise(realm, promise, JS::js_undefined());
|
||||
|
||||
// 7.3.2: If the state attribute of the AudioContext is not already "suspended":
|
||||
if (state() != Bindings::AudioContextState::Suspended) {
|
||||
|
@ -282,7 +282,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<JS::Promise>> AudioContext::close()
|
|||
// 5.4: queue a media element task to execute the following steps:
|
||||
queue_a_media_element_task(JS::create_heap_function(heap(), [&realm, promise, this]() {
|
||||
// 5.4.1: Resolve promise.
|
||||
*promise->resolve();
|
||||
WebIDL::resolve_promise(realm, promise, JS::js_undefined());
|
||||
|
||||
// 5.4.2: If the state attribute of the AudioContext is not already "closed":
|
||||
if (state() != Bindings::AudioContextState::Closed) {
|
||||
|
|
Loading…
Reference in a new issue