summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2023-04-15 16:26:42 +0200
committerLinus Groh <mail@linusgroh.de>2023-04-15 16:26:42 +0200
commitd4eaaf905c54078cfb37f8939bf5ddb98a6bcaac (patch)
treed3096d6d949b03ea1fc72aceadf8043212e1712d /Userland
parentaff1ec6014019b96992942a0610011a0c586033c (diff)
downloadserenity-d4eaaf905c54078cfb37f8939bf5ddb98a6bcaac.zip
LibJS: Port create_iterator_result_object() to NonnullGCPtr
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibJS/Runtime/AsyncFromSyncIteratorPrototype.cpp4
-rw-r--r--Userland/Libraries/LibJS/Runtime/IteratorOperations.cpp2
-rw-r--r--Userland/Libraries/LibJS/Runtime/IteratorOperations.h2
-rw-r--r--Userland/Libraries/LibWeb/XHR/FormDataIterator.cpp2
4 files changed, 5 insertions, 5 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/AsyncFromSyncIteratorPrototype.cpp b/Userland/Libraries/LibJS/Runtime/AsyncFromSyncIteratorPrototype.cpp
index aed9489476..38c4a6d4ab 100644
--- a/Userland/Libraries/LibJS/Runtime/AsyncFromSyncIteratorPrototype.cpp
+++ b/Userland/Libraries/LibJS/Runtime/AsyncFromSyncIteratorPrototype.cpp
@@ -53,7 +53,7 @@ static Object* async_from_sync_iterator_continuation(VM& vm, Object& result, Pro
// 8. Let unwrap be a new Abstract Closure with parameters (value) that captures done and performs the following steps when called:
auto unwrap = [done](VM& vm) -> ThrowCompletionOr<Value> {
// a. Return CreateIterResultObject(value, done).
- return create_iterator_result_object(vm, vm.argument(0), done);
+ return create_iterator_result_object(vm, vm.argument(0), done).ptr();
};
// 9. Let onFulfilled be CreateBuiltinFunction(unwrap, 1, "", « »).
@@ -117,7 +117,7 @@ JS_DEFINE_NATIVE_FUNCTION(AsyncFromSyncIteratorPrototype::return_)
// 7. If return is undefined, then
if (return_method == nullptr) {
// a. Let iterResult be CreateIterResultObject(value, true).
- auto* iter_result = create_iterator_result_object(vm, vm.argument(0), true);
+ auto iter_result = create_iterator_result_object(vm, vm.argument(0), true);
// b. Perform ! Call(promiseCapability.[[Resolve]], undefined, « iterResult »).
MUST(call(vm, *promise_capability->resolve(), js_undefined(), iter_result));
diff --git a/Userland/Libraries/LibJS/Runtime/IteratorOperations.cpp b/Userland/Libraries/LibJS/Runtime/IteratorOperations.cpp
index 237eb78c1e..822410a95d 100644
--- a/Userland/Libraries/LibJS/Runtime/IteratorOperations.cpp
+++ b/Userland/Libraries/LibJS/Runtime/IteratorOperations.cpp
@@ -184,7 +184,7 @@ Completion async_iterator_close(VM& vm, Iterator const& iterator_record, Complet
}
// 7.4.10 CreateIterResultObject ( value, done ), https://tc39.es/ecma262/#sec-createiterresultobject
-Object* create_iterator_result_object(VM& vm, Value value, bool done)
+NonnullGCPtr<Object> create_iterator_result_object(VM& vm, Value value, bool done)
{
auto& realm = *vm.current_realm();
diff --git a/Userland/Libraries/LibJS/Runtime/IteratorOperations.h b/Userland/Libraries/LibJS/Runtime/IteratorOperations.h
index 921f40aa2f..97b813e59e 100644
--- a/Userland/Libraries/LibJS/Runtime/IteratorOperations.h
+++ b/Userland/Libraries/LibJS/Runtime/IteratorOperations.h
@@ -29,7 +29,7 @@ ThrowCompletionOr<bool> iterator_complete(VM&, Object& iterator_result);
ThrowCompletionOr<Value> iterator_value(VM&, Object& iterator_result);
Completion iterator_close(VM&, Iterator const&, Completion);
Completion async_iterator_close(VM&, Iterator const&, Completion);
-Object* create_iterator_result_object(VM&, Value, bool done);
+NonnullGCPtr<Object> create_iterator_result_object(VM&, Value, bool done);
ThrowCompletionOr<MarkedVector<Value>> iterable_to_list(VM&, Value iterable, Optional<Value> method = {});
using IteratorValueCallback = Function<Optional<Completion>(Value)>;
diff --git a/Userland/Libraries/LibWeb/XHR/FormDataIterator.cpp b/Userland/Libraries/LibWeb/XHR/FormDataIterator.cpp
index 6980f445e1..4cea9cdcbd 100644
--- a/Userland/Libraries/LibWeb/XHR/FormDataIterator.cpp
+++ b/Userland/Libraries/LibWeb/XHR/FormDataIterator.cpp
@@ -73,7 +73,7 @@ JS::Object* FormDataIterator::next()
if (m_iterator_kind == JS::Object::PropertyKind::Value)
return create_iterator_result_object(vm, entry_value, false);
- return create_iterator_result_object(vm, JS::Array::create_from(realm(), { JS::PrimitiveString::create(vm, entry.name), entry_value }), false);
+ return create_iterator_result_object(vm, JS::Array::create_from(realm(), { JS::PrimitiveString::create(vm, entry.name), entry_value }), false).ptr();
}
}