diff --git a/Userland/Libraries/LibJS/Runtime/AsyncFromSyncIteratorPrototype.cpp b/Userland/Libraries/LibJS/Runtime/AsyncFromSyncIteratorPrototype.cpp index aed9489476d..38c4a6d4abf 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 { // 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 237eb78c1e5..822410a95de 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 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 921f40aa2f5..97b813e59eb 100644 --- a/Userland/Libraries/LibJS/Runtime/IteratorOperations.h +++ b/Userland/Libraries/LibJS/Runtime/IteratorOperations.h @@ -29,7 +29,7 @@ ThrowCompletionOr iterator_complete(VM&, Object& iterator_result); ThrowCompletionOr 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 create_iterator_result_object(VM&, Value, bool done); ThrowCompletionOr> iterable_to_list(VM&, Value iterable, Optional method = {}); using IteratorValueCallback = Function(Value)>; diff --git a/Userland/Libraries/LibWeb/XHR/FormDataIterator.cpp b/Userland/Libraries/LibWeb/XHR/FormDataIterator.cpp index 6980f445e18..4cea9cdcbdb 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(); } }