1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 01:57:45 +00:00

LibWeb: Make factory methods of DOM::Document fallible

This commit is contained in:
Kenneth Myhra 2023-02-14 21:49:02 +01:00 committed by Linus Groh
parent 552663a2ba
commit 0d9076c9f5
8 changed files with 17 additions and 24 deletions

View file

@ -168,7 +168,7 @@ JS::NonnullGCPtr<BrowsingContext> BrowsingContext::create_a_new_browsing_context
// load timing info is loadTimingInfo,
// FIXME: navigation id is null,
// and which is ready for post-load tasks.
auto document = DOM::Document::create(window->realm());
auto document = DOM::Document::create(window->realm()).release_value_but_fixme_should_propagate_errors();
// Non-standard
document->set_window({}, *window);

View file

@ -37,7 +37,7 @@ JS::ThrowCompletionOr<void> DOMParser::initialize(JS::Realm& realm)
JS::NonnullGCPtr<DOM::Document> DOMParser::parse_from_string(DeprecatedString const& string, Bindings::DOMParserSupportedType type)
{
// 1. Let document be a new Document, whose content type is type and url is this's relevant global object's associated Document's URL.
auto document = DOM::Document::create(realm(), verify_cast<HTML::Window>(relevant_global_object(*this)).associated_document().url());
auto document = DOM::Document::create(realm(), verify_cast<HTML::Window>(relevant_global_object(*this)).associated_document().url()).release_value_but_fixme_should_propagate_errors();
document->set_content_type(Bindings::idl_enum_to_deprecated_string(type));
// 2. Switch on type:

View file

@ -3448,7 +3448,7 @@ DOM::Document& HTMLParser::document()
Vector<JS::Handle<DOM::Node>> HTMLParser::parse_html_fragment(DOM::Element& context_element, StringView markup)
{
// 1. Create a new Document node, and mark it as being an HTML document.
auto temp_document = DOM::Document::create(context_element.realm());
auto temp_document = DOM::Document::create(context_element.realm()).release_value_but_fixme_should_propagate_errors();
temp_document->set_document_type(DOM::Document::Type::HTML);
// 2. If the node document of the context element is in quirks mode, then let the Document be in quirks mode.