mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 16:27:35 +00:00
LibWeb: Return JS::NonnullGCPtr<StaticRange> instead of StaticRange*
This commit is contained in:
parent
6516329867
commit
fb3294863e
2 changed files with 3 additions and 3 deletions
|
@ -22,7 +22,7 @@ StaticRange::StaticRange(Node& start_container, u32 start_offset, Node& end_cont
|
|||
StaticRange::~StaticRange() = default;
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-staticrange-staticrange
|
||||
WebIDL::ExceptionOr<StaticRange*> StaticRange::construct_impl(JS::Realm& realm, StaticRangeInit& init)
|
||||
WebIDL::ExceptionOr<JS::NonnullGCPtr<StaticRange>> StaticRange::construct_impl(JS::Realm& realm, StaticRangeInit& init)
|
||||
{
|
||||
// 1. If init["startContainer"] or init["endContainer"] is a DocumentType or Attr node, then throw an "InvalidNodeTypeError" DOMException.
|
||||
if (is<DocumentType>(*init.start_container) || is<Attr>(*init.start_container))
|
||||
|
@ -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 MUST_OR_THROW_OOM(realm.heap().allocate<StaticRange>(realm, *init.start_container, init.start_offset, *init.end_container, init.end_offset)).ptr();
|
||||
return MUST_OR_THROW_OOM(realm.heap().allocate<StaticRange>(realm, *init.start_container, init.start_offset, *init.end_container, init.end_offset));
|
||||
}
|
||||
|
||||
JS::ThrowCompletionOr<void> StaticRange::initialize(JS::Realm& realm)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue