mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:57:45 +00:00
LibWeb: Make factory method of CSS::MediaQueryList fallible
This commit is contained in:
parent
5d9bc378c3
commit
bc02686ae9
3 changed files with 4 additions and 4 deletions
|
@ -15,9 +15,9 @@
|
||||||
|
|
||||||
namespace Web::CSS {
|
namespace Web::CSS {
|
||||||
|
|
||||||
JS::NonnullGCPtr<MediaQueryList> MediaQueryList::create(DOM::Document& document, NonnullRefPtrVector<MediaQuery>&& media)
|
WebIDL::ExceptionOr<JS::NonnullGCPtr<MediaQueryList>> MediaQueryList::create(DOM::Document& document, NonnullRefPtrVector<MediaQuery>&& media)
|
||||||
{
|
{
|
||||||
return document.heap().allocate<MediaQueryList>(document.realm(), document, move(media)).release_allocated_value_but_fixme_should_propagate_errors();
|
return MUST_OR_THROW_OOM(document.heap().allocate<MediaQueryList>(document.realm(), document, move(media)));
|
||||||
}
|
}
|
||||||
|
|
||||||
MediaQueryList::MediaQueryList(DOM::Document& document, NonnullRefPtrVector<MediaQuery>&& media)
|
MediaQueryList::MediaQueryList(DOM::Document& document, NonnullRefPtrVector<MediaQuery>&& media)
|
||||||
|
|
|
@ -17,7 +17,7 @@ class MediaQueryList final : public DOM::EventTarget {
|
||||||
WEB_PLATFORM_OBJECT(MediaQueryList, DOM::EventTarget);
|
WEB_PLATFORM_OBJECT(MediaQueryList, DOM::EventTarget);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static JS::NonnullGCPtr<MediaQueryList> create(DOM::Document&, NonnullRefPtrVector<MediaQuery>&&);
|
static WebIDL::ExceptionOr<JS::NonnullGCPtr<MediaQueryList>> create(DOM::Document&, NonnullRefPtrVector<MediaQuery>&&);
|
||||||
|
|
||||||
virtual ~MediaQueryList() override = default;
|
virtual ~MediaQueryList() override = default;
|
||||||
|
|
||||||
|
|
|
@ -649,7 +649,7 @@ CSS::CSSStyleDeclaration* Window::get_computed_style_impl(DOM::Element& element)
|
||||||
|
|
||||||
JS::NonnullGCPtr<CSS::MediaQueryList> Window::match_media_impl(DeprecatedString media)
|
JS::NonnullGCPtr<CSS::MediaQueryList> Window::match_media_impl(DeprecatedString media)
|
||||||
{
|
{
|
||||||
auto media_query_list = CSS::MediaQueryList::create(associated_document(), parse_media_query_list(CSS::Parser::ParsingContext(associated_document()), media));
|
auto media_query_list = CSS::MediaQueryList::create(associated_document(), parse_media_query_list(CSS::Parser::ParsingContext(associated_document()), media)).release_value_but_fixme_should_propagate_errors();
|
||||||
associated_document().add_media_query_list(*media_query_list);
|
associated_document().add_media_query_list(*media_query_list);
|
||||||
return media_query_list;
|
return media_query_list;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue