mirror of
https://github.com/RGBCube/serenity
synced 2025-07-24 12:17:34 +00:00
LibWeb: Make factory method of DOM::AccessibilityTreeNode fallible
This commit is contained in:
parent
2c8a689390
commit
1e03aa0ece
4 changed files with 6 additions and 6 deletions
|
@ -13,9 +13,9 @@
|
|||
|
||||
namespace Web::DOM {
|
||||
|
||||
JS::NonnullGCPtr<AccessibilityTreeNode> AccessibilityTreeNode::create(Document* document, DOM::Node const* value)
|
||||
WebIDL::ExceptionOr<JS::NonnullGCPtr<AccessibilityTreeNode>> AccessibilityTreeNode::create(Document* document, DOM::Node const* value)
|
||||
{
|
||||
return *document->heap().allocate<AccessibilityTreeNode>(document->realm(), value).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
return MUST_OR_THROW_OOM(document->heap().allocate<AccessibilityTreeNode>(document->realm(), value));
|
||||
}
|
||||
|
||||
AccessibilityTreeNode::AccessibilityTreeNode(JS::GCPtr<DOM::Node> value)
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace Web::DOM {
|
|||
class AccessibilityTreeNode final : public JS::Cell {
|
||||
JS_CELL(AccessibilityTreeNode, JS::Cell)
|
||||
public:
|
||||
static JS::NonnullGCPtr<AccessibilityTreeNode> create(Document*, DOM::Node const*);
|
||||
static WebIDL::ExceptionOr<JS::NonnullGCPtr<AccessibilityTreeNode>> create(Document*, DOM::Node const*);
|
||||
virtual ~AccessibilityTreeNode() override = default;
|
||||
|
||||
JS::GCPtr<DOM::Node> value() const { return m_value; }
|
||||
|
|
|
@ -2350,7 +2350,7 @@ JS::NonnullGCPtr<DOM::Document> Document::appropriate_template_contents_owner_do
|
|||
DeprecatedString Document::dump_accessibility_tree_as_json()
|
||||
{
|
||||
StringBuilder builder;
|
||||
auto accessibility_tree = AccessibilityTreeNode::create(this, nullptr);
|
||||
auto accessibility_tree = AccessibilityTreeNode::create(this, nullptr).release_value_but_fixme_should_propagate_errors();
|
||||
build_accessibility_tree(*&accessibility_tree);
|
||||
auto json = MUST(JsonObjectSerializer<>::try_create(builder));
|
||||
|
||||
|
|
|
@ -1565,7 +1565,7 @@ void Node::build_accessibility_tree(AccessibilityTreeNode& parent) const
|
|||
return;
|
||||
|
||||
if (element->include_in_accessibility_tree()) {
|
||||
auto current_node = AccessibilityTreeNode::create(const_cast<Document*>(&this->document()), this);
|
||||
auto current_node = AccessibilityTreeNode::create(const_cast<Document*>(&this->document()), this).release_value_but_fixme_should_propagate_errors();
|
||||
parent.append_child(current_node);
|
||||
if (has_child_nodes()) {
|
||||
for_each_child([¤t_node](DOM::Node& child) {
|
||||
|
@ -1578,7 +1578,7 @@ void Node::build_accessibility_tree(AccessibilityTreeNode& parent) const
|
|||
});
|
||||
}
|
||||
} else if (is_text()) {
|
||||
parent.append_child(AccessibilityTreeNode::create(const_cast<Document*>(&this->document()), this));
|
||||
parent.append_child(AccessibilityTreeNode::create(const_cast<Document*>(&this->document()), this).release_value_but_fixme_should_propagate_errors());
|
||||
if (has_child_nodes()) {
|
||||
for_each_child([&parent](DOM::Node& child) {
|
||||
child.build_accessibility_tree(parent);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue