mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 01:20:25 +00:00
LibWeb: Verify document is fully ready in AudioContext
This was just a trival FIXME to resolve as I was in the area.
This commit is contained in:
parent
9abce21435
commit
46ec3681a4
Notes:
sideshowbarker
2024-07-16 22:14:49 +09:00
Author: https://github.com/shannonbooth Commit: https://github.com/SerenityOS/serenity/commit/46ec3681a4 Pull-request: https://github.com/SerenityOS/serenity/pull/24108 Reviewed-by: https://github.com/trflynn89
1 changed files with 13 additions and 3 deletions
|
@ -7,6 +7,7 @@
|
|||
#include <LibWeb/Bindings/Intrinsics.h>
|
||||
#include <LibWeb/DOM/Event.h>
|
||||
#include <LibWeb/HTML/HTMLMediaElement.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
#include <LibWeb/WebAudio/AudioContext.h>
|
||||
#include <LibWeb/WebIDL/Promise.h>
|
||||
|
||||
|
@ -107,7 +108,10 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<JS::Promise>> AudioContext::resume()
|
|||
auto& realm = this->realm();
|
||||
auto& vm = realm.vm();
|
||||
|
||||
// FIXME: 1. If this's relevant global object's associated Document is not fully active then return a promise rejected with "InvalidStateError" DOMException.
|
||||
// 1. If this's relevant global object's associated Document is not fully active then return a promise rejected with "InvalidStateError" DOMException.
|
||||
auto const& associated_document = verify_cast<HTML::Window>(HTML::relevant_global_object(*this)).associated_document();
|
||||
if (!associated_document.is_fully_active())
|
||||
return WebIDL::InvalidStateError::create(realm, "Document is not fully active"_fly_string);
|
||||
|
||||
// 2. Let promise be a new Promise.
|
||||
auto promise = WebIDL::create_promise(realm);
|
||||
|
@ -189,7 +193,10 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<JS::Promise>> AudioContext::suspend()
|
|||
auto& realm = this->realm();
|
||||
auto& vm = realm.vm();
|
||||
|
||||
// FIXME: 1. If this's relevant global object's associated Document is not fully active then return a promise rejected with "InvalidStateError" DOMException.
|
||||
// 1. If this's relevant global object's associated Document is not fully active then return a promise rejected with "InvalidStateError" DOMException.
|
||||
auto const& associated_document = verify_cast<HTML::Window>(HTML::relevant_global_object(*this)).associated_document();
|
||||
if (!associated_document.is_fully_active())
|
||||
return WebIDL::InvalidStateError::create(realm, "Document is not fully active"_fly_string);
|
||||
|
||||
// 2. Let promise be a new Promise.
|
||||
auto promise = WebIDL::create_promise(realm);
|
||||
|
@ -243,7 +250,10 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<JS::Promise>> AudioContext::close()
|
|||
{
|
||||
auto& realm = this->realm();
|
||||
|
||||
// FIXME: 1. If this's relevant global object's associated Document is not fully active then return a promise rejected with "InvalidStateError" DOMException.
|
||||
// 1. If this's relevant global object's associated Document is not fully active then return a promise rejected with "InvalidStateError" DOMException.
|
||||
auto const& associated_document = verify_cast<HTML::Window>(HTML::relevant_global_object(*this)).associated_document();
|
||||
if (!associated_document.is_fully_active())
|
||||
return WebIDL::InvalidStateError::create(realm, "Document is not fully active"_fly_string);
|
||||
|
||||
// 2. Let promise be a new Promise.
|
||||
auto promise = WebIDL::create_promise(realm);
|
||||
|
|
Loading…
Reference in a new issue