mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 16:47:44 +00:00
LibJS+Everywhere: Propagate Cell::initialize errors from Heap::allocate
Callers that are already in a fallible context will now TRY to allocate cells. Callers in infallible contexts get a FIXME.
This commit is contained in:
parent
109b190a19
commit
b75b7f0c0d
178 changed files with 565 additions and 565 deletions
|
@ -375,7 +375,7 @@ JS::VM& main_thread_vm()
|
|||
custom_data.root_execution_context = MUST(JS::Realm::initialize_host_defined_realm(*vm, nullptr, nullptr));
|
||||
|
||||
auto* root_realm = custom_data.root_execution_context->realm;
|
||||
auto intrinsics = root_realm->heap().allocate<Intrinsics>(*root_realm, *root_realm);
|
||||
auto intrinsics = root_realm->heap().allocate<Intrinsics>(*root_realm, *root_realm).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
auto host_defined = make<HostDefined>(nullptr, intrinsics);
|
||||
root_realm->set_host_defined(move(host_defined));
|
||||
custom_data.internal_realm = root_realm;
|
||||
|
|
|
@ -53,7 +53,7 @@ JS::ThrowCompletionOr<JS::NonnullGCPtr<JS::Object>> OptionConstructor::construct
|
|||
if (vm.argument_count() > 0) {
|
||||
auto text = TRY(vm.argument(0).to_deprecated_string(vm));
|
||||
if (!text.is_empty()) {
|
||||
auto new_text_node = vm.heap().allocate<DOM::Text>(realm, document, text);
|
||||
auto new_text_node = MUST_OR_THROW_OOM(vm.heap().allocate<DOM::Text>(realm, document, text));
|
||||
MUST(option_element->append_child(*new_text_node));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Web::CSS {
|
|||
|
||||
CSSFontFaceRule* CSSFontFaceRule::create(JS::Realm& realm, FontFace&& font_face)
|
||||
{
|
||||
return realm.heap().allocate<CSSFontFaceRule>(realm, realm, move(font_face));
|
||||
return realm.heap().allocate<CSSFontFaceRule>(realm, realm, move(font_face)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
CSSFontFaceRule::CSSFontFaceRule(JS::Realm& realm, FontFace&& font_face)
|
||||
|
|
|
@ -21,7 +21,7 @@ namespace Web::CSS {
|
|||
CSSImportRule* CSSImportRule::create(AK::URL url, DOM::Document& document)
|
||||
{
|
||||
auto& realm = document.realm();
|
||||
return realm.heap().allocate<CSSImportRule>(realm, move(url), document);
|
||||
return realm.heap().allocate<CSSImportRule>(realm, move(url), document).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
CSSImportRule::CSSImportRule(AK::URL url, DOM::Document& document)
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Web::CSS {
|
|||
|
||||
CSSMediaRule* CSSMediaRule::create(JS::Realm& realm, MediaList& media_queries, CSSRuleList& rules)
|
||||
{
|
||||
return realm.heap().allocate<CSSMediaRule>(realm, realm, media_queries, rules);
|
||||
return realm.heap().allocate<CSSMediaRule>(realm, realm, media_queries, rules).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
CSSMediaRule::CSSMediaRule(JS::Realm& realm, MediaList& media, CSSRuleList& rules)
|
||||
|
|
|
@ -19,7 +19,7 @@ namespace Web::CSS {
|
|||
|
||||
CSSRuleList* CSSRuleList::create(JS::Realm& realm, JS::MarkedVector<CSSRule*> const& rules)
|
||||
{
|
||||
auto rule_list = realm.heap().allocate<CSSRuleList>(realm, realm);
|
||||
auto rule_list = realm.heap().allocate<CSSRuleList>(realm, realm).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
for (auto* rule : rules)
|
||||
rule_list->m_rules.append(*rule);
|
||||
return rule_list;
|
||||
|
@ -32,7 +32,7 @@ CSSRuleList::CSSRuleList(JS::Realm& realm)
|
|||
|
||||
CSSRuleList* CSSRuleList::create_empty(JS::Realm& realm)
|
||||
{
|
||||
return realm.heap().allocate<CSSRuleList>(realm, realm);
|
||||
return realm.heap().allocate<CSSRuleList>(realm, realm).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
JS::ThrowCompletionOr<void> CSSRuleList::initialize(JS::Realm& realm)
|
||||
|
|
|
@ -21,7 +21,7 @@ CSSStyleDeclaration::CSSStyleDeclaration(JS::Realm& realm)
|
|||
|
||||
PropertyOwningCSSStyleDeclaration* PropertyOwningCSSStyleDeclaration::create(JS::Realm& realm, Vector<StyleProperty> properties, HashMap<DeprecatedString, StyleProperty> custom_properties)
|
||||
{
|
||||
return realm.heap().allocate<PropertyOwningCSSStyleDeclaration>(realm, realm, move(properties), move(custom_properties));
|
||||
return realm.heap().allocate<PropertyOwningCSSStyleDeclaration>(realm, realm, move(properties), move(custom_properties)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
PropertyOwningCSSStyleDeclaration::PropertyOwningCSSStyleDeclaration(JS::Realm& realm, Vector<StyleProperty> properties, HashMap<DeprecatedString, StyleProperty> custom_properties)
|
||||
|
@ -41,7 +41,7 @@ DeprecatedString PropertyOwningCSSStyleDeclaration::item(size_t index) const
|
|||
ElementInlineCSSStyleDeclaration* ElementInlineCSSStyleDeclaration::create(DOM::Element& element, Vector<StyleProperty> properties, HashMap<DeprecatedString, StyleProperty> custom_properties)
|
||||
{
|
||||
auto& realm = element.realm();
|
||||
return realm.heap().allocate<ElementInlineCSSStyleDeclaration>(realm, element, move(properties), move(custom_properties));
|
||||
return realm.heap().allocate<ElementInlineCSSStyleDeclaration>(realm, element, move(properties), move(custom_properties)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
ElementInlineCSSStyleDeclaration::ElementInlineCSSStyleDeclaration(DOM::Element& element, Vector<StyleProperty> properties, HashMap<DeprecatedString, StyleProperty> custom_properties)
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace Web::CSS {
|
|||
|
||||
CSSStyleRule* CSSStyleRule::create(JS::Realm& realm, NonnullRefPtrVector<Web::CSS::Selector>&& selectors, CSSStyleDeclaration& declaration)
|
||||
{
|
||||
return realm.heap().allocate<CSSStyleRule>(realm, realm, move(selectors), declaration);
|
||||
return realm.heap().allocate<CSSStyleRule>(realm, realm, move(selectors), declaration).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
CSSStyleRule::CSSStyleRule(JS::Realm& realm, NonnullRefPtrVector<Selector>&& selectors, CSSStyleDeclaration& declaration)
|
||||
|
|
|
@ -16,7 +16,7 @@ namespace Web::CSS {
|
|||
|
||||
CSSStyleSheet* CSSStyleSheet::create(JS::Realm& realm, CSSRuleList& rules, MediaList& media, Optional<AK::URL> location)
|
||||
{
|
||||
return realm.heap().allocate<CSSStyleSheet>(realm, realm, rules, media, move(location));
|
||||
return realm.heap().allocate<CSSStyleSheet>(realm, realm, rules, media, move(location)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
CSSStyleSheet::CSSStyleSheet(JS::Realm& realm, CSSRuleList& rules, MediaList& media, Optional<AK::URL> location)
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace Web::CSS {
|
|||
|
||||
CSSSupportsRule* CSSSupportsRule::create(JS::Realm& realm, NonnullRefPtr<Supports>&& supports, CSSRuleList& rules)
|
||||
{
|
||||
return realm.heap().allocate<CSSSupportsRule>(realm, realm, move(supports), rules);
|
||||
return realm.heap().allocate<CSSSupportsRule>(realm, realm, move(supports), rules).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
CSSSupportsRule::CSSSupportsRule(JS::Realm& realm, NonnullRefPtr<Supports>&& supports, CSSRuleList& rules)
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Web::CSS {
|
|||
|
||||
MediaList* MediaList::create(JS::Realm& realm, NonnullRefPtrVector<MediaQuery>&& media)
|
||||
{
|
||||
return realm.heap().allocate<MediaList>(realm, realm, move(media));
|
||||
return realm.heap().allocate<MediaList>(realm, realm, move(media)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
MediaList::MediaList(JS::Realm& realm, NonnullRefPtrVector<MediaQuery>&& media)
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace Web::CSS {
|
|||
|
||||
JS::NonnullGCPtr<MediaQueryList> MediaQueryList::create(DOM::Document& document, NonnullRefPtrVector<MediaQuery>&& media)
|
||||
{
|
||||
return document.heap().allocate<MediaQueryList>(document.realm(), document, move(media));
|
||||
return document.heap().allocate<MediaQueryList>(document.realm(), document, move(media)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
MediaQueryList::MediaQueryList(DOM::Document& document, NonnullRefPtrVector<MediaQuery>&& media)
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace Web::CSS {
|
|||
|
||||
MediaQueryListEvent* MediaQueryListEvent::construct_impl(JS::Realm& realm, DeprecatedFlyString const& event_name, MediaQueryListEventInit const& event_init)
|
||||
{
|
||||
return realm.heap().allocate<MediaQueryListEvent>(realm, realm, event_name, event_init);
|
||||
return realm.heap().allocate<MediaQueryListEvent>(realm, realm, event_name, event_init).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
MediaQueryListEvent::MediaQueryListEvent(JS::Realm& realm, DeprecatedFlyString const& event_name, MediaQueryListEventInit const& event_init)
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace Web::CSS {
|
|||
|
||||
ResolvedCSSStyleDeclaration* ResolvedCSSStyleDeclaration::create(DOM::Element& element)
|
||||
{
|
||||
return element.realm().heap().allocate<ResolvedCSSStyleDeclaration>(element.realm(), element);
|
||||
return element.realm().heap().allocate<ResolvedCSSStyleDeclaration>(element.realm(), element).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
ResolvedCSSStyleDeclaration::ResolvedCSSStyleDeclaration(DOM::Element& element)
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace Web::CSS {
|
|||
|
||||
JS::NonnullGCPtr<Screen> Screen::create(HTML::Window& window)
|
||||
{
|
||||
return window.heap().allocate<Screen>(window.realm(), window);
|
||||
return window.heap().allocate<Screen>(window.realm(), window).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
Screen::Screen(HTML::Window& window)
|
||||
|
|
|
@ -48,7 +48,7 @@ void StyleSheetList::remove_sheet(CSSStyleSheet& sheet)
|
|||
StyleSheetList* StyleSheetList::create(DOM::Document& document)
|
||||
{
|
||||
auto& realm = document.realm();
|
||||
return realm.heap().allocate<StyleSheetList>(realm, document);
|
||||
return realm.heap().allocate<StyleSheetList>(realm, document).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
StyleSheetList::StyleSheetList(DOM::Document& document)
|
||||
|
|
|
@ -16,7 +16,7 @@ namespace Web::Crypto {
|
|||
|
||||
JS::NonnullGCPtr<Crypto> Crypto::create(JS::Realm& realm)
|
||||
{
|
||||
return realm.heap().allocate<Crypto>(realm, realm);
|
||||
return realm.heap().allocate<Crypto>(realm, realm).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
Crypto::Crypto(JS::Realm& realm)
|
||||
|
|
|
@ -16,7 +16,7 @@ namespace Web::Crypto {
|
|||
|
||||
JS::NonnullGCPtr<SubtleCrypto> SubtleCrypto::create(JS::Realm& realm)
|
||||
{
|
||||
return realm.heap().allocate<SubtleCrypto>(realm, realm);
|
||||
return realm.heap().allocate<SubtleCrypto>(realm, realm).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
SubtleCrypto::SubtleCrypto(JS::Realm& realm)
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace Web::DOM {
|
|||
JS::NonnullGCPtr<AbortController> AbortController::construct_impl(JS::Realm& realm)
|
||||
{
|
||||
auto signal = AbortSignal::construct_impl(realm);
|
||||
return realm.heap().allocate<AbortController>(realm, realm, move(signal));
|
||||
return realm.heap().allocate<AbortController>(realm, realm, move(signal)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-abortcontroller-abortcontroller
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Web::DOM {
|
|||
|
||||
JS::NonnullGCPtr<AbortSignal> AbortSignal::construct_impl(JS::Realm& realm)
|
||||
{
|
||||
return realm.heap().allocate<AbortSignal>(realm, realm);
|
||||
return realm.heap().allocate<AbortSignal>(realm, realm).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
AbortSignal::AbortSignal(JS::Realm& realm)
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace Web::DOM {
|
|||
|
||||
JS::NonnullGCPtr<AccessibilityTreeNode> AccessibilityTreeNode::create(Document* document, DOM::Node const* value)
|
||||
{
|
||||
return *document->heap().allocate<AccessibilityTreeNode>(document->realm(), value);
|
||||
return *document->heap().allocate<AccessibilityTreeNode>(document->realm(), value).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
AccessibilityTreeNode::AccessibilityTreeNode(JS::GCPtr<DOM::Node> value)
|
||||
|
|
|
@ -15,12 +15,12 @@ namespace Web::DOM {
|
|||
|
||||
JS::NonnullGCPtr<Attr> Attr::create(Document& document, DeprecatedFlyString local_name, DeprecatedString value, Element const* owner_element)
|
||||
{
|
||||
return document.heap().allocate<Attr>(document.realm(), document, QualifiedName(move(local_name), {}, {}), move(value), owner_element);
|
||||
return document.heap().allocate<Attr>(document.realm(), document, QualifiedName(move(local_name), {}, {}), move(value), owner_element).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
JS::NonnullGCPtr<Attr> Attr::clone(Document& document)
|
||||
{
|
||||
return *heap().allocate<Attr>(realm(), document, m_qualified_name, m_value, nullptr);
|
||||
return *heap().allocate<Attr>(realm(), document, m_qualified_name, m_value, nullptr).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
Attr::Attr(Document& document, QualifiedName qualified_name, DeprecatedString value, Element const* owner_element)
|
||||
|
|
|
@ -19,7 +19,7 @@ Comment::Comment(Document& document, DeprecatedString const& data)
|
|||
JS::NonnullGCPtr<Comment> Comment::construct_impl(JS::Realm& realm, DeprecatedString const& data)
|
||||
{
|
||||
auto& window = verify_cast<HTML::Window>(realm.global_object());
|
||||
return realm.heap().allocate<Comment>(realm, window.associated_document(), data);
|
||||
return realm.heap().allocate<Comment>(realm, window.associated_document(), data).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace Web::DOM {
|
|||
|
||||
CustomEvent* CustomEvent::create(JS::Realm& realm, DeprecatedFlyString const& event_name, CustomEventInit const& event_init)
|
||||
{
|
||||
return realm.heap().allocate<CustomEvent>(realm, realm, event_name, event_init);
|
||||
return realm.heap().allocate<CustomEvent>(realm, realm, event_name, event_init).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
CustomEvent* CustomEvent::construct_impl(JS::Realm& realm, DeprecatedFlyString const& event_name, CustomEventInit const& event_init)
|
||||
|
|
|
@ -20,7 +20,7 @@ namespace Web::DOM {
|
|||
JS::NonnullGCPtr<DOMImplementation> DOMImplementation::create(Document& document)
|
||||
{
|
||||
auto& realm = document.realm();
|
||||
return realm.heap().allocate<DOMImplementation>(realm, document);
|
||||
return realm.heap().allocate<DOMImplementation>(realm, document).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
DOMImplementation::DOMImplementation(Document& document)
|
||||
|
@ -84,7 +84,7 @@ JS::NonnullGCPtr<Document> DOMImplementation::create_html_document(DeprecatedStr
|
|||
html_document->set_content_type("text/html");
|
||||
html_document->set_ready_for_post_load_tasks(true);
|
||||
|
||||
auto doctype = heap().allocate<DocumentType>(realm(), html_document);
|
||||
auto doctype = heap().allocate<DocumentType>(realm(), html_document).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
doctype->set_name("html");
|
||||
MUST(html_document->append_child(*doctype));
|
||||
|
||||
|
@ -98,7 +98,7 @@ JS::NonnullGCPtr<Document> DOMImplementation::create_html_document(DeprecatedStr
|
|||
auto title_element = create_element(html_document, HTML::TagNames::title, Namespace::HTML);
|
||||
MUST(head_element->append_child(title_element));
|
||||
|
||||
auto text_node = heap().allocate<Text>(realm(), html_document, title);
|
||||
auto text_node = heap().allocate<Text>(realm(), html_document, title).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
MUST(title_element->append_child(*text_node));
|
||||
}
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ namespace Web::DOM {
|
|||
DOMTokenList* DOMTokenList::create(Element const& associated_element, DeprecatedFlyString associated_attribute)
|
||||
{
|
||||
auto& realm = associated_element.realm();
|
||||
return realm.heap().allocate<DOMTokenList>(realm, associated_element, move(associated_attribute));
|
||||
return realm.heap().allocate<DOMTokenList>(realm, associated_element, move(associated_attribute)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#ref-for-domtokenlist%E2%91%A0%E2%91%A2
|
||||
|
|
|
@ -290,7 +290,7 @@ JS::NonnullGCPtr<Document> Document::construct_impl(JS::Realm& realm)
|
|||
|
||||
JS::NonnullGCPtr<Document> Document::create(JS::Realm& realm, AK::URL const& url)
|
||||
{
|
||||
return realm.heap().allocate<Document>(realm, realm, url);
|
||||
return realm.heap().allocate<Document>(realm, realm, url).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
Document::Document(JS::Realm& realm, const AK::URL& url)
|
||||
|
@ -687,7 +687,7 @@ void Document::set_title(DeprecatedString const& title)
|
|||
}
|
||||
|
||||
title_element->remove_all_children(true);
|
||||
MUST(title_element->append_child(heap().allocate<Text>(realm(), *this, title)));
|
||||
MUST(title_element->append_child(heap().allocate<Text>(realm(), *this, title).release_allocated_value_but_fixme_should_propagate_errors()));
|
||||
|
||||
if (auto* page = this->page()) {
|
||||
if (browsing_context() == &page->top_level_browsing_context())
|
||||
|
@ -1230,17 +1230,17 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<Element>> Document::create_element_ns(Depre
|
|||
|
||||
JS::NonnullGCPtr<DocumentFragment> Document::create_document_fragment()
|
||||
{
|
||||
return heap().allocate<DocumentFragment>(realm(), *this);
|
||||
return heap().allocate<DocumentFragment>(realm(), *this).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
JS::NonnullGCPtr<Text> Document::create_text_node(DeprecatedString const& data)
|
||||
{
|
||||
return heap().allocate<Text>(realm(), *this, data);
|
||||
return heap().allocate<Text>(realm(), *this, data).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
JS::NonnullGCPtr<Comment> Document::create_comment(DeprecatedString const& data)
|
||||
{
|
||||
return heap().allocate<Comment>(realm(), *this, data);
|
||||
return heap().allocate<Comment>(realm(), *this, data).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-document-createprocessinginstruction
|
||||
|
@ -1251,7 +1251,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<ProcessingInstruction>> Document::create_pr
|
|||
// FIXME: 2. If data contains the string "?>", then throw an "InvalidCharacterError" DOMException.
|
||||
|
||||
// 3. Return a new ProcessingInstruction node, with target set to target, data set to data, and node document set to this.
|
||||
return JS::NonnullGCPtr { *heap().allocate<ProcessingInstruction>(realm(), *this, data, target) };
|
||||
return MUST_OR_THROW_OOM(heap().allocate<ProcessingInstruction>(realm(), *this, data, target));
|
||||
}
|
||||
|
||||
JS::NonnullGCPtr<Range> Document::create_range()
|
||||
|
|
|
@ -37,7 +37,7 @@ void DocumentFragment::set_host(Web::DOM::Element* element)
|
|||
JS::NonnullGCPtr<DocumentFragment> DocumentFragment::construct_impl(JS::Realm& realm)
|
||||
{
|
||||
auto& window = verify_cast<HTML::Window>(realm.global_object());
|
||||
return realm.heap().allocate<DocumentFragment>(realm, window.associated_document());
|
||||
return realm.heap().allocate<DocumentFragment>(realm, window.associated_document()).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ namespace Web::DOM {
|
|||
|
||||
JS::NonnullGCPtr<DocumentType> DocumentType::create(Document& document)
|
||||
{
|
||||
return document.heap().allocate<DocumentType>(document.realm(), document);
|
||||
return document.heap().allocate<DocumentType>(document.realm(), document).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
DocumentType::DocumentType(Document& document)
|
||||
|
|
|
@ -1180,7 +1180,7 @@ WebIDL::ExceptionOr<JS::GCPtr<Element>> Element::insert_adjacent_element(Depreca
|
|||
WebIDL::ExceptionOr<void> Element::insert_adjacent_text(DeprecatedString const& where, DeprecatedString const& data)
|
||||
{
|
||||
// 1. Let text be a new Text node whose data is data and node document is this’s node document.
|
||||
auto text = heap().allocate<DOM::Text>(realm(), document(), data);
|
||||
auto text = MUST_OR_THROW_OOM(heap().allocate<DOM::Text>(realm(), document(), data));
|
||||
|
||||
// 2. Run insert adjacent, given this, where, and text.
|
||||
// Spec Note: This method returns nothing because it existed before we had a chance to design it.
|
||||
|
|
|
@ -120,180 +120,180 @@ JS::NonnullGCPtr<Element> create_element(Document& document, DeprecatedFlyString
|
|||
|
||||
auto qualified_name = QualifiedName { local_name, prefix, namespace_ };
|
||||
if (lowercase_tag_name == HTML::TagNames::a)
|
||||
return realm.heap().allocate<HTML::HTMLAnchorElement>(realm, document, move(qualified_name));
|
||||
return realm.heap().allocate<HTML::HTMLAnchorElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
if (lowercase_tag_name == HTML::TagNames::area)
|
||||
return realm.heap().allocate<HTML::HTMLAreaElement>(realm, document, move(qualified_name));
|
||||
return realm.heap().allocate<HTML::HTMLAreaElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
if (lowercase_tag_name == HTML::TagNames::audio)
|
||||
return realm.heap().allocate<HTML::HTMLAudioElement>(realm, document, move(qualified_name));
|
||||
return realm.heap().allocate<HTML::HTMLAudioElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
if (lowercase_tag_name == HTML::TagNames::base)
|
||||
return realm.heap().allocate<HTML::HTMLBaseElement>(realm, document, move(qualified_name));
|
||||
return realm.heap().allocate<HTML::HTMLBaseElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
if (lowercase_tag_name == HTML::TagNames::blink)
|
||||
return realm.heap().allocate<HTML::HTMLBlinkElement>(realm, document, move(qualified_name));
|
||||
return realm.heap().allocate<HTML::HTMLBlinkElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
if (lowercase_tag_name == HTML::TagNames::body)
|
||||
return realm.heap().allocate<HTML::HTMLBodyElement>(realm, document, move(qualified_name));
|
||||
return realm.heap().allocate<HTML::HTMLBodyElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
if (lowercase_tag_name == HTML::TagNames::br)
|
||||
return realm.heap().allocate<HTML::HTMLBRElement>(realm, document, move(qualified_name));
|
||||
return realm.heap().allocate<HTML::HTMLBRElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
if (lowercase_tag_name == HTML::TagNames::button)
|
||||
return realm.heap().allocate<HTML::HTMLButtonElement>(realm, document, move(qualified_name));
|
||||
return realm.heap().allocate<HTML::HTMLButtonElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
if (lowercase_tag_name == HTML::TagNames::canvas)
|
||||
return realm.heap().allocate<HTML::HTMLCanvasElement>(realm, document, move(qualified_name));
|
||||
return realm.heap().allocate<HTML::HTMLCanvasElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
if (lowercase_tag_name == HTML::TagNames::data)
|
||||
return realm.heap().allocate<HTML::HTMLDataElement>(realm, document, move(qualified_name));
|
||||
return realm.heap().allocate<HTML::HTMLDataElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
if (lowercase_tag_name == HTML::TagNames::datalist)
|
||||
return realm.heap().allocate<HTML::HTMLDataListElement>(realm, document, move(qualified_name));
|
||||
return realm.heap().allocate<HTML::HTMLDataListElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
if (lowercase_tag_name == HTML::TagNames::details)
|
||||
return realm.heap().allocate<HTML::HTMLDetailsElement>(realm, document, move(qualified_name));
|
||||
return realm.heap().allocate<HTML::HTMLDetailsElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
if (lowercase_tag_name == HTML::TagNames::dialog)
|
||||
return realm.heap().allocate<HTML::HTMLDialogElement>(realm, document, move(qualified_name));
|
||||
return realm.heap().allocate<HTML::HTMLDialogElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
if (lowercase_tag_name == HTML::TagNames::dir)
|
||||
return realm.heap().allocate<HTML::HTMLDirectoryElement>(realm, document, move(qualified_name));
|
||||
return realm.heap().allocate<HTML::HTMLDirectoryElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
if (lowercase_tag_name == HTML::TagNames::div)
|
||||
return realm.heap().allocate<HTML::HTMLDivElement>(realm, document, move(qualified_name));
|
||||
return realm.heap().allocate<HTML::HTMLDivElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
if (lowercase_tag_name == HTML::TagNames::dl)
|
||||
return realm.heap().allocate<HTML::HTMLDListElement>(realm, document, move(qualified_name));
|
||||
return realm.heap().allocate<HTML::HTMLDListElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
if (lowercase_tag_name == HTML::TagNames::embed)
|
||||
return realm.heap().allocate<HTML::HTMLEmbedElement>(realm, document, move(qualified_name));
|
||||
return realm.heap().allocate<HTML::HTMLEmbedElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
if (lowercase_tag_name == HTML::TagNames::fieldset)
|
||||
return realm.heap().allocate<HTML::HTMLFieldSetElement>(realm, document, move(qualified_name));
|
||||
return realm.heap().allocate<HTML::HTMLFieldSetElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
if (lowercase_tag_name == HTML::TagNames::font)
|
||||
return realm.heap().allocate<HTML::HTMLFontElement>(realm, document, move(qualified_name));
|
||||
return realm.heap().allocate<HTML::HTMLFontElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
if (lowercase_tag_name == HTML::TagNames::form)
|
||||
return realm.heap().allocate<HTML::HTMLFormElement>(realm, document, move(qualified_name));
|
||||
return realm.heap().allocate<HTML::HTMLFormElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
if (lowercase_tag_name == HTML::TagNames::frame)
|
||||
return realm.heap().allocate<HTML::HTMLFrameElement>(realm, document, move(qualified_name));
|
||||
return realm.heap().allocate<HTML::HTMLFrameElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
if (lowercase_tag_name == HTML::TagNames::frameset)
|
||||
return realm.heap().allocate<HTML::HTMLFrameSetElement>(realm, document, move(qualified_name));
|
||||
return realm.heap().allocate<HTML::HTMLFrameSetElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
if (lowercase_tag_name == HTML::TagNames::head)
|
||||
return realm.heap().allocate<HTML::HTMLHeadElement>(realm, document, move(qualified_name));
|
||||
return realm.heap().allocate<HTML::HTMLHeadElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
if (lowercase_tag_name.is_one_of(HTML::TagNames::h1, HTML::TagNames::h2, HTML::TagNames::h3, HTML::TagNames::h4, HTML::TagNames::h5, HTML::TagNames::h6))
|
||||
return realm.heap().allocate<HTML::HTMLHeadingElement>(realm, document, move(qualified_name));
|
||||
return realm.heap().allocate<HTML::HTMLHeadingElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
if (lowercase_tag_name == HTML::TagNames::hr)
|
||||
return realm.heap().allocate<HTML::HTMLHRElement>(realm, document, move(qualified_name));
|
||||
return realm.heap().allocate<HTML::HTMLHRElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
if (lowercase_tag_name == HTML::TagNames::html)
|
||||
return realm.heap().allocate<HTML::HTMLHtmlElement>(realm, document, move(qualified_name));
|
||||
return realm.heap().allocate<HTML::HTMLHtmlElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
if (lowercase_tag_name == HTML::TagNames::iframe)
|
||||
return realm.heap().allocate<HTML::HTMLIFrameElement>(realm, document, move(qualified_name));
|
||||
return realm.heap().allocate<HTML::HTMLIFrameElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
if (lowercase_tag_name == HTML::TagNames::img)
|
||||
return realm.heap().allocate<HTML::HTMLImageElement>(realm, document, move(qualified_name));
|
||||
return realm.heap().allocate<HTML::HTMLImageElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
if (lowercase_tag_name == HTML::TagNames::input)
|
||||
return realm.heap().allocate<HTML::HTMLInputElement>(realm, document, move(qualified_name));
|
||||
return realm.heap().allocate<HTML::HTMLInputElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
if (lowercase_tag_name == HTML::TagNames::label)
|
||||
return realm.heap().allocate<HTML::HTMLLabelElement>(realm, document, move(qualified_name));
|
||||
return realm.heap().allocate<HTML::HTMLLabelElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
if (lowercase_tag_name == HTML::TagNames::legend)
|
||||
return realm.heap().allocate<HTML::HTMLLegendElement>(realm, document, move(qualified_name));
|
||||
return realm.heap().allocate<HTML::HTMLLegendElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
if (lowercase_tag_name == HTML::TagNames::li)
|
||||
return realm.heap().allocate<HTML::HTMLLIElement>(realm, document, move(qualified_name));
|
||||
return realm.heap().allocate<HTML::HTMLLIElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
if (lowercase_tag_name == HTML::TagNames::link)
|
||||
return realm.heap().allocate<HTML::HTMLLinkElement>(realm, document, move(qualified_name));
|
||||
return realm.heap().allocate<HTML::HTMLLinkElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
if (lowercase_tag_name == HTML::TagNames::map)
|
||||
return realm.heap().allocate<HTML::HTMLMapElement>(realm, document, move(qualified_name));
|
||||
return realm.heap().allocate<HTML::HTMLMapElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
if (lowercase_tag_name == HTML::TagNames::marquee)
|
||||
return realm.heap().allocate<HTML::HTMLMarqueeElement>(realm, document, move(qualified_name));
|
||||
return realm.heap().allocate<HTML::HTMLMarqueeElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
if (lowercase_tag_name == HTML::TagNames::menu)
|
||||
return realm.heap().allocate<HTML::HTMLMenuElement>(realm, document, move(qualified_name));
|
||||
return realm.heap().allocate<HTML::HTMLMenuElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
if (lowercase_tag_name == HTML::TagNames::meta)
|
||||
return realm.heap().allocate<HTML::HTMLMetaElement>(realm, document, move(qualified_name));
|
||||
return realm.heap().allocate<HTML::HTMLMetaElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
if (lowercase_tag_name == HTML::TagNames::meter)
|
||||
return realm.heap().allocate<HTML::HTMLMeterElement>(realm, document, move(qualified_name));
|
||||
return realm.heap().allocate<HTML::HTMLMeterElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
if (lowercase_tag_name.is_one_of(HTML::TagNames::ins, HTML::TagNames::del))
|
||||
return realm.heap().allocate<HTML::HTMLModElement>(realm, document, move(qualified_name));
|
||||
return realm.heap().allocate<HTML::HTMLModElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
if (lowercase_tag_name == HTML::TagNames::object)
|
||||
return realm.heap().allocate<HTML::HTMLObjectElement>(realm, document, move(qualified_name));
|
||||
return realm.heap().allocate<HTML::HTMLObjectElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
if (lowercase_tag_name == HTML::TagNames::ol)
|
||||
return realm.heap().allocate<HTML::HTMLOListElement>(realm, document, move(qualified_name));
|
||||
return realm.heap().allocate<HTML::HTMLOListElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
if (lowercase_tag_name == HTML::TagNames::optgroup)
|
||||
return realm.heap().allocate<HTML::HTMLOptGroupElement>(realm, document, move(qualified_name));
|
||||
return realm.heap().allocate<HTML::HTMLOptGroupElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
if (lowercase_tag_name == HTML::TagNames::option)
|
||||
return realm.heap().allocate<HTML::HTMLOptionElement>(realm, document, move(qualified_name));
|
||||
return realm.heap().allocate<HTML::HTMLOptionElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
if (lowercase_tag_name == HTML::TagNames::output)
|
||||
return realm.heap().allocate<HTML::HTMLOutputElement>(realm, document, move(qualified_name));
|
||||
return realm.heap().allocate<HTML::HTMLOutputElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
if (lowercase_tag_name == HTML::TagNames::p)
|
||||
return realm.heap().allocate<HTML::HTMLParagraphElement>(realm, document, move(qualified_name));
|
||||
return realm.heap().allocate<HTML::HTMLParagraphElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
if (lowercase_tag_name == HTML::TagNames::param)
|
||||
return realm.heap().allocate<HTML::HTMLParamElement>(realm, document, move(qualified_name));
|
||||
return realm.heap().allocate<HTML::HTMLParamElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
if (lowercase_tag_name == HTML::TagNames::picture)
|
||||
return realm.heap().allocate<HTML::HTMLPictureElement>(realm, document, move(qualified_name));
|
||||
return realm.heap().allocate<HTML::HTMLPictureElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
// NOTE: The obsolete elements "listing" and "xmp" are explicitly mapped to HTMLPreElement in the specification.
|
||||
if (lowercase_tag_name.is_one_of(HTML::TagNames::pre, HTML::TagNames::listing, HTML::TagNames::xmp))
|
||||
return realm.heap().allocate<HTML::HTMLPreElement>(realm, document, move(qualified_name));
|
||||
return realm.heap().allocate<HTML::HTMLPreElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
if (lowercase_tag_name == HTML::TagNames::progress)
|
||||
return realm.heap().allocate<HTML::HTMLProgressElement>(realm, document, move(qualified_name));
|
||||
return realm.heap().allocate<HTML::HTMLProgressElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
if (lowercase_tag_name.is_one_of(HTML::TagNames::blockquote, HTML::TagNames::q))
|
||||
return realm.heap().allocate<HTML::HTMLQuoteElement>(realm, document, move(qualified_name));
|
||||
return realm.heap().allocate<HTML::HTMLQuoteElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
if (lowercase_tag_name == HTML::TagNames::script)
|
||||
return realm.heap().allocate<HTML::HTMLScriptElement>(realm, document, move(qualified_name));
|
||||
return realm.heap().allocate<HTML::HTMLScriptElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
if (lowercase_tag_name == HTML::TagNames::select)
|
||||
return realm.heap().allocate<HTML::HTMLSelectElement>(realm, document, move(qualified_name));
|
||||
return realm.heap().allocate<HTML::HTMLSelectElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
if (lowercase_tag_name == HTML::TagNames::slot)
|
||||
return realm.heap().allocate<HTML::HTMLSlotElement>(realm, document, move(qualified_name));
|
||||
return realm.heap().allocate<HTML::HTMLSlotElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
if (lowercase_tag_name == HTML::TagNames::source)
|
||||
return realm.heap().allocate<HTML::HTMLSourceElement>(realm, document, move(qualified_name));
|
||||
return realm.heap().allocate<HTML::HTMLSourceElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
if (lowercase_tag_name == HTML::TagNames::span)
|
||||
return realm.heap().allocate<HTML::HTMLSpanElement>(realm, document, move(qualified_name));
|
||||
return realm.heap().allocate<HTML::HTMLSpanElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
if (lowercase_tag_name == HTML::TagNames::style)
|
||||
return realm.heap().allocate<HTML::HTMLStyleElement>(realm, document, move(qualified_name));
|
||||
return realm.heap().allocate<HTML::HTMLStyleElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
if (lowercase_tag_name == HTML::TagNames::caption)
|
||||
return realm.heap().allocate<HTML::HTMLTableCaptionElement>(realm, document, move(qualified_name));
|
||||
return realm.heap().allocate<HTML::HTMLTableCaptionElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
if (lowercase_tag_name.is_one_of(Web::HTML::TagNames::td, Web::HTML::TagNames::th))
|
||||
return realm.heap().allocate<HTML::HTMLTableCellElement>(realm, document, move(qualified_name));
|
||||
return realm.heap().allocate<HTML::HTMLTableCellElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
if (lowercase_tag_name.is_one_of(HTML::TagNames::colgroup, HTML::TagNames::col))
|
||||
return realm.heap().allocate<HTML::HTMLTableColElement>(realm, document, move(qualified_name));
|
||||
return realm.heap().allocate<HTML::HTMLTableColElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
if (lowercase_tag_name == HTML::TagNames::table)
|
||||
return realm.heap().allocate<HTML::HTMLTableElement>(realm, document, move(qualified_name));
|
||||
return realm.heap().allocate<HTML::HTMLTableElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
if (lowercase_tag_name == HTML::TagNames::tr)
|
||||
return realm.heap().allocate<HTML::HTMLTableRowElement>(realm, document, move(qualified_name));
|
||||
return realm.heap().allocate<HTML::HTMLTableRowElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
if (lowercase_tag_name.is_one_of(HTML::TagNames::tbody, HTML::TagNames::thead, HTML::TagNames::tfoot))
|
||||
return realm.heap().allocate<HTML::HTMLTableSectionElement>(realm, document, move(qualified_name));
|
||||
return realm.heap().allocate<HTML::HTMLTableSectionElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
if (lowercase_tag_name == HTML::TagNames::template_)
|
||||
return realm.heap().allocate<HTML::HTMLTemplateElement>(realm, document, move(qualified_name));
|
||||
return realm.heap().allocate<HTML::HTMLTemplateElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
if (lowercase_tag_name == HTML::TagNames::textarea)
|
||||
return realm.heap().allocate<HTML::HTMLTextAreaElement>(realm, document, move(qualified_name));
|
||||
return realm.heap().allocate<HTML::HTMLTextAreaElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
if (lowercase_tag_name == HTML::TagNames::time)
|
||||
return realm.heap().allocate<HTML::HTMLTimeElement>(realm, document, move(qualified_name));
|
||||
return realm.heap().allocate<HTML::HTMLTimeElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
if (lowercase_tag_name == HTML::TagNames::title)
|
||||
return realm.heap().allocate<HTML::HTMLTitleElement>(realm, document, move(qualified_name));
|
||||
return realm.heap().allocate<HTML::HTMLTitleElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
if (lowercase_tag_name == HTML::TagNames::track)
|
||||
return realm.heap().allocate<HTML::HTMLTrackElement>(realm, document, move(qualified_name));
|
||||
return realm.heap().allocate<HTML::HTMLTrackElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
if (lowercase_tag_name == HTML::TagNames::ul)
|
||||
return realm.heap().allocate<HTML::HTMLUListElement>(realm, document, move(qualified_name));
|
||||
return realm.heap().allocate<HTML::HTMLUListElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
if (lowercase_tag_name == HTML::TagNames::video)
|
||||
return realm.heap().allocate<HTML::HTMLVideoElement>(realm, document, move(qualified_name));
|
||||
return realm.heap().allocate<HTML::HTMLVideoElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
if (lowercase_tag_name.is_one_of(
|
||||
HTML::TagNames::article, HTML::TagNames::section, HTML::TagNames::nav, HTML::TagNames::aside, HTML::TagNames::hgroup, HTML::TagNames::header, HTML::TagNames::footer, HTML::TagNames::address, HTML::TagNames::dt, HTML::TagNames::dd, HTML::TagNames::figure, HTML::TagNames::figcaption, HTML::TagNames::main, HTML::TagNames::em, HTML::TagNames::strong, HTML::TagNames::small, HTML::TagNames::s, HTML::TagNames::cite, HTML::TagNames::dfn, HTML::TagNames::abbr, HTML::TagNames::ruby, HTML::TagNames::rt, HTML::TagNames::rp, HTML::TagNames::code, HTML::TagNames::var, HTML::TagNames::samp, HTML::TagNames::kbd, HTML::TagNames::sub, HTML::TagNames::sup, HTML::TagNames::i, HTML::TagNames::b, HTML::TagNames::u, HTML::TagNames::mark, HTML::TagNames::bdi, HTML::TagNames::bdo, HTML::TagNames::wbr, HTML::TagNames::summary, HTML::TagNames::noscript,
|
||||
// Obsolete
|
||||
HTML::TagNames::acronym, HTML::TagNames::basefont, HTML::TagNames::big, HTML::TagNames::center, HTML::TagNames::nobr, HTML::TagNames::noembed, HTML::TagNames::noframes, HTML::TagNames::plaintext, HTML::TagNames::rb, HTML::TagNames::rtc, HTML::TagNames::strike, HTML::TagNames::tt))
|
||||
return realm.heap().allocate<HTML::HTMLElement>(realm, document, move(qualified_name));
|
||||
return realm.heap().allocate<HTML::HTMLElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
if (lowercase_tag_name == SVG::TagNames::svg)
|
||||
return realm.heap().allocate<SVG::SVGSVGElement>(realm, document, move(qualified_name));
|
||||
return realm.heap().allocate<SVG::SVGSVGElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
// FIXME: Support SVG's mixedCase tag names properly.
|
||||
if (lowercase_tag_name.equals_ignoring_case(SVG::TagNames::clipPath))
|
||||
return realm.heap().allocate<SVG::SVGClipPathElement>(realm, document, move(qualified_name));
|
||||
return realm.heap().allocate<SVG::SVGClipPathElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
if (lowercase_tag_name == SVG::TagNames::circle)
|
||||
return realm.heap().allocate<SVG::SVGCircleElement>(realm, document, move(qualified_name));
|
||||
return realm.heap().allocate<SVG::SVGCircleElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
if (lowercase_tag_name.equals_ignoring_case(SVG::TagNames::defs))
|
||||
return realm.heap().allocate<SVG::SVGDefsElement>(realm, document, move(qualified_name));
|
||||
return realm.heap().allocate<SVG::SVGDefsElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
if (lowercase_tag_name == SVG::TagNames::ellipse)
|
||||
return realm.heap().allocate<SVG::SVGEllipseElement>(realm, document, move(qualified_name));
|
||||
return realm.heap().allocate<SVG::SVGEllipseElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
if (lowercase_tag_name.equals_ignoring_case(SVG::TagNames::foreignObject))
|
||||
return realm.heap().allocate<SVG::SVGForeignObjectElement>(realm, document, move(qualified_name));
|
||||
return realm.heap().allocate<SVG::SVGForeignObjectElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
if (lowercase_tag_name == SVG::TagNames::line)
|
||||
return realm.heap().allocate<SVG::SVGLineElement>(realm, document, move(qualified_name));
|
||||
return realm.heap().allocate<SVG::SVGLineElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
if (lowercase_tag_name == SVG::TagNames::path)
|
||||
return realm.heap().allocate<SVG::SVGPathElement>(realm, document, move(qualified_name));
|
||||
return realm.heap().allocate<SVG::SVGPathElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
if (lowercase_tag_name == SVG::TagNames::polygon)
|
||||
return realm.heap().allocate<SVG::SVGPolygonElement>(realm, document, move(qualified_name));
|
||||
return realm.heap().allocate<SVG::SVGPolygonElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
if (lowercase_tag_name == SVG::TagNames::polyline)
|
||||
return realm.heap().allocate<SVG::SVGPolylineElement>(realm, document, move(qualified_name));
|
||||
return realm.heap().allocate<SVG::SVGPolylineElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
if (lowercase_tag_name == SVG::TagNames::rect)
|
||||
return realm.heap().allocate<SVG::SVGRectElement>(realm, document, move(qualified_name));
|
||||
return realm.heap().allocate<SVG::SVGRectElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
if (lowercase_tag_name == SVG::TagNames::g)
|
||||
return realm.heap().allocate<SVG::SVGGElement>(realm, document, move(qualified_name));
|
||||
return realm.heap().allocate<SVG::SVGGElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
if (lowercase_tag_name == SVG::TagNames::text)
|
||||
return realm.heap().allocate<SVG::SVGTextContentElement>(realm, document, move(qualified_name));
|
||||
return realm.heap().allocate<SVG::SVGTextContentElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
|
||||
// FIXME: If name is a valid custom element name, then return HTMLElement.
|
||||
|
||||
return realm.heap().allocate<HTML::HTMLUnknownElement>(realm, document, move(qualified_name));
|
||||
return realm.heap().allocate<HTML::HTMLUnknownElement>(realm, document, move(qualified_name)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ namespace Web::DOM {
|
|||
|
||||
JS::NonnullGCPtr<Event> Event::create(JS::Realm& realm, DeprecatedFlyString const& event_name, EventInit const& event_init)
|
||||
{
|
||||
return realm.heap().allocate<Event>(realm, realm, event_name, event_init);
|
||||
return realm.heap().allocate<Event>(realm, realm, event_name, event_init).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
JS::NonnullGCPtr<Event> Event::construct_impl(JS::Realm& realm, DeprecatedFlyString const& event_name, EventInit const& event_init)
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace Web::DOM {
|
|||
|
||||
JS::NonnullGCPtr<HTMLCollection> HTMLCollection::create(ParentNode& root, Function<bool(Element const&)> filter)
|
||||
{
|
||||
return root.heap().allocate<HTMLCollection>(root.realm(), root, move(filter));
|
||||
return root.heap().allocate<HTMLCollection>(root.realm(), root, move(filter)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
HTMLCollection::HTMLCollection(ParentNode& root, Function<bool(Element const&)> filter)
|
||||
|
|
|
@ -10,7 +10,7 @@ namespace Web::DOM {
|
|||
|
||||
JS::NonnullGCPtr<IDLEventListener> IDLEventListener::create(JS::Realm& realm, JS::NonnullGCPtr<WebIDL::CallbackType> callback)
|
||||
{
|
||||
return realm.heap().allocate<IDLEventListener>(realm, realm, move(callback));
|
||||
return realm.heap().allocate<IDLEventListener>(realm, realm, move(callback)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
IDLEventListener::IDLEventListener(JS::Realm& realm, JS::NonnullGCPtr<WebIDL::CallbackType> callback)
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace Web::DOM {
|
|||
|
||||
JS::NonnullGCPtr<NodeList> LiveNodeList::create(JS::Realm& realm, Node& root, Function<bool(Node const&)> filter)
|
||||
{
|
||||
return realm.heap().allocate<LiveNodeList>(realm, realm, root, move(filter));
|
||||
return realm.heap().allocate<LiveNodeList>(realm, realm, root, move(filter)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
LiveNodeList::LiveNodeList(JS::Realm& realm, Node& root, Function<bool(Node const&)> filter)
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace Web::DOM {
|
|||
|
||||
JS::NonnullGCPtr<MutationObserver> MutationObserver::construct_impl(JS::Realm& realm, JS::GCPtr<WebIDL::CallbackType> callback)
|
||||
{
|
||||
return realm.heap().allocate<MutationObserver>(realm, realm, callback);
|
||||
return realm.heap().allocate<MutationObserver>(realm, realm, callback).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-mutationobserver-mutationobserver
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Web::DOM {
|
|||
|
||||
JS::NonnullGCPtr<MutationRecord> MutationRecord::create(JS::Realm& realm, DeprecatedFlyString const& type, Node& target, NodeList& added_nodes, NodeList& removed_nodes, Node* previous_sibling, Node* next_sibling, DeprecatedString const& attribute_name, DeprecatedString const& attribute_namespace, DeprecatedString const& old_value)
|
||||
{
|
||||
return realm.heap().allocate<MutationRecord>(realm, realm, type, target, added_nodes, removed_nodes, previous_sibling, next_sibling, attribute_name, attribute_namespace, old_value);
|
||||
return realm.heap().allocate<MutationRecord>(realm, realm, type, target, added_nodes, removed_nodes, previous_sibling, next_sibling, attribute_name, attribute_namespace, old_value).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
MutationRecord::MutationRecord(JS::Realm& realm, DeprecatedFlyString const& type, Node& target, NodeList& added_nodes, NodeList& removed_nodes, Node* previous_sibling, Node* next_sibling, DeprecatedString const& attribute_name, DeprecatedString const& attribute_namespace, DeprecatedString const& old_value)
|
||||
|
|
|
@ -16,7 +16,7 @@ namespace Web::DOM {
|
|||
JS::NonnullGCPtr<NamedNodeMap> NamedNodeMap::create(Element& element)
|
||||
{
|
||||
auto& realm = element.realm();
|
||||
return realm.heap().allocate<NamedNodeMap>(realm, element);
|
||||
return realm.heap().allocate<NamedNodeMap>(realm, element).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
NamedNodeMap::NamedNodeMap(Element& element)
|
||||
|
|
|
@ -743,7 +743,7 @@ JS::NonnullGCPtr<Node> Node::clone_node(Document* document, bool clone_children)
|
|||
} else if (is<DocumentType>(this)) {
|
||||
// DocumentType
|
||||
auto document_type = verify_cast<DocumentType>(this);
|
||||
auto document_type_copy = heap().allocate<DocumentType>(realm(), *document);
|
||||
auto document_type_copy = heap().allocate<DocumentType>(realm(), *document).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
|
||||
// Set copy’s name, public ID, and system ID to those of node.
|
||||
document_type_copy->set_name(document_type->name());
|
||||
|
@ -760,26 +760,26 @@ JS::NonnullGCPtr<Node> Node::clone_node(Document* document, bool clone_children)
|
|||
auto text = verify_cast<Text>(this);
|
||||
|
||||
// Set copy’s data to that of node.
|
||||
auto text_copy = heap().allocate<Text>(realm(), *document, text->data());
|
||||
auto text_copy = heap().allocate<Text>(realm(), *document, text->data()).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
copy = move(text_copy);
|
||||
} else if (is<Comment>(this)) {
|
||||
// Comment
|
||||
auto comment = verify_cast<Comment>(this);
|
||||
|
||||
// Set copy’s data to that of node.
|
||||
auto comment_copy = heap().allocate<Comment>(realm(), *document, comment->data());
|
||||
auto comment_copy = heap().allocate<Comment>(realm(), *document, comment->data()).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
copy = move(comment_copy);
|
||||
} else if (is<ProcessingInstruction>(this)) {
|
||||
// ProcessingInstruction
|
||||
auto processing_instruction = verify_cast<ProcessingInstruction>(this);
|
||||
|
||||
// Set copy’s target and data to those of node.
|
||||
auto processing_instruction_copy = heap().allocate<ProcessingInstruction>(realm(), *document, processing_instruction->data(), processing_instruction->target());
|
||||
auto processing_instruction_copy = heap().allocate<ProcessingInstruction>(realm(), *document, processing_instruction->data(), processing_instruction->target()).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
copy = processing_instruction_copy;
|
||||
}
|
||||
// Otherwise, Do nothing.
|
||||
else if (is<DocumentFragment>(this)) {
|
||||
copy = heap().allocate<DocumentFragment>(realm(), *document);
|
||||
copy = heap().allocate<DocumentFragment>(realm(), *document).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
// FIXME: 4. Set copy’s node document and document to copy, if copy is a document, and set copy’s node document to document otherwise.
|
||||
|
@ -1179,7 +1179,7 @@ void Node::string_replace_all(DeprecatedString const& string)
|
|||
|
||||
// 2. If string is not the empty string, then set node to a new Text node whose data is string and node document is parent’s node document.
|
||||
if (!string.is_empty())
|
||||
node = heap().allocate<Text>(realm(), document(), string);
|
||||
node = heap().allocate<Text>(realm(), document(), string).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
|
||||
// 3. Replace all with node within parent.
|
||||
replace_all(node);
|
||||
|
|
|
@ -11,7 +11,7 @@ namespace Web::DOM {
|
|||
|
||||
JS::NonnullGCPtr<NodeFilter> NodeFilter::create(JS::Realm& realm, WebIDL::CallbackType& callback)
|
||||
{
|
||||
return realm.heap().allocate<NodeFilter>(realm, realm, callback);
|
||||
return realm.heap().allocate<NodeFilter>(realm, realm, callback).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
NodeFilter::NodeFilter(JS::Realm& realm, WebIDL::CallbackType& callback)
|
||||
|
|
|
@ -53,7 +53,7 @@ JS::NonnullGCPtr<NodeIterator> NodeIterator::create(Node& root, unsigned what_to
|
|||
// 2. Set iterator’s root and iterator’s reference to root.
|
||||
// 3. Set iterator’s pointer before reference to true.
|
||||
auto& realm = root.realm();
|
||||
auto iterator = realm.heap().allocate<NodeIterator>(realm, root);
|
||||
auto iterator = realm.heap().allocate<NodeIterator>(realm, root).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
|
||||
// 4. Set iterator’s whatToShow to whatToShow.
|
||||
iterator->m_what_to_show = what_to_show;
|
||||
|
|
|
@ -22,19 +22,19 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<Node>> convert_nodes_to_single_node(Vector<
|
|||
// 4. Otherwise, set node to a new DocumentFragment node whose node document is document, and then append each node in nodes, if any, to it.
|
||||
// 5. Return node.
|
||||
|
||||
auto potentially_convert_string_to_text_node = [&document](Variant<JS::Handle<Node>, DeprecatedString> const& node) -> JS::NonnullGCPtr<Node> {
|
||||
auto potentially_convert_string_to_text_node = [&document](Variant<JS::Handle<Node>, DeprecatedString> const& node) -> JS::ThrowCompletionOr<JS::NonnullGCPtr<Node>> {
|
||||
if (node.has<JS::Handle<Node>>())
|
||||
return *node.get<JS::Handle<Node>>();
|
||||
|
||||
return document.heap().allocate<DOM::Text>(document.realm(), document, node.get<DeprecatedString>());
|
||||
return MUST_OR_THROW_OOM(document.heap().allocate<DOM::Text>(document.realm(), document, node.get<DeprecatedString>()));
|
||||
};
|
||||
|
||||
if (nodes.size() == 1)
|
||||
return potentially_convert_string_to_text_node(nodes.first());
|
||||
return TRY(potentially_convert_string_to_text_node(nodes.first()));
|
||||
|
||||
auto document_fragment = document.heap().allocate<DOM::DocumentFragment>(document.realm(), document);
|
||||
auto document_fragment = MUST_OR_THROW_OOM(document.heap().allocate<DOM::DocumentFragment>(document.realm(), document));
|
||||
for (auto& unconverted_node : nodes) {
|
||||
auto node = potentially_convert_string_to_text_node(unconverted_node);
|
||||
auto node = TRY(potentially_convert_string_to_text_node(unconverted_node));
|
||||
(void)TRY(document_fragment->append_child(node));
|
||||
}
|
||||
|
||||
|
|
|
@ -35,13 +35,13 @@ JS::NonnullGCPtr<Range> Range::create(HTML::Window& window)
|
|||
JS::NonnullGCPtr<Range> Range::create(Document& document)
|
||||
{
|
||||
auto& realm = document.realm();
|
||||
return realm.heap().allocate<Range>(realm, document);
|
||||
return realm.heap().allocate<Range>(realm, document).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
JS::NonnullGCPtr<Range> Range::create(Node& start_container, u32 start_offset, Node& end_container, u32 end_offset)
|
||||
{
|
||||
auto& realm = start_container.realm();
|
||||
return realm.heap().allocate<Range>(realm, start_container, start_offset, end_container, end_offset);
|
||||
return realm.heap().allocate<Range>(realm, start_container, start_offset, end_container, end_offset).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
JS::NonnullGCPtr<Range> Range::construct_impl(JS::Realm& realm)
|
||||
|
@ -428,12 +428,12 @@ WebIDL::ExceptionOr<void> Range::select_node_contents(Node const& node)
|
|||
|
||||
JS::NonnullGCPtr<Range> Range::clone_range() const
|
||||
{
|
||||
return heap().allocate<Range>(shape().realm(), const_cast<Node&>(*m_start_container), m_start_offset, const_cast<Node&>(*m_end_container), m_end_offset);
|
||||
return heap().allocate<Range>(shape().realm(), const_cast<Node&>(*m_start_container), m_start_offset, const_cast<Node&>(*m_end_container), m_end_offset).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
JS::NonnullGCPtr<Range> Range::inverted() const
|
||||
{
|
||||
return heap().allocate<Range>(shape().realm(), const_cast<Node&>(*m_end_container), m_end_offset, const_cast<Node&>(*m_start_container), m_start_offset);
|
||||
return heap().allocate<Range>(shape().realm(), const_cast<Node&>(*m_end_container), m_end_offset, const_cast<Node&>(*m_start_container), m_start_offset).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
JS::NonnullGCPtr<Range> Range::normalized() const
|
||||
|
@ -587,7 +587,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<DocumentFragment>> Range::extract_contents(
|
|||
WebIDL::ExceptionOr<JS::NonnullGCPtr<DocumentFragment>> Range::extract()
|
||||
{
|
||||
// 1. Let fragment be a new DocumentFragment node whose node document is range’s start node’s node document.
|
||||
auto fragment = heap().allocate<DOM::DocumentFragment>(realm(), const_cast<Document&>(start_container()->document()));
|
||||
auto fragment = MUST_OR_THROW_OOM(heap().allocate<DOM::DocumentFragment>(realm(), const_cast<Document&>(start_container()->document())));
|
||||
|
||||
// 2. If range is collapsed, then return fragment.
|
||||
if (collapsed())
|
||||
|
@ -916,7 +916,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<DocumentFragment>> Range::clone_contents()
|
|||
WebIDL::ExceptionOr<JS::NonnullGCPtr<DocumentFragment>> Range::clone_the_contents()
|
||||
{
|
||||
// 1. Let fragment be a new DocumentFragment node whose node document is range’s start node’s node document.
|
||||
auto fragment = heap().allocate<DOM::DocumentFragment>(realm(), const_cast<Document&>(start_container()->document()));
|
||||
auto fragment = MUST_OR_THROW_OOM(heap().allocate<DOM::DocumentFragment>(realm(), const_cast<Document&>(start_container()->document())));
|
||||
|
||||
// 2. If range is collapsed, then return fragment.
|
||||
if (collapsed())
|
||||
|
|
|
@ -11,7 +11,7 @@ namespace Web::DOM {
|
|||
|
||||
JS::NonnullGCPtr<NodeList> StaticNodeList::create(JS::Realm& realm, Vector<JS::Handle<Node>> static_nodes)
|
||||
{
|
||||
return realm.heap().allocate<StaticNodeList>(realm, realm, move(static_nodes));
|
||||
return realm.heap().allocate<StaticNodeList>(realm, realm, move(static_nodes)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
StaticNodeList::StaticNodeList(JS::Realm& realm, Vector<JS::Handle<Node>> static_nodes)
|
||||
|
|
|
@ -32,7 +32,7 @@ WebIDL::ExceptionOr<StaticRange*> StaticRange::construct_impl(JS::Realm& realm,
|
|||
return WebIDL::InvalidNodeTypeError::create(realm, "endContainer cannot be a DocumentType or Attribute node.");
|
||||
|
||||
// 2. Set this’s start to (init["startContainer"], init["startOffset"]) and end to (init["endContainer"], init["endOffset"]).
|
||||
return realm.heap().allocate<StaticRange>(realm, *init.start_container, init.start_offset, *init.end_container, init.end_offset).ptr();
|
||||
return realm.heap().allocate<StaticRange>(realm, *init.start_container, init.start_offset, *init.end_container, init.end_offset).release_allocated_value_but_fixme_should_propagate_errors().ptr();
|
||||
}
|
||||
|
||||
JS::ThrowCompletionOr<void> StaticRange::initialize(JS::Realm& realm)
|
||||
|
|
|
@ -43,7 +43,7 @@ JS::NonnullGCPtr<Text> Text::construct_impl(JS::Realm& realm, DeprecatedString c
|
|||
{
|
||||
// The new Text(data) constructor steps are to set this’s data to data and this’s node document to current global object’s associated Document.
|
||||
auto& window = verify_cast<HTML::Window>(HTML::current_global_object());
|
||||
return realm.heap().allocate<Text>(realm, window.associated_document(), data);
|
||||
return realm.heap().allocate<Text>(realm, window.associated_document(), data).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
void Text::set_owner_input_element(Badge<HTML::HTMLInputElement>, HTML::HTMLInputElement& input_element)
|
||||
|
@ -69,7 +69,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<Text>> Text::split_text(size_t offset)
|
|||
auto new_data = TRY(substring_data(offset, count));
|
||||
|
||||
// 5. Let new node be a new Text node, with the same node document as node. Set new node’s data to new data.
|
||||
auto new_node = heap().allocate<Text>(realm(), document(), new_data);
|
||||
auto new_node = MUST_OR_THROW_OOM(heap().allocate<Text>(realm(), document(), new_data));
|
||||
|
||||
// 6. Let parent be node’s parent.
|
||||
JS::GCPtr<Node> parent = this->parent();
|
||||
|
|
|
@ -44,7 +44,7 @@ JS::NonnullGCPtr<TreeWalker> TreeWalker::create(Node& root, unsigned what_to_sho
|
|||
// 1. Let walker be a new TreeWalker object.
|
||||
// 2. Set walker’s root and walker’s current to root.
|
||||
auto& realm = root.realm();
|
||||
auto walker = realm.heap().allocate<TreeWalker>(realm, root);
|
||||
auto walker = realm.heap().allocate<TreeWalker>(realm, root).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
|
||||
// 3. Set walker’s whatToShow to whatToShow.
|
||||
walker->m_what_to_show = what_to_show;
|
||||
|
|
|
@ -21,7 +21,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<DOM::DocumentFragment>> parse_fragment(Depr
|
|||
auto& realm = context_element.realm();
|
||||
|
||||
auto new_children = HTML::HTMLParser::parse_html_fragment(context_element, markup);
|
||||
auto fragment = realm.heap().allocate<DOM::DocumentFragment>(realm, context_element.document());
|
||||
auto fragment = MUST_OR_THROW_OOM(realm.heap().allocate<DOM::DocumentFragment>(realm, context_element.document()));
|
||||
|
||||
for (auto& child : new_children) {
|
||||
// I don't know if this can throw here, but let's be safe.
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace Web::DOMParsing {
|
|||
|
||||
JS::NonnullGCPtr<XMLSerializer> XMLSerializer::construct_impl(JS::Realm& realm)
|
||||
{
|
||||
return realm.heap().allocate<XMLSerializer>(realm, realm);
|
||||
return (realm.heap().allocate<XMLSerializer>(realm, realm)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
XMLSerializer::XMLSerializer(JS::Realm& realm)
|
||||
|
|
|
@ -18,7 +18,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<TextDecoder>> TextDecoder::construct_impl(J
|
|||
if (!decoder)
|
||||
return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, DeprecatedString::formatted("Invalid encoding {}", encoding) };
|
||||
|
||||
return realm.heap().allocate<TextDecoder>(realm, realm, *decoder, move(encoding), false, false);
|
||||
return MUST_OR_THROW_OOM(realm.heap().allocate<TextDecoder>(realm, realm, *decoder, move(encoding), false, false));
|
||||
}
|
||||
|
||||
// https://encoding.spec.whatwg.org/#dom-textdecoder
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace Web::Encoding {
|
|||
|
||||
JS::NonnullGCPtr<TextEncoder> TextEncoder::construct_impl(JS::Realm& realm)
|
||||
{
|
||||
return realm.heap().allocate<TextEncoder>(realm, realm);
|
||||
return realm.heap().allocate<TextEncoder>(realm, realm).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
TextEncoder::TextEncoder(JS::Realm& realm)
|
||||
|
|
|
@ -43,12 +43,12 @@ WebIDL::ExceptionOr<Infrastructure::BodyWithType> extract_body(JS::Realm& realm,
|
|||
else if (auto const* blob_handle = object.get_pointer<JS::Handle<FileAPI::Blob>>()) {
|
||||
// FIXME: "set stream to the result of running object’s get stream"
|
||||
(void)blob_handle;
|
||||
stream = realm.heap().allocate<Streams::ReadableStream>(realm, realm);
|
||||
stream = MUST_OR_THROW_OOM(realm.heap().allocate<Streams::ReadableStream>(realm, realm));
|
||||
}
|
||||
// 4. Otherwise, set stream to a new ReadableStream object, and set up stream.
|
||||
else {
|
||||
// FIXME: "set up stream"
|
||||
stream = realm.heap().allocate<Streams::ReadableStream>(realm, realm);
|
||||
stream = MUST_OR_THROW_OOM(realm.heap().allocate<Streams::ReadableStream>(realm, realm));
|
||||
}
|
||||
|
||||
// 5. Assert: stream is a ReadableStream object.
|
||||
|
|
|
@ -17,7 +17,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<Headers>> Headers::construct_impl(JS::Realm
|
|||
auto& vm = realm.vm();
|
||||
|
||||
// The new Headers(init) constructor steps are:
|
||||
auto headers = realm.heap().allocate<Headers>(realm, realm, Infrastructure::HeaderList::create(vm));
|
||||
auto headers = MUST_OR_THROW_OOM(realm.heap().allocate<Headers>(realm, realm, Infrastructure::HeaderList::create(vm)));
|
||||
|
||||
// 1. Set this’s guard to "none".
|
||||
headers->m_guard = Guard::None;
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace Web::Bindings {
|
|||
template<>
|
||||
void Intrinsics::create_web_prototype_and_constructor<HeadersIteratorPrototype>(JS::Realm& realm)
|
||||
{
|
||||
auto prototype = heap().allocate<HeadersIteratorPrototype>(realm, realm);
|
||||
auto prototype = heap().allocate<HeadersIteratorPrototype>(realm, realm).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
m_prototypes.set("HeadersIterator"sv, prototype);
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@ namespace Web::Fetch {
|
|||
|
||||
JS::NonnullGCPtr<HeadersIterator> HeadersIterator::create(Headers const& headers, JS::Object::PropertyKind iteration_kind)
|
||||
{
|
||||
return headers.heap().allocate<HeadersIterator>(headers.realm(), headers, iteration_kind);
|
||||
return headers.heap().allocate<HeadersIterator>(headers.realm(), headers, iteration_kind).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
HeadersIterator::HeadersIterator(Headers const& headers, JS::Object::PropertyKind iteration_kind)
|
||||
|
|
|
@ -34,7 +34,7 @@ WebIDL::ExceptionOr<Body> Body::clone() const
|
|||
|
||||
// FIXME: 1. Let « out1, out2 » be the result of teeing body’s stream.
|
||||
// FIXME: 2. Set body’s stream to out1.
|
||||
auto out2 = vm.heap().allocate<Streams::ReadableStream>(realm, realm);
|
||||
auto out2 = MUST_OR_THROW_OOM(vm.heap().allocate<Streams::ReadableStream>(realm, realm));
|
||||
|
||||
// 3. Return a body whose stream is out2 and other members are copied from body.
|
||||
return Body { JS::make_handle(out2), m_source, m_length };
|
||||
|
|
|
@ -85,14 +85,14 @@ JS::NonnullGCPtr<Request> Request::create(JS::Realm& realm, JS::NonnullGCPtr<Inf
|
|||
{
|
||||
// 1. Let requestObject be a new Request object with realm.
|
||||
// 2. Set requestObject’s request to request.
|
||||
auto request_object = realm.heap().allocate<Request>(realm, realm, request);
|
||||
auto request_object = realm.heap().allocate<Request>(realm, realm, request).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
|
||||
// 3. Set requestObject’s headers to a new Headers object with realm, whose headers list is request’s headers list and guard is guard.
|
||||
request_object->m_headers = realm.heap().allocate<Headers>(realm, realm, request->header_list());
|
||||
request_object->m_headers = realm.heap().allocate<Headers>(realm, realm, request->header_list()).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
request_object->m_headers->set_guard(guard);
|
||||
|
||||
// 4. Set requestObject’s signal to a new AbortSignal object with realm.
|
||||
request_object->m_signal = realm.heap().allocate<DOM::AbortSignal>(realm, realm);
|
||||
request_object->m_signal = realm.heap().allocate<DOM::AbortSignal>(realm, realm).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
|
||||
// 5. Return requestObject.
|
||||
return request_object;
|
||||
|
@ -104,7 +104,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<Request>> Request::construct_impl(JS::Realm
|
|||
auto& vm = realm.vm();
|
||||
|
||||
// Referred to as 'this' in the spec.
|
||||
auto request_object = realm.heap().allocate<Request>(realm, realm, Infrastructure::Request::create(vm));
|
||||
auto request_object = MUST_OR_THROW_OOM(realm.heap().allocate<Request>(realm, realm, Infrastructure::Request::create(vm)));
|
||||
|
||||
// 1. Let request be null.
|
||||
JS::GCPtr<Infrastructure::Request> input_request;
|
||||
|
@ -389,14 +389,14 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<Request>> Request::construct_impl(JS::Realm
|
|||
|
||||
// 28. Set this’s signal to a new AbortSignal object with this’s relevant Realm.
|
||||
auto& this_relevant_realm = HTML::relevant_realm(*request_object);
|
||||
request_object->m_signal = realm.heap().allocate<DOM::AbortSignal>(this_relevant_realm, this_relevant_realm);
|
||||
request_object->m_signal = MUST_OR_THROW_OOM(realm.heap().allocate<DOM::AbortSignal>(this_relevant_realm, this_relevant_realm));
|
||||
|
||||
// 29. If signal is not null, then make this’s signal follow signal.
|
||||
if (input_signal != nullptr)
|
||||
request_object->m_signal->follow(*input_signal);
|
||||
|
||||
// 30. Set this’s headers to a new Headers object with this’s relevant Realm, whose header list is request’s header list and guard is "request".
|
||||
request_object->m_headers = realm.heap().allocate<Headers>(realm, realm, request->header_list());
|
||||
request_object->m_headers = MUST_OR_THROW_OOM(realm.heap().allocate<Headers>(realm, realm, request->header_list()));
|
||||
request_object->m_headers->set_guard(Headers::Guard::Request);
|
||||
|
||||
// 31. If this’s request’s mode is "no-cors", then:
|
||||
|
|
|
@ -77,10 +77,10 @@ JS::NonnullGCPtr<Response> Response::create(JS::Realm& realm, JS::NonnullGCPtr<I
|
|||
{
|
||||
// 1. Let responseObject be a new Response object with realm.
|
||||
// 2. Set responseObject’s response to response.
|
||||
auto response_object = realm.heap().allocate<Response>(realm, realm, response);
|
||||
auto response_object = realm.heap().allocate<Response>(realm, realm, response).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
|
||||
// 3. Set responseObject’s headers to a new Headers object with realm, whose headers list is response’s headers list and guard is guard.
|
||||
response_object->m_headers = realm.heap().allocate<Headers>(realm, realm, response->header_list());
|
||||
response_object->m_headers = realm.heap().allocate<Headers>(realm, realm, response->header_list()).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
response_object->m_headers->set_guard(guard);
|
||||
|
||||
// 4. Return responseObject.
|
||||
|
@ -136,14 +136,14 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<Response>> Response::construct_impl(JS::Rea
|
|||
auto& vm = realm.vm();
|
||||
|
||||
// Referred to as 'this' in the spec.
|
||||
auto response_object = realm.heap().allocate<Response>(realm, realm, Infrastructure::Response::create(vm));
|
||||
auto response_object = MUST_OR_THROW_OOM(realm.heap().allocate<Response>(realm, realm, Infrastructure::Response::create(vm)));
|
||||
|
||||
// 1. Set this’s response to a new response.
|
||||
// NOTE: This is done at the beginning as the 'this' value Response object
|
||||
// cannot exist with a null Infrastructure::Response.
|
||||
|
||||
// 2. Set this’s headers to a new Headers object with this’s relevant Realm, whose header list is this’s response’s header list and guard is "response".
|
||||
response_object->m_headers = realm.heap().allocate<Headers>(realm, realm, response_object->response()->header_list());
|
||||
response_object->m_headers = MUST_OR_THROW_OOM(realm.heap().allocate<Headers>(realm, realm, response_object->response()->header_list()));
|
||||
response_object->m_headers->set_guard(Headers::Guard::Response);
|
||||
|
||||
// 3. Let bodyWithType be null.
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace Web::FileAPI {
|
|||
|
||||
JS::NonnullGCPtr<Blob> Blob::create(JS::Realm& realm, ByteBuffer byte_buffer, DeprecatedString type)
|
||||
{
|
||||
return realm.heap().allocate<Blob>(realm, realm, move(byte_buffer), move(type));
|
||||
return realm.heap().allocate<Blob>(realm, realm, move(byte_buffer), move(type)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
// https://w3c.github.io/FileAPI/#convert-line-endings-to-native
|
||||
|
@ -145,7 +145,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<Blob>> Blob::create(JS::Realm& realm, Optio
|
|||
{
|
||||
// 1. If invoked with zero parameters, return a new Blob object consisting of 0 bytes, with size set to 0, and with type set to the empty string.
|
||||
if (!blob_parts.has_value() && !options.has_value())
|
||||
return realm.heap().allocate<Blob>(realm, realm);
|
||||
return MUST_OR_THROW_OOM(realm.heap().allocate<Blob>(realm, realm));
|
||||
|
||||
ByteBuffer byte_buffer {};
|
||||
// 2. Let bytes be the result of processing blob parts given blobParts and options.
|
||||
|
@ -170,7 +170,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<Blob>> Blob::create(JS::Realm& realm, Optio
|
|||
}
|
||||
|
||||
// 4. Return a Blob object referring to bytes as its associated byte sequence, with its size set to the length of bytes, and its type set to the value of t from the substeps above.
|
||||
return realm.heap().allocate<Blob>(realm, realm, move(byte_buffer), move(type));
|
||||
return MUST_OR_THROW_OOM(realm.heap().allocate<Blob>(realm, realm, move(byte_buffer), move(type)));
|
||||
}
|
||||
|
||||
WebIDL::ExceptionOr<JS::NonnullGCPtr<Blob>> Blob::construct_impl(JS::Realm& realm, Optional<Vector<BlobPart>> const& blob_parts, Optional<BlobPropertyBag> const& options)
|
||||
|
@ -239,7 +239,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<Blob>> Blob::slice(Optional<i64> start, Opt
|
|||
// b. S.size = span.
|
||||
// c. S.type = relativeContentType.
|
||||
auto byte_buffer = TRY_OR_THROW_OOM(realm().vm(), m_byte_buffer.slice(relative_start, span));
|
||||
return heap().allocate<Blob>(realm(), realm(), move(byte_buffer), move(relative_content_type));
|
||||
return MUST_OR_THROW_OOM(heap().allocate<Blob>(realm(), realm(), move(byte_buffer), move(relative_content_type)));
|
||||
}
|
||||
|
||||
// https://w3c.github.io/FileAPI/#dom-blob-text
|
||||
|
|
|
@ -66,7 +66,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<File>> File::create(JS::Realm& realm, Vecto
|
|||
// 4. F.name is set to n.
|
||||
// 5. F.type is set to t.
|
||||
// 6. F.lastModified is set to d.
|
||||
return realm.heap().allocate<File>(realm, realm, move(bytes), move(name), move(type), last_modified);
|
||||
return MUST_OR_THROW_OOM(realm.heap().allocate<File>(realm, realm, move(bytes), move(name), move(type), last_modified));
|
||||
}
|
||||
|
||||
WebIDL::ExceptionOr<JS::NonnullGCPtr<File>> File::construct_impl(JS::Realm& realm, Vector<BlobPart> const& file_bits, DeprecatedString const& file_name, Optional<FilePropertyBag> const& options)
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace Web::FileAPI {
|
|||
|
||||
JS::NonnullGCPtr<FileList> FileList::create(JS::Realm& realm, Vector<JS::NonnullGCPtr<File>>&& files)
|
||||
{
|
||||
return realm.heap().allocate<FileList>(realm, realm, move(files));
|
||||
return realm.heap().allocate<FileList>(realm, realm, move(files)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
FileList::FileList(JS::Realm& realm, Vector<JS::NonnullGCPtr<File>>&& files)
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace Web::Geometry {
|
|||
|
||||
JS::NonnullGCPtr<DOMPoint> DOMPoint::construct_impl(JS::Realm& realm, double x, double y, double z, double w)
|
||||
{
|
||||
return realm.heap().allocate<DOMPoint>(realm, realm, x, y, z, w);
|
||||
return realm.heap().allocate<DOMPoint>(realm, realm, x, y, z, w).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
DOMPoint::DOMPoint(JS::Realm& realm, double x, double y, double z, double w)
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace Web::Geometry {
|
|||
|
||||
JS::NonnullGCPtr<DOMPointReadOnly> DOMPointReadOnly::construct_impl(JS::Realm& realm, double x, double y, double z, double w)
|
||||
{
|
||||
return realm.heap().allocate<DOMPointReadOnly>(realm, realm, x, y, z, w);
|
||||
return realm.heap().allocate<DOMPointReadOnly>(realm, realm, x, y, z, w).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
DOMPointReadOnly::DOMPointReadOnly(JS::Realm& realm, double x, double y, double z, double w)
|
||||
|
|
|
@ -11,7 +11,7 @@ namespace Web::Geometry {
|
|||
|
||||
JS::NonnullGCPtr<DOMRect> DOMRect::construct_impl(JS::Realm& realm, double x, double y, double width, double height)
|
||||
{
|
||||
return realm.heap().allocate<DOMRect>(realm, realm, x, y, width, height);
|
||||
return realm.heap().allocate<DOMRect>(realm, realm, x, y, width, height).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
JS::NonnullGCPtr<DOMRect> DOMRect::create(JS::Realm& realm, Gfx::FloatRect const& rect)
|
||||
|
|
|
@ -16,7 +16,7 @@ JS::NonnullGCPtr<DOMRectList> DOMRectList::create(JS::Realm& realm, Vector<JS::H
|
|||
Vector<JS::NonnullGCPtr<DOMRect>> rects;
|
||||
for (auto& rect : rect_handles)
|
||||
rects.append(*rect);
|
||||
return realm.heap().allocate<DOMRectList>(realm, realm, move(rects));
|
||||
return realm.heap().allocate<DOMRectList>(realm, realm, move(rects)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
DOMRectList::DOMRectList(JS::Realm& realm, Vector<JS::NonnullGCPtr<DOMRect>> rects)
|
||||
|
|
|
@ -11,7 +11,7 @@ namespace Web::Geometry {
|
|||
|
||||
JS::NonnullGCPtr<DOMRectReadOnly> DOMRectReadOnly::construct_impl(JS::Realm& realm, double x, double y, double width, double height)
|
||||
{
|
||||
return realm.heap().allocate<DOMRectReadOnly>(realm, realm, x, y, width, height);
|
||||
return realm.heap().allocate<DOMRectReadOnly>(realm, realm, x, y, width, height).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
DOMRectReadOnly::DOMRectReadOnly(JS::Realm& realm, double x, double y, double width, double height)
|
||||
|
|
|
@ -115,7 +115,7 @@ JS::NonnullGCPtr<BrowsingContext> BrowsingContext::create_a_new_browsing_context
|
|||
auto realm_execution_context = Bindings::create_a_new_javascript_realm(
|
||||
Bindings::main_thread_vm(),
|
||||
[&](JS::Realm& realm) -> JS::Object* {
|
||||
browsing_context->m_window_proxy = realm.heap().allocate<WindowProxy>(realm, realm);
|
||||
browsing_context->m_window_proxy = realm.heap().allocate<WindowProxy>(realm, realm).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
|
||||
// - For the global object, create a new Window object.
|
||||
window = HTML::Window::create(realm);
|
||||
|
|
|
@ -22,21 +22,21 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<CanvasGradient>> CanvasGradient::create_rad
|
|||
return WebIDL::IndexSizeError::create(realm, "The r1 passed is less than 0");
|
||||
|
||||
auto radial_gradient = Gfx::CanvasRadialGradientPaintStyle::create(Gfx::FloatPoint { x0, y0 }, r0, Gfx::FloatPoint { x1, y1 }, r1);
|
||||
return realm.heap().allocate<CanvasGradient>(realm, realm, *radial_gradient);
|
||||
return MUST_OR_THROW_OOM(realm.heap().allocate<CanvasGradient>(realm, realm, *radial_gradient));
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/canvas.html#dom-context-2d-createlineargradient
|
||||
JS::NonnullGCPtr<CanvasGradient> CanvasGradient::create_linear(JS::Realm& realm, double x0, double y0, double x1, double y1)
|
||||
{
|
||||
auto linear_gradient = Gfx::CanvasLinearGradientPaintStyle::create(Gfx::FloatPoint { x0, y0 }, Gfx::FloatPoint { x1, y1 });
|
||||
return realm.heap().allocate<CanvasGradient>(realm, realm, *linear_gradient);
|
||||
return realm.heap().allocate<CanvasGradient>(realm, realm, *linear_gradient).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/canvas.html#dom-context-2d-createconicgradient
|
||||
JS::NonnullGCPtr<CanvasGradient> CanvasGradient::create_conic(JS::Realm& realm, double start_angle, double x, double y)
|
||||
{
|
||||
auto conic_gradient = Gfx::CanvasConicGradientPaintStyle::create(Gfx::FloatPoint { x, y }, start_angle);
|
||||
return realm.heap().allocate<CanvasGradient>(realm, realm, *conic_gradient);
|
||||
return realm.heap().allocate<CanvasGradient>(realm, realm, *conic_gradient).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
CanvasGradient::CanvasGradient(JS::Realm& realm, Gfx::GradientPaintStyle& gradient)
|
||||
|
|
|
@ -26,7 +26,7 @@ namespace Web::HTML {
|
|||
|
||||
JS::NonnullGCPtr<CanvasRenderingContext2D> CanvasRenderingContext2D::create(JS::Realm& realm, HTMLCanvasElement& element)
|
||||
{
|
||||
return realm.heap().allocate<CanvasRenderingContext2D>(realm, realm, element);
|
||||
return realm.heap().allocate<CanvasRenderingContext2D>(realm, realm, element).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
CanvasRenderingContext2D::CanvasRenderingContext2D(JS::Realm& realm, HTMLCanvasElement& element)
|
||||
|
|
|
@ -11,7 +11,7 @@ namespace Web::HTML {
|
|||
|
||||
CloseEvent* CloseEvent::create(JS::Realm& realm, DeprecatedFlyString const& event_name, CloseEventInit const& event_init)
|
||||
{
|
||||
return realm.heap().allocate<CloseEvent>(realm, realm, event_name, event_init);
|
||||
return realm.heap().allocate<CloseEvent>(realm, realm, event_name, event_init).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
CloseEvent* CloseEvent::construct_impl(JS::Realm& realm, DeprecatedFlyString const& event_name, CloseEventInit const& event_init)
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace Web::HTML {
|
|||
|
||||
WebIDL::ExceptionOr<JS::NonnullGCPtr<DOMParser>> DOMParser::construct_impl(JS::Realm& realm)
|
||||
{
|
||||
return realm.heap().allocate<DOMParser>(realm, realm);
|
||||
return MUST_OR_THROW_OOM(realm.heap().allocate<DOMParser>(realm, realm));
|
||||
}
|
||||
|
||||
DOMParser::DOMParser(JS::Realm& realm)
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace Web::HTML {
|
|||
JS::NonnullGCPtr<DOMStringMap> DOMStringMap::create(DOM::Element& element)
|
||||
{
|
||||
auto& realm = element.realm();
|
||||
return realm.heap().allocate<DOMStringMap>(realm, element);
|
||||
return realm.heap().allocate<DOMStringMap>(realm, element).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
DOMStringMap::DOMStringMap(DOM::Element& element)
|
||||
|
|
|
@ -11,7 +11,7 @@ namespace Web::HTML {
|
|||
|
||||
ErrorEvent* ErrorEvent::create(JS::Realm& realm, DeprecatedFlyString const& event_name, ErrorEventInit const& event_init)
|
||||
{
|
||||
return realm.heap().allocate<ErrorEvent>(realm, realm, event_name, event_init);
|
||||
return realm.heap().allocate<ErrorEvent>(realm, realm, event_name, event_init).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
ErrorEvent* ErrorEvent::construct_impl(JS::Realm& realm, DeprecatedFlyString const& event_name, ErrorEventInit const& event_init)
|
||||
|
|
|
@ -382,13 +382,13 @@ void HTMLInputElement::create_shadow_tree_if_needed()
|
|||
break;
|
||||
}
|
||||
|
||||
auto shadow_root = heap().allocate<DOM::ShadowRoot>(realm(), document(), *this);
|
||||
auto shadow_root = heap().allocate<DOM::ShadowRoot>(realm(), document(), *this).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
auto initial_value = m_value;
|
||||
if (initial_value.is_null())
|
||||
initial_value = DeprecatedString::empty();
|
||||
auto element = document().create_element(HTML::TagNames::div).release_value();
|
||||
MUST(element->set_attribute(HTML::AttributeNames::style, "white-space: pre; padding-top: 1px; padding-bottom: 1px; padding-left: 2px; padding-right: 2px"));
|
||||
m_text_node = heap().allocate<DOM::Text>(realm(), document(), initial_value);
|
||||
m_text_node = heap().allocate<DOM::Text>(realm(), document(), initial_value).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
m_text_node->set_always_editable(m_type != TypeAttributeState::FileUpload);
|
||||
m_text_node->set_owner_input_element({}, *this);
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace Web::HTML {
|
|||
|
||||
JS::NonnullGCPtr<HTMLOptionsCollection> HTMLOptionsCollection::create(DOM::ParentNode& root, Function<bool(DOM::Element const&)> filter)
|
||||
{
|
||||
return root.heap().allocate<HTMLOptionsCollection>(root.realm(), root, move(filter));
|
||||
return root.heap().allocate<HTMLOptionsCollection>(root.realm(), root, move(filter)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
HTMLOptionsCollection::HTMLOptionsCollection(DOM::ParentNode& root, Function<bool(DOM::Element const&)> filter)
|
||||
|
|
|
@ -22,7 +22,7 @@ JS::ThrowCompletionOr<void> HTMLTemplateElement::initialize(JS::Realm& realm)
|
|||
MUST_OR_THROW_OOM(Base::initialize(realm));
|
||||
set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLTemplateElementPrototype>(realm, "HTMLTemplateElement"));
|
||||
|
||||
m_content = heap().allocate<DOM::DocumentFragment>(realm, m_document->appropriate_template_contents_owner_document());
|
||||
m_content = MUST_OR_THROW_OOM(heap().allocate<DOM::DocumentFragment>(realm, m_document->appropriate_template_contents_owner_document()));
|
||||
m_content->set_host(this);
|
||||
|
||||
return {};
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace Web::HTML {
|
|||
|
||||
JS::NonnullGCPtr<History> History::create(JS::Realm& realm, DOM::Document& document)
|
||||
{
|
||||
return realm.heap().allocate<History>(realm, realm, document);
|
||||
return realm.heap().allocate<History>(realm, realm, document).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
History::History(JS::Realm& realm, DOM::Document& document)
|
||||
|
|
|
@ -28,7 +28,7 @@ JS::GCPtr<ImageData> ImageData::create_with_size(JS::Realm& realm, int width, in
|
|||
auto bitmap_or_error = Gfx::Bitmap::create_wrapper(Gfx::BitmapFormat::RGBA8888, Gfx::IntSize(width, height), 1, width * sizeof(u32), data->data().data());
|
||||
if (bitmap_or_error.is_error())
|
||||
return nullptr;
|
||||
return realm.heap().allocate<ImageData>(realm, realm, bitmap_or_error.release_value(), move(data));
|
||||
return realm.heap().allocate<ImageData>(realm, realm, bitmap_or_error.release_value(), move(data)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
ImageData::ImageData(JS::Realm& realm, NonnullRefPtr<Gfx::Bitmap> bitmap, JS::NonnullGCPtr<JS::Uint8ClampedArray> data)
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace Web::HTML {
|
|||
|
||||
JS::NonnullGCPtr<MessageChannel> MessageChannel::construct_impl(JS::Realm& realm)
|
||||
{
|
||||
return realm.heap().allocate<MessageChannel>(realm, realm);
|
||||
return realm.heap().allocate<MessageChannel>(realm, realm).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
MessageChannel::MessageChannel(JS::Realm& realm)
|
||||
|
|
|
@ -11,7 +11,7 @@ namespace Web::HTML {
|
|||
|
||||
MessageEvent* MessageEvent::create(JS::Realm& realm, DeprecatedFlyString const& event_name, MessageEventInit const& event_init)
|
||||
{
|
||||
return realm.heap().allocate<MessageEvent>(realm, realm, event_name, event_init);
|
||||
return realm.heap().allocate<MessageEvent>(realm, realm, event_name, event_init).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
MessageEvent* MessageEvent::construct_impl(JS::Realm& realm, DeprecatedFlyString const& event_name, MessageEventInit const& event_init)
|
||||
|
|
|
@ -16,7 +16,7 @@ namespace Web::HTML {
|
|||
|
||||
JS::NonnullGCPtr<MessagePort> MessagePort::create(JS::Realm& realm)
|
||||
{
|
||||
return realm.heap().allocate<MessagePort>(realm, realm);
|
||||
return realm.heap().allocate<MessagePort>(realm, realm).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
MessagePort::MessagePort(JS::Realm& realm)
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace Web::HTML {
|
|||
|
||||
JS::NonnullGCPtr<Navigator> Navigator::create(JS::Realm& realm)
|
||||
{
|
||||
return realm.heap().allocate<Navigator>(realm, realm);
|
||||
return realm.heap().allocate<Navigator>(realm, realm).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
Navigator::Navigator(JS::Realm& realm)
|
||||
|
|
|
@ -11,7 +11,7 @@ namespace Web::HTML {
|
|||
|
||||
PageTransitionEvent* PageTransitionEvent::create(JS::Realm& realm, DeprecatedFlyString const& event_name, PageTransitionEventInit const& event_init)
|
||||
{
|
||||
return realm.heap().allocate<PageTransitionEvent>(realm, realm, event_name, event_init);
|
||||
return realm.heap().allocate<PageTransitionEvent>(realm, realm, event_name, event_init).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
PageTransitionEvent* PageTransitionEvent::construct_impl(JS::Realm& realm, DeprecatedFlyString const& event_name, PageTransitionEventInit const& event_init)
|
||||
|
|
|
@ -462,13 +462,13 @@ void HTMLParser::handle_initial(HTMLToken& token)
|
|||
}
|
||||
|
||||
if (token.is_comment()) {
|
||||
auto comment = realm().heap().allocate<DOM::Comment>(realm(), document(), token.comment());
|
||||
auto comment = realm().heap().allocate<DOM::Comment>(realm(), document(), token.comment()).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
MUST(document().append_child(*comment));
|
||||
return;
|
||||
}
|
||||
|
||||
if (token.is_doctype()) {
|
||||
auto doctype = realm().heap().allocate<DOM::DocumentType>(realm(), document());
|
||||
auto doctype = realm().heap().allocate<DOM::DocumentType>(realm(), document()).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
doctype->set_name(token.doctype_data().name);
|
||||
doctype->set_public_id(token.doctype_data().public_identifier);
|
||||
doctype->set_system_id(token.doctype_data().system_identifier);
|
||||
|
@ -497,7 +497,7 @@ void HTMLParser::handle_before_html(HTMLToken& token)
|
|||
// -> A comment token
|
||||
if (token.is_comment()) {
|
||||
// Insert a comment as the last child of the Document object.
|
||||
auto comment = realm().heap().allocate<DOM::Comment>(realm(), document(), token.comment());
|
||||
auto comment = realm().heap().allocate<DOM::Comment>(realm(), document(), token.comment()).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
MUST(document().append_child(*comment));
|
||||
return;
|
||||
}
|
||||
|
@ -759,7 +759,7 @@ AnythingElse:
|
|||
void HTMLParser::insert_comment(HTMLToken& token)
|
||||
{
|
||||
auto adjusted_insertion_location = find_appropriate_place_for_inserting_node();
|
||||
adjusted_insertion_location.parent->insert_before(realm().heap().allocate<DOM::Comment>(realm(), document(), token.comment()), adjusted_insertion_location.insert_before_sibling);
|
||||
adjusted_insertion_location.parent->insert_before(realm().heap().allocate<DOM::Comment>(realm(), document(), token.comment()).release_allocated_value_but_fixme_should_propagate_errors(), adjusted_insertion_location.insert_before_sibling);
|
||||
}
|
||||
|
||||
void HTMLParser::handle_in_head(HTMLToken& token)
|
||||
|
@ -945,7 +945,7 @@ DOM::Text* HTMLParser::find_character_insertion_node()
|
|||
return nullptr;
|
||||
if (adjusted_insertion_location.parent->last_child() && adjusted_insertion_location.parent->last_child()->is_text())
|
||||
return verify_cast<DOM::Text>(adjusted_insertion_location.parent->last_child());
|
||||
auto new_text_node = realm().heap().allocate<DOM::Text>(realm(), document(), "");
|
||||
auto new_text_node = realm().heap().allocate<DOM::Text>(realm(), document(), "").release_allocated_value_but_fixme_should_propagate_errors();
|
||||
MUST(adjusted_insertion_location.parent->append_child(*new_text_node));
|
||||
return new_text_node;
|
||||
}
|
||||
|
@ -1071,7 +1071,7 @@ void HTMLParser::handle_after_body(HTMLToken& token)
|
|||
|
||||
if (token.is_comment()) {
|
||||
auto& insertion_location = m_stack_of_open_elements.first();
|
||||
MUST(insertion_location.append_child(realm().heap().allocate<DOM::Comment>(realm(), document(), token.comment())));
|
||||
MUST(insertion_location.append_child(realm().heap().allocate<DOM::Comment>(realm(), document(), token.comment()).release_allocated_value_but_fixme_should_propagate_errors()));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1107,7 +1107,7 @@ void HTMLParser::handle_after_body(HTMLToken& token)
|
|||
void HTMLParser::handle_after_after_body(HTMLToken& token)
|
||||
{
|
||||
if (token.is_comment()) {
|
||||
auto comment = realm().heap().allocate<DOM::Comment>(realm(), document(), token.comment());
|
||||
auto comment = realm().heap().allocate<DOM::Comment>(realm(), document(), token.comment()).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
MUST(document().append_child(*comment));
|
||||
return;
|
||||
}
|
||||
|
@ -3181,7 +3181,7 @@ void HTMLParser::handle_after_frameset(HTMLToken& token)
|
|||
void HTMLParser::handle_after_after_frameset(HTMLToken& token)
|
||||
{
|
||||
if (token.is_comment()) {
|
||||
auto comment = document().heap().allocate<DOM::Comment>(document().realm(), document(), token.comment());
|
||||
auto comment = document().heap().allocate<DOM::Comment>(document().realm(), document(), token.comment()).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
MUST(document().append_child(comment));
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Web::HTML {
|
|||
|
||||
JS::NonnullGCPtr<Path2D> Path2D::construct_impl(JS::Realm& realm, Optional<Variant<JS::Handle<Path2D>, DeprecatedString>> const& path)
|
||||
{
|
||||
return realm.heap().allocate<Path2D>(realm, realm, path);
|
||||
return realm.heap().allocate<Path2D>(realm, realm, path).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/canvas.html#dom-path2d
|
||||
|
|
|
@ -11,7 +11,7 @@ namespace Web::HTML {
|
|||
|
||||
PromiseRejectionEvent* PromiseRejectionEvent::create(JS::Realm& realm, DeprecatedFlyString const& event_name, PromiseRejectionEventInit const& event_init)
|
||||
{
|
||||
return realm.heap().allocate<PromiseRejectionEvent>(realm, realm, event_name, event_init);
|
||||
return realm.heap().allocate<PromiseRejectionEvent>(realm, realm, event_name, event_init).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
PromiseRejectionEvent* PromiseRejectionEvent::construct_impl(JS::Realm& realm, DeprecatedFlyString const& event_name, PromiseRejectionEventInit const& event_init)
|
||||
|
|
|
@ -38,7 +38,7 @@ JS::GCPtr<JavaScriptModuleScript> JavaScriptModuleScript::create(DeprecatedStrin
|
|||
auto& realm = settings_object.realm();
|
||||
|
||||
// 2. Let script be a new module script that this algorithm will subsequently initialize.
|
||||
auto script = realm.heap().allocate<JavaScriptModuleScript>(realm, move(base_url), filename, settings_object);
|
||||
auto script = realm.heap().allocate<JavaScriptModuleScript>(realm, move(base_url), filename, settings_object).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
|
||||
// 3. Set script's settings object to settings.
|
||||
// NOTE: This was already done when constructing.
|
||||
|
|
|
@ -38,7 +38,7 @@ void WindowEnvironmentSettingsObject::setup(AK::URL const& creation_url, Nonnull
|
|||
|
||||
// 3. Let settings object be a new environment settings object whose algorithms are defined as follows:
|
||||
// NOTE: See the functions defined for this class.
|
||||
auto settings_object = realm->heap().allocate<WindowEnvironmentSettingsObject>(*realm, window, move(execution_context));
|
||||
auto settings_object = realm->heap().allocate<WindowEnvironmentSettingsObject>(*realm, window, move(execution_context)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
|
||||
// 4. If reservedEnvironment is non-null, then:
|
||||
if (reserved_environment.has_value()) {
|
||||
|
@ -71,7 +71,7 @@ void WindowEnvironmentSettingsObject::setup(AK::URL const& creation_url, Nonnull
|
|||
|
||||
// 7. Set realm's [[HostDefined]] field to settings object.
|
||||
// Non-Standard: We store the ESO next to the web intrinsics in a custom HostDefined object
|
||||
auto intrinsics = realm->heap().allocate<Bindings::Intrinsics>(*realm, *realm);
|
||||
auto intrinsics = realm->heap().allocate<Bindings::Intrinsics>(*realm, *realm).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
auto host_defined = make<Bindings::HostDefined>(settings_object, intrinsics);
|
||||
realm->set_host_defined(move(host_defined));
|
||||
|
||||
|
|
|
@ -27,10 +27,10 @@ public:
|
|||
{
|
||||
auto* realm = execution_context->realm;
|
||||
VERIFY(realm);
|
||||
auto settings_object = realm->heap().allocate<WorkerEnvironmentSettingsObject>(*realm, move(execution_context));
|
||||
auto settings_object = realm->heap().allocate<WorkerEnvironmentSettingsObject>(*realm, move(execution_context)).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
settings_object->target_browsing_context = nullptr;
|
||||
|
||||
auto intrinsics = realm->heap().allocate<Bindings::Intrinsics>(*realm, *realm);
|
||||
auto intrinsics = realm->heap().allocate<Bindings::Intrinsics>(*realm, *realm).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
auto host_defined = make<Bindings::HostDefined>(settings_object, intrinsics);
|
||||
realm->set_host_defined(move(host_defined));
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace Web::HTML {
|
|||
|
||||
JS::NonnullGCPtr<Storage> Storage::create(JS::Realm& realm)
|
||||
{
|
||||
return realm.heap().allocate<Storage>(realm, realm);
|
||||
return realm.heap().allocate<Storage>(realm, realm).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
Storage::Storage(JS::Realm& realm)
|
||||
|
|
|
@ -11,7 +11,7 @@ namespace Web::HTML {
|
|||
|
||||
SubmitEvent* SubmitEvent::create(JS::Realm& realm, DeprecatedFlyString const& event_name, SubmitEventInit const& event_init)
|
||||
{
|
||||
return realm.heap().allocate<SubmitEvent>(realm, realm, event_name, event_init);
|
||||
return realm.heap().allocate<SubmitEvent>(realm, realm, event_name, event_init).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
SubmitEvent* SubmitEvent::construct_impl(JS::Realm& realm, DeprecatedFlyString const& event_name, SubmitEventInit const& event_init)
|
||||
|
|
|
@ -11,7 +11,7 @@ namespace Web::HTML {
|
|||
|
||||
JS::NonnullGCPtr<TextMetrics> TextMetrics::create(JS::Realm& realm)
|
||||
{
|
||||
return realm.heap().allocate<TextMetrics>(realm, realm);
|
||||
return realm.heap().allocate<TextMetrics>(realm, realm).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
TextMetrics::TextMetrics(JS::Realm& realm)
|
||||
|
|
|
@ -88,7 +88,7 @@ private:
|
|||
|
||||
JS::NonnullGCPtr<Window> Window::create(JS::Realm& realm)
|
||||
{
|
||||
return realm.heap().allocate<Window>(realm, realm);
|
||||
return realm.heap().allocate<Window>(realm, realm).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
Window::Window(JS::Realm& realm)
|
||||
|
@ -115,14 +115,14 @@ Window::~Window() = default;
|
|||
HighResolutionTime::Performance& Window::performance()
|
||||
{
|
||||
if (!m_performance)
|
||||
m_performance = heap().allocate<HighResolutionTime::Performance>(realm(), *this);
|
||||
m_performance = heap().allocate<HighResolutionTime::Performance>(realm(), *this).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
return *m_performance;
|
||||
}
|
||||
|
||||
CSS::Screen& Window::screen()
|
||||
{
|
||||
if (!m_screen)
|
||||
m_screen = heap().allocate<CSS::Screen>(realm(), *this);
|
||||
m_screen = heap().allocate<CSS::Screen>(realm(), *this).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
return *m_screen;
|
||||
}
|
||||
|
||||
|
@ -1133,7 +1133,7 @@ void Window::initialize_web_interfaces(Badge<WindowEnvironmentSettingsObject>)
|
|||
define_native_accessor(realm, "outerWidth", outer_width_getter, {}, attr);
|
||||
define_native_accessor(realm, "outerHeight", outer_height_getter, {}, attr);
|
||||
|
||||
define_direct_property("CSS", heap().allocate<Bindings::CSSNamespace>(realm, realm), 0);
|
||||
define_direct_property("CSS", heap().allocate<Bindings::CSSNamespace>(realm, realm).release_allocated_value_but_fixme_should_propagate_errors(), 0);
|
||||
|
||||
define_native_accessor(realm, "localStorage", local_storage_getter, {}, attr);
|
||||
define_native_accessor(realm, "sessionStorage", session_storage_getter, {}, attr);
|
||||
|
@ -1143,9 +1143,9 @@ void Window::initialize_web_interfaces(Badge<WindowEnvironmentSettingsObject>)
|
|||
// Legacy
|
||||
define_native_accessor(realm, "event", event_getter, event_setter, JS::Attribute::Enumerable);
|
||||
|
||||
m_location = heap().allocate<HTML::Location>(realm, realm);
|
||||
m_location = heap().allocate<HTML::Location>(realm, realm).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
|
||||
m_navigator = heap().allocate<HTML::Navigator>(realm, realm);
|
||||
m_navigator = heap().allocate<HTML::Navigator>(realm, realm).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
define_direct_property("navigator", m_navigator, JS::Attribute::Enumerable | JS::Attribute::Configurable);
|
||||
define_direct_property("clientInformation", m_navigator, JS::Attribute::Enumerable | JS::Attribute::Configurable);
|
||||
|
||||
|
@ -1153,7 +1153,7 @@ void Window::initialize_web_interfaces(Badge<WindowEnvironmentSettingsObject>)
|
|||
define_native_accessor(realm, "location", location_getter, location_setter, JS::Attribute::Enumerable);
|
||||
|
||||
// WebAssembly "namespace"
|
||||
define_direct_property("WebAssembly", heap().allocate<Bindings::WebAssemblyObject>(realm, realm), JS::Attribute::Enumerable | JS::Attribute::Configurable);
|
||||
define_direct_property("WebAssembly", heap().allocate<Bindings::WebAssemblyObject>(realm, realm).release_allocated_value_but_fixme_should_propagate_errors(), JS::Attribute::Enumerable | JS::Attribute::Configurable);
|
||||
|
||||
// HTML::GlobalEventHandlers and HTML::WindowEventHandlers
|
||||
#define __ENUMERATE(attribute, event_name) \
|
||||
|
|
|
@ -77,7 +77,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<Worker>> Worker::create(DeprecatedFlyString
|
|||
// 5. Let worker URL be the resulting URL record.
|
||||
|
||||
// 6. Let worker be a new Worker object.
|
||||
auto worker = document.heap().allocate<Worker>(document.realm(), script_url, options, document);
|
||||
auto worker = MUST_OR_THROW_OOM(document.heap().allocate<Worker>(document.realm(), script_url, options, document));
|
||||
|
||||
// 7. Let outside port be a new MessagePort in outside settings's Realm.
|
||||
auto outside_port = MessagePort::create(outside_settings.realm());
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace Web::HTML {
|
|||
|
||||
JS::NonnullGCPtr<WorkerNavigator> WorkerNavigator::create(WorkerGlobalScope& global_scope)
|
||||
{
|
||||
return global_scope.heap().allocate<WorkerNavigator>(global_scope.realm(), global_scope);
|
||||
return global_scope.heap().allocate<WorkerNavigator>(global_scope.realm(), global_scope).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
WorkerNavigator::WorkerNavigator(WorkerGlobalScope& global_scope)
|
||||
|
|
|
@ -40,7 +40,7 @@ void Performance::visit_edges(Cell::Visitor& visitor)
|
|||
JS::GCPtr<NavigationTiming::PerformanceTiming> Performance::timing()
|
||||
{
|
||||
if (!m_timing)
|
||||
m_timing = heap().allocate<NavigationTiming::PerformanceTiming>(realm(), *m_window);
|
||||
m_timing = heap().allocate<NavigationTiming::PerformanceTiming>(realm(), *m_window).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
return m_timing;
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ JS::NonnullGCPtr<IntersectionObserver> IntersectionObserver::construct_impl(JS::
|
|||
(void)callback;
|
||||
(void)options;
|
||||
|
||||
return realm.heap().allocate<IntersectionObserver>(realm, realm);
|
||||
return realm.heap().allocate<IntersectionObserver>(realm, realm).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
IntersectionObserver::IntersectionObserver(JS::Realm& realm)
|
||||
|
|
|
@ -171,7 +171,7 @@ ErrorOr<void> TreeBuilder::create_pseudo_element_if_needed(DOM::Element& element
|
|||
pseudo_element_node->set_generated(true);
|
||||
// FIXME: Handle images, and multiple values
|
||||
if (pseudo_element_content.type == CSS::ContentData::Type::String) {
|
||||
auto text = document.heap().allocate<DOM::Text>(document.realm(), document, pseudo_element_content.data);
|
||||
auto text = document.heap().allocate<DOM::Text>(document.realm(), document, pseudo_element_content.data).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
auto text_node = document.heap().allocate_without_realm<Layout::TextNode>(document, *text);
|
||||
text_node->set_generated(true);
|
||||
push_parent(verify_cast<NodeWithStyle>(*pseudo_element_node));
|
||||
|
@ -302,7 +302,7 @@ ErrorOr<void> TreeBuilder::create_layout_tree(DOM::Node& dom_node, TreeBuilder::
|
|||
auto placeholder_style = TRY(style_computer.compute_style(input_element, CSS::Selector::PseudoElement::Placeholder));
|
||||
auto placeholder = DOM::Element::create_layout_node_for_display_type(document, placeholder_style->display(), placeholder_style, nullptr);
|
||||
|
||||
auto text = document.heap().allocate<DOM::Text>(document.realm(), document, *placeholder_value);
|
||||
auto text = document.heap().allocate<DOM::Text>(document.realm(), document, *placeholder_value).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
auto text_node = document.heap().allocate_without_realm<Layout::TextNode>(document, *text);
|
||||
text_node->set_generated(true);
|
||||
|
||||
|
|
|
@ -142,7 +142,7 @@ static bool build_image_document(DOM::Document& document, ByteBuffer const& data
|
|||
MUST(head_element->append_child(title_element));
|
||||
|
||||
auto basename = LexicalPath::basename(document.url().path());
|
||||
auto title_text = document.heap().allocate<DOM::Text>(document.realm(), document, DeprecatedString::formatted("{} [{}x{}]", basename, bitmap->width(), bitmap->height()));
|
||||
auto title_text = document.heap().allocate<DOM::Text>(document.realm(), document, DeprecatedString::formatted("{} [{}x{}]", basename, bitmap->width(), bitmap->height())).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
MUST(title_element->append_child(*title_text));
|
||||
|
||||
auto body_element = document.create_element("body").release_value();
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Web::RequestIdleCallback {
|
|||
|
||||
JS::NonnullGCPtr<IdleDeadline> IdleDeadline::create(JS::Realm& realm, bool did_timeout)
|
||||
{
|
||||
return realm.heap().allocate<IdleDeadline>(realm, realm, did_timeout);
|
||||
return realm.heap().allocate<IdleDeadline>(realm, realm, did_timeout).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
IdleDeadline::IdleDeadline(JS::Realm& realm, bool did_timeout)
|
||||
|
|
|
@ -15,7 +15,7 @@ JS::NonnullGCPtr<ResizeObserver> ResizeObserver::construct_impl(JS::Realm& realm
|
|||
{
|
||||
// FIXME: Implement
|
||||
(void)callback;
|
||||
return realm.heap().allocate<ResizeObserver>(realm, realm);
|
||||
return realm.heap().allocate<ResizeObserver>(realm, realm).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
ResizeObserver::ResizeObserver(JS::Realm& realm)
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue