summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2022-12-14 17:40:33 +0000
committerTim Flynn <trflynn89@pm.me>2022-12-15 06:56:37 -0500
commit22089436edec780e03960ecaa74bfc4930126534 (patch)
treef60662c28d36e8fcce4b734e09af396c68ed1aaf
parent2a66fc6cae8ef09e780cd795bf0b1d7f8844f4ec (diff)
downloadserenity-22089436edec780e03960ecaa74bfc4930126534.zip
LibJS: Convert Heap::allocate{,_without_realm}() to NonnullGCPtr
-rw-r--r--Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp6
-rw-r--r--Tests/LibWasm/test-wasm.cpp4
-rw-r--r--Userland/Libraries/LibJS/Bytecode/Op.cpp2
-rw-r--r--Userland/Libraries/LibJS/Contrib/Test262/$262Object.cpp2
-rw-r--r--Userland/Libraries/LibJS/Heap/Heap.h8
-rw-r--r--Userland/Libraries/LibJS/Module.cpp2
-rw-r--r--Userland/Libraries/LibJS/Runtime/AbstractOperations.cpp4
-rw-r--r--Userland/Libraries/LibJS/Runtime/AbstractOperations.h2
-rw-r--r--Userland/Libraries/LibJS/Runtime/Accessor.h2
-rw-r--r--Userland/Libraries/LibJS/Runtime/AggregateError.cpp2
-rw-r--r--Userland/Libraries/LibJS/Runtime/Array.cpp4
-rw-r--r--Userland/Libraries/LibJS/Runtime/ArrayBuffer.cpp6
-rw-r--r--Userland/Libraries/LibJS/Runtime/ArrayIterator.cpp2
-rw-r--r--Userland/Libraries/LibJS/Runtime/AsyncFromSyncIterator.cpp2
-rw-r--r--Userland/Libraries/LibJS/Runtime/BigInt.cpp2
-rw-r--r--Userland/Libraries/LibJS/Runtime/BigIntObject.cpp2
-rw-r--r--Userland/Libraries/LibJS/Runtime/BooleanObject.cpp2
-rw-r--r--Userland/Libraries/LibJS/Runtime/BoundFunction.cpp4
-rw-r--r--Userland/Libraries/LibJS/Runtime/DataView.cpp2
-rw-r--r--Userland/Libraries/LibJS/Runtime/Date.cpp2
-rw-r--r--Userland/Libraries/LibJS/Runtime/ECMAScriptFunctionObject.cpp4
-rw-r--r--Userland/Libraries/LibJS/Runtime/Error.cpp38
-rw-r--r--Userland/Libraries/LibJS/Runtime/GeneratorObject.cpp2
-rw-r--r--Userland/Libraries/LibJS/Runtime/Intl/CollatorCompareFunction.cpp2
-rw-r--r--Userland/Libraries/LibJS/Runtime/Intl/DateTimeFormatFunction.cpp2
-rw-r--r--Userland/Libraries/LibJS/Runtime/Intl/Locale.cpp2
-rw-r--r--Userland/Libraries/LibJS/Runtime/Intl/NumberFormatFunction.cpp2
-rw-r--r--Userland/Libraries/LibJS/Runtime/Intl/SegmentIterator.cpp2
-rw-r--r--Userland/Libraries/LibJS/Runtime/Intl/Segments.cpp2
-rw-r--r--Userland/Libraries/LibJS/Runtime/Intrinsics.cpp4
-rw-r--r--Userland/Libraries/LibJS/Runtime/Map.cpp2
-rw-r--r--Userland/Libraries/LibJS/Runtime/MapIterator.cpp2
-rw-r--r--Userland/Libraries/LibJS/Runtime/NativeFunction.cpp6
-rw-r--r--Userland/Libraries/LibJS/Runtime/NumberObject.cpp2
-rw-r--r--Userland/Libraries/LibJS/Runtime/Object.cpp6
-rw-r--r--Userland/Libraries/LibJS/Runtime/PrimitiveString.cpp6
-rw-r--r--Userland/Libraries/LibJS/Runtime/Promise.cpp4
-rw-r--r--Userland/Libraries/LibJS/Runtime/PromiseCapability.cpp2
-rw-r--r--Userland/Libraries/LibJS/Runtime/PromiseConstructor.cpp4
-rw-r--r--Userland/Libraries/LibJS/Runtime/PromiseReaction.cpp2
-rw-r--r--Userland/Libraries/LibJS/Runtime/PromiseResolvingElementFunctions.cpp8
-rw-r--r--Userland/Libraries/LibJS/Runtime/PromiseResolvingFunction.cpp2
-rw-r--r--Userland/Libraries/LibJS/Runtime/ProxyObject.cpp2
-rw-r--r--Userland/Libraries/LibJS/Runtime/Realm.cpp4
-rw-r--r--Userland/Libraries/LibJS/Runtime/RegExpObject.cpp4
-rw-r--r--Userland/Libraries/LibJS/Runtime/RegExpStringIterator.cpp2
-rw-r--r--Userland/Libraries/LibJS/Runtime/Set.cpp2
-rw-r--r--Userland/Libraries/LibJS/Runtime/SetIterator.cpp2
-rw-r--r--Userland/Libraries/LibJS/Runtime/Shape.cpp14
-rw-r--r--Userland/Libraries/LibJS/Runtime/StringIterator.cpp2
-rw-r--r--Userland/Libraries/LibJS/Runtime/StringObject.cpp2
-rw-r--r--Userland/Libraries/LibJS/Runtime/Symbol.cpp2
-rw-r--r--Userland/Libraries/LibJS/Runtime/SymbolObject.cpp2
-rw-r--r--Userland/Libraries/LibJS/Runtime/TypedArray.cpp4
-rw-r--r--Userland/Libraries/LibJS/Runtime/WeakMap.cpp2
-rw-r--r--Userland/Libraries/LibJS/Runtime/WeakRef.cpp4
-rw-r--r--Userland/Libraries/LibJS/Runtime/WeakSet.cpp2
-rw-r--r--Userland/Libraries/LibJS/Runtime/WrappedFunction.cpp4
-rw-r--r--Userland/Libraries/LibJS/Script.cpp2
-rw-r--r--Userland/Libraries/LibJS/SourceTextModule.cpp6
-rw-r--r--Userland/Libraries/LibJS/SyntheticModule.cpp4
-rw-r--r--Userland/Libraries/LibWeb/Bindings/Intrinsics.h8
-rw-r--r--Userland/Libraries/LibWeb/Bindings/MainThreadVM.cpp4
-rw-r--r--Userland/Libraries/LibWeb/CSS/CSSRuleList.cpp2
-rw-r--r--Userland/Libraries/LibWeb/CSS/MediaQueryList.cpp2
-rw-r--r--Userland/Libraries/LibWeb/CSS/Screen.cpp4
-rw-r--r--Userland/Libraries/LibWeb/Crypto/Crypto.cpp2
-rw-r--r--Userland/Libraries/LibWeb/Crypto/SubtleCrypto.cpp2
-rw-r--r--Userland/Libraries/LibWeb/DOM/AbortController.cpp2
-rw-r--r--Userland/Libraries/LibWeb/DOM/AbortSignal.cpp2
-rw-r--r--Userland/Libraries/LibWeb/DOM/Attr.cpp2
-rw-r--r--Userland/Libraries/LibWeb/DOM/Comment.cpp2
-rw-r--r--Userland/Libraries/LibWeb/DOM/DOMImplementation.cpp2
-rw-r--r--Userland/Libraries/LibWeb/DOM/Document.cpp10
-rw-r--r--Userland/Libraries/LibWeb/DOM/DocumentFragment.cpp2
-rw-r--r--Userland/Libraries/LibWeb/DOM/DocumentType.cpp2
-rw-r--r--Userland/Libraries/LibWeb/DOM/Element.cpp4
-rw-r--r--Userland/Libraries/LibWeb/DOM/ElementFactory.cpp168
-rw-r--r--Userland/Libraries/LibWeb/DOM/Event.cpp2
-rw-r--r--Userland/Libraries/LibWeb/DOM/EventTarget.cpp12
-rw-r--r--Userland/Libraries/LibWeb/DOM/HTMLCollection.cpp2
-rw-r--r--Userland/Libraries/LibWeb/DOM/IDLEventListener.cpp2
-rw-r--r--Userland/Libraries/LibWeb/DOM/LiveNodeList.cpp2
-rw-r--r--Userland/Libraries/LibWeb/DOM/MutationObserver.cpp6
-rw-r--r--Userland/Libraries/LibWeb/DOM/MutationRecord.cpp2
-rw-r--r--Userland/Libraries/LibWeb/DOM/NamedNodeMap.cpp2
-rw-r--r--Userland/Libraries/LibWeb/DOM/NodeFilter.cpp2
-rw-r--r--Userland/Libraries/LibWeb/DOM/NodeIterator.cpp4
-rw-r--r--Userland/Libraries/LibWeb/DOM/NodeOperations.cpp5
-rw-r--r--Userland/Libraries/LibWeb/DOM/Range.cpp24
-rw-r--r--Userland/Libraries/LibWeb/DOM/StaticNodeList.cpp2
-rw-r--r--Userland/Libraries/LibWeb/DOM/StaticRange.cpp2
-rw-r--r--Userland/Libraries/LibWeb/DOM/Text.cpp4
-rw-r--r--Userland/Libraries/LibWeb/DOM/TreeWalker.cpp4
-rw-r--r--Userland/Libraries/LibWeb/DOMParsing/InnerHTML.cpp2
-rw-r--r--Userland/Libraries/LibWeb/DOMParsing/XMLSerializer.cpp2
-rw-r--r--Userland/Libraries/LibWeb/Encoding/TextDecoder.cpp2
-rw-r--r--Userland/Libraries/LibWeb/Encoding/TextEncoder.cpp2
-rw-r--r--Userland/Libraries/LibWeb/Fetch/Fetching/PendingResponse.cpp4
-rw-r--r--Userland/Libraries/LibWeb/Fetch/Headers.cpp4
-rw-r--r--Userland/Libraries/LibWeb/Fetch/HeadersIterator.cpp2
-rw-r--r--Userland/Libraries/LibWeb/Fetch/Infrastructure/ConnectionTimingInfo.cpp2
-rw-r--r--Userland/Libraries/LibWeb/Fetch/Infrastructure/FetchAlgorithms.cpp2
-rw-r--r--Userland/Libraries/LibWeb/Fetch/Infrastructure/FetchController.cpp2
-rw-r--r--Userland/Libraries/LibWeb/Fetch/Infrastructure/FetchParams.cpp2
-rw-r--r--Userland/Libraries/LibWeb/Fetch/Infrastructure/FetchTimingInfo.cpp2
-rw-r--r--Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Bodies.cpp2
-rw-r--r--Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Headers.cpp2
-rw-r--r--Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Requests.cpp2
-rw-r--r--Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Responses.cpp10
-rw-r--r--Userland/Libraries/LibWeb/Fetch/Request.cpp6
-rw-r--r--Userland/Libraries/LibWeb/Fetch/Response.cpp6
-rw-r--r--Userland/Libraries/LibWeb/FileAPI/Blob.cpp8
-rw-r--r--Userland/Libraries/LibWeb/FileAPI/File.cpp2
-rw-r--r--Userland/Libraries/LibWeb/FileAPI/FileList.cpp2
-rw-r--r--Userland/Libraries/LibWeb/Geometry/DOMPoint.cpp2
-rw-r--r--Userland/Libraries/LibWeb/Geometry/DOMPointReadOnly.cpp2
-rw-r--r--Userland/Libraries/LibWeb/Geometry/DOMRect.cpp2
-rw-r--r--Userland/Libraries/LibWeb/Geometry/DOMRectList.cpp2
-rw-r--r--Userland/Libraries/LibWeb/Geometry/DOMRectReadOnly.cpp2
-rw-r--r--Userland/Libraries/LibWeb/HTML/CanvasGradient.cpp6
-rw-r--r--Userland/Libraries/LibWeb/HTML/CanvasRenderingContext2D.cpp2
-rw-r--r--Userland/Libraries/LibWeb/HTML/DOMParser.cpp2
-rw-r--r--Userland/Libraries/LibWeb/HTML/DOMStringMap.cpp2
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp6
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLOptionsCollection.cpp2
-rw-r--r--Userland/Libraries/LibWeb/HTML/History.cpp2
-rw-r--r--Userland/Libraries/LibWeb/HTML/MessageChannel.cpp2
-rw-r--r--Userland/Libraries/LibWeb/HTML/MessagePort.cpp2
-rw-r--r--Userland/Libraries/LibWeb/HTML/Navigator.cpp2
-rw-r--r--Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.cpp16
-rw-r--r--Userland/Libraries/LibWeb/HTML/Path2D.cpp2
-rw-r--r--Userland/Libraries/LibWeb/HTML/Scripting/ClassicScript.cpp4
-rw-r--r--Userland/Libraries/LibWeb/HTML/Scripting/ModuleScript.cpp2
-rw-r--r--Userland/Libraries/LibWeb/HTML/Scripting/WindowEnvironmentSettingsObject.cpp6
-rw-r--r--Userland/Libraries/LibWeb/HTML/Scripting/WorkerEnvironmentSettingsObject.h6
-rw-r--r--Userland/Libraries/LibWeb/HTML/Storage.cpp2
-rw-r--r--Userland/Libraries/LibWeb/HTML/TextMetrics.cpp2
-rw-r--r--Userland/Libraries/LibWeb/HTML/Timer.cpp2
-rw-r--r--Userland/Libraries/LibWeb/HTML/Window.cpp8
-rw-r--r--Userland/Libraries/LibWeb/HTML/Worker.cpp2
-rw-r--r--Userland/Libraries/LibWeb/HTML/WorkerNavigator.cpp2
-rw-r--r--Userland/Libraries/LibWeb/IntersectionObserver/IntersectionObserver.cpp2
-rw-r--r--Userland/Libraries/LibWeb/Layout/TreeBuilder.cpp6
-rw-r--r--Userland/Libraries/LibWeb/RequestIdleCallback/IdleDeadline.cpp2
-rw-r--r--Userland/Libraries/LibWeb/ResizeObserver/ResizeObserver.cpp2
-rw-r--r--Userland/Libraries/LibWeb/SVG/SVGAnimatedLength.cpp2
-rw-r--r--Userland/Libraries/LibWeb/SVG/SVGLength.cpp2
-rw-r--r--Userland/Libraries/LibWeb/Selection/Selection.cpp2
-rw-r--r--Userland/Libraries/LibWeb/Streams/ReadableStream.cpp4
-rw-r--r--Userland/Libraries/LibWeb/URL/URL.cpp2
-rw-r--r--Userland/Libraries/LibWeb/URL/URLSearchParams.cpp2
-rw-r--r--Userland/Libraries/LibWeb/URL/URLSearchParamsIterator.cpp2
-rw-r--r--Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceConstructor.cpp2
-rw-r--r--Userland/Libraries/LibWeb/WebAssembly/WebAssemblyMemoryConstructor.cpp2
-rw-r--r--Userland/Libraries/LibWeb/WebAssembly/WebAssemblyModuleConstructor.cpp2
-rw-r--r--Userland/Libraries/LibWeb/WebAssembly/WebAssemblyTableConstructor.cpp2
-rw-r--r--Userland/Libraries/LibWeb/WebIDL/DOMException.cpp4
-rw-r--r--Userland/Libraries/LibWeb/WebSockets/WebSocket.cpp2
-rw-r--r--Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp2
-rw-r--r--Userland/Services/WebContent/WebContentConsoleClient.cpp2
161 files changed, 367 insertions, 370 deletions
diff --git a/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp b/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp
index eceaf92654..7ee5ea8ec5 100644
--- a/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp
+++ b/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp
@@ -321,7 +321,7 @@ static void generate_to_cpp(SourceGenerator& generator, ParameterType& parameter
if (!@js_name@@js_suffix@.is_object())
return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAnObject, @js_name@@js_suffix@.to_string_without_side_effects());
- auto* callback_type = vm.heap().allocate_without_realm<WebIDL::CallbackType>(@js_name@@js_suffix@.as_object(), HTML::incumbent_settings_object());
+ auto callback_type = vm.heap().allocate_without_realm<WebIDL::CallbackType>(@js_name@@js_suffix@.as_object(), HTML::incumbent_settings_object());
@cpp_name@ = @cpp_type@::create(realm, *callback_type).ptr();
}
)~~~");
@@ -330,8 +330,8 @@ static void generate_to_cpp(SourceGenerator& generator, ParameterType& parameter
if (!@js_name@@js_suffix@.is_object())
return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAnObject, @js_name@@js_suffix@.to_string_without_side_effects());
- auto* callback_type = vm.heap().allocate_without_realm<WebIDL::CallbackType>(@js_name@@js_suffix@.as_object(), HTML::incumbent_settings_object());
- auto @cpp_name@ = adopt_ref(*new @cpp_type@(move(callback_type)));
+ auto callback_type = vm.heap().allocate_without_realm<WebIDL::CallbackType>(@js_name@@js_suffix@.as_object(), HTML::incumbent_settings_object());
+ auto @cpp_name@ = adopt_ref(*new @cpp_type@(callback_type));
)~~~");
}
} else if (IDL::is_platform_object(*parameter.type)) {
diff --git a/Tests/LibWasm/test-wasm.cpp b/Tests/LibWasm/test-wasm.cpp
index 372cf53281..122d2cbdf7 100644
--- a/Tests/LibWasm/test-wasm.cpp
+++ b/Tests/LibWasm/test-wasm.cpp
@@ -50,7 +50,7 @@ public:
static JS::ThrowCompletionOr<WebAssemblyModule*> create(JS::Realm& realm, Wasm::Module module, HashMap<Wasm::Linker::Name, Wasm::ExternValue> const& imports)
{
auto& vm = realm.vm();
- auto* instance = realm.heap().allocate<WebAssemblyModule>(realm, *realm.intrinsics().object_prototype());
+ auto instance = realm.heap().allocate<WebAssemblyModule>(realm, *realm.intrinsics().object_prototype());
instance->m_module = move(module);
Wasm::Linker linker(*instance->m_module);
linker.link(imports);
@@ -62,7 +62,7 @@ public:
if (result.is_error())
return vm.throw_completion<JS::TypeError>(result.release_error().error);
instance->m_module_instance = result.release_value();
- return instance;
+ return instance.ptr();
}
void initialize(JS::Realm&) override;
diff --git a/Userland/Libraries/LibJS/Bytecode/Op.cpp b/Userland/Libraries/LibJS/Bytecode/Op.cpp
index a8ab19f398..413413d7a3 100644
--- a/Userland/Libraries/LibJS/Bytecode/Op.cpp
+++ b/Userland/Libraries/LibJS/Bytecode/Op.cpp
@@ -816,7 +816,7 @@ void ContinuePendingUnwind::replace_references_impl(BasicBlock const& from, Basi
ThrowCompletionOr<void> PushDeclarativeEnvironment::execute_impl(Bytecode::Interpreter& interpreter) const
{
- auto* environment = interpreter.vm().heap().allocate_without_realm<DeclarativeEnvironment>(interpreter.vm().lexical_environment());
+ auto environment = interpreter.vm().heap().allocate_without_realm<DeclarativeEnvironment>(interpreter.vm().lexical_environment());
interpreter.vm().running_execution_context().lexical_environment = environment;
interpreter.vm().running_execution_context().variable_environment = environment;
return {};
diff --git a/Userland/Libraries/LibJS/Contrib/Test262/$262Object.cpp b/Userland/Libraries/LibJS/Contrib/Test262/$262Object.cpp
index 671126e0ab..4c7a2f9131 100644
--- a/Userland/Libraries/LibJS/Contrib/Test262/$262Object.cpp
+++ b/Userland/Libraries/LibJS/Contrib/Test262/$262Object.cpp
@@ -59,7 +59,7 @@ JS_DEFINE_NATIVE_FUNCTION($262Object::clear_kept_objects)
JS_DEFINE_NATIVE_FUNCTION($262Object::create_realm)
{
auto realm = Realm::create(vm);
- auto* realm_global_object = vm.heap().allocate_without_realm<GlobalObject>(*realm);
+ auto realm_global_object = vm.heap().allocate_without_realm<GlobalObject>(*realm);
VERIFY(realm_global_object);
realm->set_global_object(realm_global_object, nullptr);
set_default_global_bindings(*realm);
diff --git a/Userland/Libraries/LibJS/Heap/Heap.h b/Userland/Libraries/LibJS/Heap/Heap.h
index da894067d1..aa58a11cce 100644
--- a/Userland/Libraries/LibJS/Heap/Heap.h
+++ b/Userland/Libraries/LibJS/Heap/Heap.h
@@ -33,21 +33,21 @@ public:
~Heap();
template<typename T, typename... Args>
- T* allocate_without_realm(Args&&... args)
+ NonnullGCPtr<T> allocate_without_realm(Args&&... args)
{
auto* memory = allocate_cell(sizeof(T));
new (memory) T(forward<Args>(args)...);
- return static_cast<T*>(memory);
+ return *static_cast<T*>(memory);
}
template<typename T, typename... Args>
- T* allocate(Realm& realm, Args&&... args)
+ NonnullGCPtr<T> allocate(Realm& realm, Args&&... args)
{
auto* memory = allocate_cell(sizeof(T));
new (memory) T(forward<Args>(args)...);
auto* cell = static_cast<T*>(memory);
memory->initialize(realm);
- return cell;
+ return *cell;
}
enum class CollectionType {
diff --git a/Userland/Libraries/LibJS/Module.cpp b/Userland/Libraries/LibJS/Module.cpp
index 986c070d79..bba073a044 100644
--- a/Userland/Libraries/LibJS/Module.cpp
+++ b/Userland/Libraries/LibJS/Module.cpp
@@ -114,7 +114,7 @@ Object* Module::module_namespace_create(VM& vm, Vector<FlyString> unambiguous_na
// 6. Let sortedExports be a List whose elements are the elements of exports ordered as if an Array of the same values had been sorted using %Array.prototype.sort% using undefined as comparefn.
// 7. Set M.[[Exports]] to sortedExports.
// 8. Create own properties of M corresponding to the definitions in 28.3.
- Object* module_namespace = vm.heap().allocate<ModuleNamespaceObject>(realm, realm, this, move(unambiguous_names));
+ auto module_namespace = vm.heap().allocate<ModuleNamespaceObject>(realm, realm, this, move(unambiguous_names));
// 9. Set module.[[Namespace]] to M.
m_namespace = make_handle(module_namespace);
diff --git a/Userland/Libraries/LibJS/Runtime/AbstractOperations.cpp b/Userland/Libraries/LibJS/Runtime/AbstractOperations.cpp
index 76e33d4e79..181bcf5e97 100644
--- a/Userland/Libraries/LibJS/Runtime/AbstractOperations.cpp
+++ b/Userland/Libraries/LibJS/Runtime/AbstractOperations.cpp
@@ -412,7 +412,7 @@ FunctionEnvironment* new_function_environment(ECMAScriptFunctionObject& function
auto& heap = function.heap();
// 1. Let env be a new function Environment Record containing no bindings.
- auto* env = heap.allocate_without_realm<FunctionEnvironment>(function.environment());
+ auto env = heap.allocate_without_realm<FunctionEnvironment>(function.environment());
// 2. Set env.[[FunctionObject]] to F.
env->set_function_object(function);
@@ -1101,7 +1101,7 @@ Object* create_mapped_arguments_object(VM& vm, FunctionObject& function, Vector<
// 7. Set obj.[[Set]] as specified in 10.4.4.4.
// 8. Set obj.[[Delete]] as specified in 10.4.4.5.
// 9. Set obj.[[Prototype]] to %Object.prototype%.
- auto* object = vm.heap().allocate<ArgumentsObject>(realm, realm, environment);
+ auto object = vm.heap().allocate<ArgumentsObject>(realm, realm, environment);
// 14. Let index be 0.
// 15. Repeat, while index < len,
diff --git a/Userland/Libraries/LibJS/Runtime/AbstractOperations.h b/Userland/Libraries/LibJS/Runtime/AbstractOperations.h
index 896484d5f8..ab16d30c34 100644
--- a/Userland/Libraries/LibJS/Runtime/AbstractOperations.h
+++ b/Userland/Libraries/LibJS/Runtime/AbstractOperations.h
@@ -135,7 +135,7 @@ ThrowCompletionOr<T*> ordinary_create_from_constructor(VM& vm, FunctionObject co
{
auto& realm = *vm.current_realm();
auto* prototype = TRY(get_prototype_from_constructor(vm, constructor, intrinsic_default_prototype));
- return realm.heap().allocate<T>(realm, forward<Args>(args)..., *prototype);
+ return realm.heap().allocate<T>(realm, forward<Args>(args)..., *prototype).ptr();
}
// 14.1 MergeLists ( a, b ), https://tc39.es/proposal-temporal/#sec-temporal-mergelists
diff --git a/Userland/Libraries/LibJS/Runtime/Accessor.h b/Userland/Libraries/LibJS/Runtime/Accessor.h
index 213627541c..740e53701e 100644
--- a/Userland/Libraries/LibJS/Runtime/Accessor.h
+++ b/Userland/Libraries/LibJS/Runtime/Accessor.h
@@ -19,7 +19,7 @@ class Accessor final : public Cell {
public:
static NonnullGCPtr<Accessor> create(VM& vm, FunctionObject* getter, FunctionObject* setter)
{
- return *vm.heap().allocate_without_realm<Accessor>(getter, setter);
+ return vm.heap().allocate_without_realm<Accessor>(getter, setter);
}
FunctionObject* getter() const { return m_getter; }
diff --git a/Userland/Libraries/LibJS/Runtime/AggregateError.cpp b/Userland/Libraries/LibJS/Runtime/AggregateError.cpp
index 8ad7773c5b..7780e464cf 100644
--- a/Userland/Libraries/LibJS/Runtime/AggregateError.cpp
+++ b/Userland/Libraries/LibJS/Runtime/AggregateError.cpp
@@ -12,7 +12,7 @@ namespace JS {
NonnullGCPtr<AggregateError> AggregateError::create(Realm& realm)
{
- return *realm.heap().allocate<AggregateError>(realm, *realm.intrinsics().aggregate_error_prototype());
+ return realm.heap().allocate<AggregateError>(realm, *realm.intrinsics().aggregate_error_prototype());
}
AggregateError::AggregateError(Object& prototype)
diff --git a/Userland/Libraries/LibJS/Runtime/Array.cpp b/Userland/Libraries/LibJS/Runtime/Array.cpp
index 3a8c6ae8fe..b651b31f1b 100644
--- a/Userland/Libraries/LibJS/Runtime/Array.cpp
+++ b/Userland/Libraries/LibJS/Runtime/Array.cpp
@@ -32,13 +32,13 @@ ThrowCompletionOr<NonnullGCPtr<Array>> Array::create(Realm& realm, u64 length, O
// 3. Let A be MakeBasicObject(« [[Prototype]], [[Extensible]] »).
// 4. Set A.[[Prototype]] to proto.
// 5. Set A.[[DefineOwnProperty]] as specified in 10.4.2.1.
- auto* array = realm.heap().allocate<Array>(realm, *prototype);
+ auto array = realm.heap().allocate<Array>(realm, *prototype);
// 6. Perform ! OrdinaryDefineOwnProperty(A, "length", PropertyDescriptor { [[Value]]: 𝔽(length), [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: false }).
MUST(array->internal_define_own_property(vm.names.length, { .value = Value(length), .writable = true, .enumerable = false, .configurable = false }));
// 7. Return A.
- return NonnullGCPtr { *array };
+ return array;
}
// 7.3.18 CreateArrayFromList ( elements ), https://tc39.es/ecma262/#sec-createarrayfromlist
diff --git a/Userland/Libraries/LibJS/Runtime/ArrayBuffer.cpp b/Userland/Libraries/LibJS/Runtime/ArrayBuffer.cpp
index 772fc285ce..b4f4ba09b7 100644
--- a/Userland/Libraries/LibJS/Runtime/ArrayBuffer.cpp
+++ b/Userland/Libraries/LibJS/Runtime/ArrayBuffer.cpp
@@ -17,17 +17,17 @@ ThrowCompletionOr<NonnullGCPtr<ArrayBuffer>> ArrayBuffer::create(Realm& realm, s
if (buffer.is_error())
return realm.vm().throw_completion<RangeError>(ErrorType::NotEnoughMemoryToAllocate, byte_length);
- return NonnullGCPtr { *realm.heap().allocate<ArrayBuffer>(realm, buffer.release_value(), *realm.intrinsics().array_buffer_prototype()) };
+ return realm.heap().allocate<ArrayBuffer>(realm, buffer.release_value(), *realm.intrinsics().array_buffer_prototype());
}
NonnullGCPtr<ArrayBuffer> ArrayBuffer::create(Realm& realm, ByteBuffer buffer)
{
- return *realm.heap().allocate<ArrayBuffer>(realm, move(buffer), *realm.intrinsics().array_buffer_prototype());
+ return realm.heap().allocate<ArrayBuffer>(realm, move(buffer), *realm.intrinsics().array_buffer_prototype());
}
NonnullGCPtr<ArrayBuffer> ArrayBuffer::create(Realm& realm, ByteBuffer* buffer)
{
- return *realm.heap().allocate<ArrayBuffer>(realm, buffer, *realm.intrinsics().array_buffer_prototype());
+ return realm.heap().allocate<ArrayBuffer>(realm, buffer, *realm.intrinsics().array_buffer_prototype());
}
ArrayBuffer::ArrayBuffer(ByteBuffer buffer, Object& prototype)
diff --git a/Userland/Libraries/LibJS/Runtime/ArrayIterator.cpp b/Userland/Libraries/LibJS/Runtime/ArrayIterator.cpp
index eca16e4108..4b23b3c3c9 100644
--- a/Userland/Libraries/LibJS/Runtime/ArrayIterator.cpp
+++ b/Userland/Libraries/LibJS/Runtime/ArrayIterator.cpp
@@ -11,7 +11,7 @@ namespace JS {
NonnullGCPtr<ArrayIterator> ArrayIterator::create(Realm& realm, Value array, Object::PropertyKind iteration_kind)
{
- return *realm.heap().allocate<ArrayIterator>(realm, array, iteration_kind, *realm.intrinsics().array_iterator_prototype());
+ return realm.heap().allocate<ArrayIterator>(realm, array, iteration_kind, *realm.intrinsics().array_iterator_prototype());
}
ArrayIterator::ArrayIterator(Value array, Object::PropertyKind iteration_kind, Object& prototype)
diff --git a/Userland/Libraries/LibJS/Runtime/AsyncFromSyncIterator.cpp b/Userland/Libraries/LibJS/Runtime/AsyncFromSyncIterator.cpp
index 9459ccc1d2..61daf95fd6 100644
--- a/Userland/Libraries/LibJS/Runtime/AsyncFromSyncIterator.cpp
+++ b/Userland/Libraries/LibJS/Runtime/AsyncFromSyncIterator.cpp
@@ -13,7 +13,7 @@ namespace JS {
NonnullGCPtr<AsyncFromSyncIterator> AsyncFromSyncIterator::create(Realm& realm, Iterator sync_iterator_record)
{
- return *realm.heap().allocate<AsyncFromSyncIterator>(realm, realm, sync_iterator_record);
+ return realm.heap().allocate<AsyncFromSyncIterator>(realm, realm, sync_iterator_record);
}
AsyncFromSyncIterator::AsyncFromSyncIterator(Realm& realm, Iterator sync_iterator_record)
diff --git a/Userland/Libraries/LibJS/Runtime/BigInt.cpp b/Userland/Libraries/LibJS/Runtime/BigInt.cpp
index 86691727e2..8c0b8a443f 100644
--- a/Userland/Libraries/LibJS/Runtime/BigInt.cpp
+++ b/Userland/Libraries/LibJS/Runtime/BigInt.cpp
@@ -13,7 +13,7 @@ namespace JS {
NonnullGCPtr<BigInt> BigInt::create(VM& vm, Crypto::SignedBigInteger big_integer)
{
- return *vm.heap().allocate_without_realm<BigInt>(move(big_integer));
+ return vm.heap().allocate_without_realm<BigInt>(move(big_integer));
}
BigInt::BigInt(Crypto::SignedBigInteger big_integer)
diff --git a/Userland/Libraries/LibJS/Runtime/BigIntObject.cpp b/Userland/Libraries/LibJS/Runtime/BigIntObject.cpp
index 686f790200..25ffe5b4fd 100644
--- a/Userland/Libraries/LibJS/Runtime/BigIntObject.cpp
+++ b/Userland/Libraries/LibJS/Runtime/BigIntObject.cpp
@@ -11,7 +11,7 @@ namespace JS {
NonnullGCPtr<BigIntObject> BigIntObject::create(Realm& realm, BigInt& bigint)
{
- return *realm.heap().allocate<BigIntObject>(realm, bigint, *realm.intrinsics().bigint_prototype());
+ return realm.heap().allocate<BigIntObject>(realm, bigint, *realm.intrinsics().bigint_prototype());
}
BigIntObject::BigIntObject(BigInt& bigint, Object& prototype)
diff --git a/Userland/Libraries/LibJS/Runtime/BooleanObject.cpp b/Userland/Libraries/LibJS/Runtime/BooleanObject.cpp
index 21decbc74b..95121a47f6 100644
--- a/Userland/Libraries/LibJS/Runtime/BooleanObject.cpp
+++ b/Userland/Libraries/LibJS/Runtime/BooleanObject.cpp
@@ -11,7 +11,7 @@ namespace JS {
NonnullGCPtr<BooleanObject> BooleanObject::create(Realm& realm, bool value)
{
- return *realm.heap().allocate<BooleanObject>(realm, value, *realm.intrinsics().boolean_prototype());
+ return realm.heap().allocate<BooleanObject>(realm, value, *realm.intrinsics().boolean_prototype());
}
BooleanObject::BooleanObject(bool value, Object& prototype)
diff --git a/Userland/Libraries/LibJS/Runtime/BoundFunction.cpp b/Userland/Libraries/LibJS/Runtime/BoundFunction.cpp
index e2871b05a1..96032afa86 100644
--- a/Userland/Libraries/LibJS/Runtime/BoundFunction.cpp
+++ b/Userland/Libraries/LibJS/Runtime/BoundFunction.cpp
@@ -26,10 +26,10 @@ ThrowCompletionOr<NonnullGCPtr<BoundFunction>> BoundFunction::create(Realm& real
// 7. Set obj.[[BoundTargetFunction]] to targetFunction.
// 8. Set obj.[[BoundThis]] to boundThis.
// 9. Set obj.[[BoundArguments]] to boundArgs.
- auto* object = realm.heap().allocate<BoundFunction>(realm, realm, target_function, bound_this, move(bound_arguments), prototype);
+ auto object = realm.heap().allocate<BoundFunction>(realm, realm, target_function, bound_this, move(bound_arguments), prototype);
// 10. Return obj.
- return NonnullGCPtr { *object };
+ return object;
}
BoundFunction::BoundFunction(Realm& realm, FunctionObject& bound_target_function, Value bound_this, Vector<Value> bound_arguments, Object* prototype)
diff --git a/Userland/Libraries/LibJS/Runtime/DataView.cpp b/Userland/Libraries/LibJS/Runtime/DataView.cpp
index bf4ac73680..8abf686c46 100644
--- a/Userland/Libraries/LibJS/Runtime/DataView.cpp
+++ b/Userland/Libraries/LibJS/Runtime/DataView.cpp
@@ -10,7 +10,7 @@ namespace JS {
NonnullGCPtr<DataView> DataView::create(Realm& realm, ArrayBuffer* viewed_buffer, size_t byte_length, size_t byte_offset)
{
- return *realm.heap().allocate<DataView>(realm, viewed_buffer, byte_length, byte_offset, *realm.intrinsics().data_view_prototype());
+ return realm.heap().allocate<DataView>(realm, viewed_buffer, byte_length, byte_offset, *realm.intrinsics().data_view_prototype());
}
DataView::DataView(ArrayBuffer* viewed_buffer, size_t byte_length, size_t byte_offset, Object& prototype)
diff --git a/Userland/Libraries/LibJS/Runtime/Date.cpp b/Userland/Libraries/LibJS/Runtime/Date.cpp
index 0c553da8ac..4c4db3ee14 100644
--- a/Userland/Libraries/LibJS/Runtime/Date.cpp
+++ b/Userland/Libraries/LibJS/Runtime/Date.cpp
@@ -23,7 +23,7 @@ static Crypto::SignedBigInteger const s_one_thousand_bigint { 1'000 };
NonnullGCPtr<Date> Date::create(Realm& realm, double date_value)
{
- return *realm.heap().allocate<Date>(realm, date_value, *realm.intrinsics().date_prototype());
+ return realm.heap().allocate<Date>(realm, date_value, *realm.intrinsics().date_prototype());
}
Date::Date(double date_value, Object& prototype)
diff --git a/Userland/Libraries/LibJS/Runtime/ECMAScriptFunctionObject.cpp b/Userland/Libraries/LibJS/Runtime/ECMAScriptFunctionObject.cpp
index e9ca728072..b77de62ad0 100644
--- a/Userland/Libraries/LibJS/Runtime/ECMAScriptFunctionObject.cpp
+++ b/Userland/Libraries/LibJS/Runtime/ECMAScriptFunctionObject.cpp
@@ -45,12 +45,12 @@ NonnullGCPtr<ECMAScriptFunctionObject> ECMAScriptFunctionObject::create(Realm& r
prototype = realm.intrinsics().async_generator_function_prototype();
break;
}
- return *realm.heap().allocate<ECMAScriptFunctionObject>(realm, move(name), move(source_text), ecmascript_code, move(parameters), m_function_length, parent_environment, private_environment, *prototype, kind, is_strict, might_need_arguments_object, contains_direct_call_to_eval, is_arrow_function, move(class_field_initializer_name));
+ return realm.heap().allocate<ECMAScriptFunctionObject>(realm, move(name), move(source_text), ecmascript_code, move(parameters), m_function_length, parent_environment, private_environment, *prototype, kind, is_strict, might_need_arguments_object, contains_direct_call_to_eval, is_arrow_function, move(class_field_initializer_name));
}
NonnullGCPtr<ECMAScriptFunctionObject> ECMAScriptFunctionObject::create(Realm& realm, FlyString name, Object& prototype, DeprecatedString source_text, Statement const& ecmascript_code, Vector<FunctionParameter> parameters, i32 m_function_length, Environment* parent_environment, PrivateEnvironment* private_environment, FunctionKind kind, bool is_strict, bool might_need_arguments_object, bool contains_direct_call_to_eval, bool is_arrow_function, Variant<PropertyKey, PrivateName, Empty> class_field_initializer_name)
{
- return *realm.heap().allocate<ECMAScriptFunctionObject>(realm, move(name), move(source_text), ecmascript_code, move(parameters), m_function_length, parent_environment, private_environment, prototype, kind, is_strict, might_need_arguments_object, contains_direct_call_to_eval, is_arrow_function, move(class_field_initializer_name));
+ return realm.heap().allocate<ECMAScriptFunctionObject>(realm, move(name), move(source_text), ecmascript_code, move(parameters), m_function_length, parent_environment, private_environment, prototype, kind, is_strict, might_need_arguments_object, contains_direct_call_to_eval, is_arrow_function, move(class_field_initializer_name));
}
ECMAScriptFunctionObject::ECMAScriptFunctionObject(FlyString name, DeprecatedString source_text, Statement const& ecmascript_code, Vector<FunctionParameter> formal_parameters, i32 function_length, Environment* parent_environment, PrivateEnvironment* private_environment, Object& prototype, FunctionKind kind, bool strict, bool might_need_arguments_object, bool contains_direct_call_to_eval, bool is_arrow_function, Variant<PropertyKey, PrivateName, Empty> class_field_initializer_name)
diff --git a/Userland/Libraries/LibJS/Runtime/Error.cpp b/Userland/Libraries/LibJS/Runtime/Error.cpp
index ca3960899a..ea377a5565 100644
--- a/Userland/Libraries/LibJS/Runtime/Error.cpp
+++ b/Userland/Libraries/LibJS/Runtime/Error.cpp
@@ -16,7 +16,7 @@ namespace JS {
NonnullGCPtr<Error> Error::create(Realm& realm)
{
- return *realm.heap().allocate<Error>(realm, *realm.intrinsics().error_prototype());
+ return realm.heap().allocate<Error>(realm, *realm.intrinsics().error_prototype());
}
NonnullGCPtr<Error> Error::create(Realm& realm, DeprecatedString const& message)
@@ -98,24 +98,24 @@ DeprecatedString Error::stack_string() const
return stack_string_builder.build();
}
-#define __JS_ENUMERATE(ClassName, snake_name, PrototypeName, ConstructorName, ArrayType) \
- NonnullGCPtr<ClassName> ClassName::create(Realm& realm) \
- { \
- return *realm.heap().allocate<ClassName>(realm, *realm.intrinsics().snake_name##_prototype()); \
- } \
- \
- NonnullGCPtr<ClassName> ClassName::create(Realm& realm, DeprecatedString const& message) \
- { \
- auto& vm = realm.vm(); \
- auto error = ClassName::create(realm); \
- u8 attr = Attribute::Writable | Attribute::Configurable; \
- error->define_direct_property(vm.names.message, PrimitiveString::create(vm, message), attr); \
- return error; \
- } \
- \
- ClassName::ClassName(Object& prototype) \
- : Error(prototype) \
- { \
+#define __JS_ENUMERATE(ClassName, snake_name, PrototypeName, ConstructorName, ArrayType) \
+ NonnullGCPtr<ClassName> ClassName::create(Realm& realm) \
+ { \
+ return realm.heap().allocate<ClassName>(realm, *realm.intrinsics().snake_name##_prototype()); \
+ } \
+ \
+ NonnullGCPtr<ClassName> ClassName::create(Realm& realm, DeprecatedString const& message) \
+ { \
+ auto& vm = realm.vm(); \
+ auto error = ClassName::create(realm); \
+ u8 attr = Attribute::Writable | Attribute::Configurable; \
+ error->define_direct_property(vm.names.message, PrimitiveString::create(vm, message), attr); \
+ return error; \
+ } \
+ \
+ ClassName::ClassName(Object& prototype) \
+ : Error(prototype) \
+ { \
}
JS_ENUMERATE_NATIVE_ERRORS
diff --git a/Userland/Libraries/LibJS/Runtime/GeneratorObject.cpp b/Userland/Libraries/LibJS/Runtime/GeneratorObject.cpp
index 206ecc2597..99016bbb66 100644
--- a/Userland/Libraries/LibJS/Runtime/GeneratorObject.cpp
+++ b/Userland/Libraries/LibJS/Runtime/GeneratorObject.cpp
@@ -32,7 +32,7 @@ ThrowCompletionOr<NonnullGCPtr<GeneratorObject>> GeneratorObject::create(Realm&
object->m_generating_function = generating_function;
object->m_frame = move(frame);
object->m_previous_value = initial_value;
- return NonnullGCPtr { *object };
+ return object;
}
GeneratorObject::GeneratorObject(Realm&, Object& prototype, ExecutionContext context)
diff --git a/Userland/Libraries/LibJS/Runtime/Intl/CollatorCompareFunction.cpp b/Userland/Libraries/LibJS/Runtime/Intl/CollatorCompareFunction.cpp
index 7da460de03..a12ce9ced6 100644
--- a/Userland/Libraries/LibJS/Runtime/Intl/CollatorCompareFunction.cpp
+++ b/Userland/Libraries/LibJS/Runtime/Intl/CollatorCompareFunction.cpp
@@ -13,7 +13,7 @@ namespace JS::Intl {
NonnullGCPtr<CollatorCompareFunction> CollatorCompareFunction::create(Realm& realm, Collator& collator)
{
- return *realm.heap().allocate<CollatorCompareFunction>(realm, realm, collator);
+ return realm.heap().allocate<CollatorCompareFunction>(realm, realm, collator);
}
CollatorCompareFunction::CollatorCompareFunction(Realm& realm, Collator& collator)
diff --git a/Userland/Libraries/LibJS/Runtime/Intl/DateTimeFormatFunction.cpp b/Userland/Libraries/LibJS/Runtime/Intl/DateTimeFormatFunction.cpp
index 3b8be4d42a..5fc0912b76 100644
--- a/Userland/Libraries/LibJS/Runtime/Intl/DateTimeFormatFunction.cpp
+++ b/Userland/Libraries/LibJS/Runtime/Intl/DateTimeFormatFunction.cpp
@@ -16,7 +16,7 @@ namespace JS::Intl {
// 11.5.5 DateTime Format Functions, https://tc39.es/ecma402/#sec-datetime-format-functions
NonnullGCPtr<DateTimeFormatFunction> DateTimeFormatFunction::create(Realm& realm, DateTimeFormat& date_time_format)
{
- return *realm.heap().allocate<DateTimeFormatFunction>(realm, date_time_format, *realm.intrinsics().function_prototype());
+ return realm.heap().allocate<DateTimeFormatFunction>(realm, date_time_format, *realm.intrinsics().function_prototype());
}
DateTimeFormatFunction::DateTimeFormatFunction(DateTimeFormat& date_time_format, Object& prototype)
diff --git a/Userland/Libraries/LibJS/Runtime/Intl/Locale.cpp b/Userland/Libraries/LibJS/Runtime/Intl/Locale.cpp
index 3907cbf695..5dfa3ee110 100644
--- a/Userland/Libraries/LibJS/Runtime/Intl/Locale.cpp
+++ b/Userland/Libraries/LibJS/Runtime/Intl/Locale.cpp
@@ -16,7 +16,7 @@ namespace JS::Intl {
NonnullGCPtr<Locale> Locale::create(Realm& realm, ::Locale::LocaleID const& locale_id)
{
- return *realm.heap().allocate<Locale>(realm, locale_id, *realm.intrinsics().intl_locale_prototype());
+ return realm.heap().allocate<Locale>(realm, locale_id, *realm.intrinsics().intl_locale_prototype());
}
// 14 Locale Objects, https://tc39.es/ecma402/#locale-objects
diff --git a/Userland/Libraries/LibJS/Runtime/Intl/NumberFormatFunction.cpp b/Userland/Libraries/LibJS/Runtime/Intl/NumberFormatFunction.cpp
index ea4377ec3b..f3581ff3b3 100644
--- a/Userland/Libraries/LibJS/Runtime/Intl/NumberFormatFunction.cpp
+++ b/Userland/Libraries/LibJS/Runtime/Intl/NumberFormatFunction.cpp
@@ -14,7 +14,7 @@ namespace JS::Intl {
// 1.1.4 Number Format Functions, https://tc39.es/proposal-intl-numberformat-v3/out/numberformat/proposed.html#sec-number-format-functions
NonnullGCPtr<NumberFormatFunction> NumberFormatFunction::create(Realm& realm, NumberFormat& number_format)
{
- return *realm.heap().allocate<NumberFormatFunction>(realm, number_format, *realm.intrinsics().function_prototype());
+ return realm.heap().allocate<NumberFormatFunction>(realm, number_format, *realm.intrinsics().function_prototype());
}
NumberFormatFunction::NumberFormatFunction(NumberFormat& number_format, Object& prototype)
diff --git a/Userland/Libraries/LibJS/Runtime/Intl/SegmentIterator.cpp b/Userland/Libraries/LibJS/Runtime/Intl/SegmentIterator.cpp
index 0fbdf3c6d8..1fb4f32d73 100644
--- a/Userland/Libraries/LibJS/Runtime/Intl/SegmentIterator.cpp
+++ b/Userland/Libraries/LibJS/Runtime/Intl/SegmentIterator.cpp
@@ -19,7 +19,7 @@ NonnullGCPtr<SegmentIterator> SegmentIterator::create(Realm& realm, Segmenter& s
// 4. Set iterator.[[IteratedString]] to string.
// 5. Set iterator.[[IteratedStringNextSegmentCodeUnitIndex]] to 0.
// 6. Return iterator.
- return *realm.heap().allocate<SegmentIterator>(realm, realm, segmenter, move(string), segments);
+ return realm.heap().allocate<SegmentIterator>(realm, realm, segmenter, move(string), segments);
}
// 18.6 Segment Iterator Objects, https://tc39.es/ecma402/#sec-segment-iterator-objects
diff --git a/Userland/Libraries/LibJS/Runtime/Intl/Segments.cpp b/Userland/Libraries/LibJS/Runtime/Intl/Segments.cpp
index 2572fcf6d7..585b3b7229 100644
--- a/Userland/Libraries/LibJS/Runtime/Intl/Segments.cpp
+++ b/Userland/Libraries/LibJS/Runtime/Intl/Segments.cpp
@@ -18,7 +18,7 @@ NonnullGCPtr<Segments> Segments::create(Realm& realm, Segmenter& segmenter, Utf1
// 3. Set segments.[[SegmentsSegmenter]] to segmenter.
// 4. Set segments.[[SegmentsString]] to string.
// 5. Return segments.
- return *realm.heap().allocate<Segments>(realm, realm, segmenter, move(string));
+ return realm.heap().allocate<Segments>(realm, realm, segmenter, move(string));
}
// 18.5 Segments Objects, https://tc39.es/ecma402/#sec-segments-objects
diff --git a/Userland/Libraries/LibJS/Runtime/Intrinsics.cpp b/Userland/Libraries/LibJS/Runtime/Intrinsics.cpp
index 1380e1a25c..1ab3d19728 100644
--- a/Userland/Libraries/LibJS/Runtime/Intrinsics.cpp
+++ b/Userland/Libraries/LibJS/Runtime/Intrinsics.cpp
@@ -137,8 +137,8 @@ NonnullGCPtr<Intrinsics> Intrinsics::create(Realm& realm)
auto& vm = realm.vm();
// 1. Set realmRec.[[Intrinsics]] to a new Record.
- auto* intrinsics = vm.heap().allocate_without_realm<Intrinsics>(realm);
- realm.set_intrinsics({}, *intrinsics);
+ auto intrinsics = vm.heap().allocate_without_realm<Intrinsics>(realm);
+ realm.set_intrinsics({}, intrinsics);
// 2. Set fields of realmRec.[[Intrinsics]] with the values listed in Table 6.
// The field names are the names listed in column one of the table.
diff --git a/Userland/Libraries/LibJS/Runtime/Map.cpp b/Userland/Libraries/LibJS/Runtime/Map.cpp
index e65dde2e04..bc29064bf6 100644
--- a/Userland/Libraries/LibJS/Runtime/Map.cpp
+++ b/Userland/Libraries/LibJS/Runtime/Map.cpp
@@ -10,7 +10,7 @@ namespace JS {
NonnullGCPtr<Map> Map::create(Realm& realm)
{
- return *realm.heap().allocate<Map>(realm, *realm.intrinsics().map_prototype());
+ return realm.heap().allocate<Map>(realm, *realm.intrinsics().map_prototype());
}
Map::Map(Object& prototype)
diff --git a/Userland/Libraries/LibJS/Runtime/MapIterator.cpp b/Userland/Libraries/LibJS/Runtime/MapIterator.cpp
index 7685bcee82..ef66637bd5 100644
--- a/Userland/Libraries/LibJS/Runtime/MapIterator.cpp
+++ b/Userland/Libraries/LibJS/Runtime/MapIterator.cpp
@@ -11,7 +11,7 @@ namespace JS {
NonnullGCPtr<MapIterator> MapIterator::create(Realm& realm, Map& map, Object::PropertyKind iteration_kind)
{
- return *realm.heap().allocate<MapIterator>(realm, map, iteration_kind, *realm.intrinsics().map_iterator_prototype());
+ return realm.heap().allocate<MapIterator>(realm, map, iteration_kind, *realm.intrinsics().map_iterator_prototype());
}
MapIterator::MapIterator(Map& map, Object::PropertyKind iteration_kind, Object& prototype)
diff --git a/Userland/Libraries/LibJS/Runtime/NativeFunction.cpp b/Userland/Libraries/LibJS/Runtime/NativeFunction.cpp
index 8a50e3ad3c..31df52b1b4 100644
--- a/Userland/Libraries/LibJS/Runtime/NativeFunction.cpp
+++ b/Userland/Libraries/LibJS/Runtime/NativeFunction.cpp
@@ -36,7 +36,7 @@ NonnullGCPtr<NativeFunction> NativeFunction::create(Realm& allocating_realm, Saf
// 7. Set func.[[Extensible]] to true.
// 8. Set func.[[Realm]] to realm.
// 9. Set func.[[InitialName]] to null.
- auto* function = allocating_realm.heap().allocate<NativeFunction>(allocating_realm, move(behaviour), prototype.value(), *realm.value());
+ auto function = allocating_realm.heap().allocate<NativeFunction>(allocating_realm, move(behaviour), prototype.value(), *realm.value());
// 10. Perform SetFunctionLength(func, length).
function->set_function_length(length);
@@ -48,12 +48,12 @@ NonnullGCPtr<NativeFunction> NativeFunction::create(Realm& allocating_realm, Saf
function->set_function_name(name, prefix);
// 13. Return func.
- return *function;
+ return function;
}
NonnullGCPtr<NativeFunction> NativeFunction::create(Realm& realm, FlyString const& name, SafeFunction<ThrowCompletionOr<Value>(VM&)> function)
{
- return *realm.heap().allocate<NativeFunction>(realm, name, move(function), *realm.intrinsics().function_prototype());
+ return realm.heap().allocate<NativeFunction>(realm, name, move(function), *realm.intrinsics().function_prototype());
}
NativeFunction::NativeFunction(SafeFunction<ThrowCompletionOr<Value>(VM&)> native_function, Object* prototype, Realm& realm)
diff --git a/Userland/Libraries/LibJS/Runtime/NumberObject.cpp b/Userland/Libraries/LibJS/Runtime/NumberObject.cpp
index 0086a454ae..72cfc01548 100644
--- a/Userland/Libraries/LibJS/Runtime/NumberObject.cpp
+++ b/Userland/Libraries/LibJS/Runtime/NumberObject.cpp
@@ -11,7 +11,7 @@ namespace JS {
NonnullGCPtr<NumberObject> NumberObject::create(Realm& realm, double value)
{
- return *realm.heap().allocate<NumberObject>(realm, value, *realm.intrinsics().number_prototype());
+ return realm.heap().allocate<NumberObject>(realm, value, *realm.intrinsics().number_prototype());
}
NumberObject::NumberObject(double value, Object& prototype)
diff --git a/Userland/Libraries/LibJS/Runtime/Object.cpp b/Userland/Libraries/LibJS/Runtime/Object.cpp
index 1de34675ba..4869c69318 100644
--- a/Userland/Libraries/LibJS/Runtime/Object.cpp
+++ b/Userland/Libraries/LibJS/Runtime/Object.cpp
@@ -30,11 +30,11 @@ static HashMap<Object const*, HashMap<FlyString, Object::IntrinsicAccessor>> s_i
NonnullGCPtr<Object> Object::create(Realm& realm, Object* prototype)
{
if (!prototype)
- return *realm.heap().allocate<Object>(realm, *realm.intrinsics().empty_object_shape());
+ return realm.heap().allocate<Object>(realm, *realm.intrinsics().empty_object_shape());
else if (prototype == realm.intrinsics().object_prototype())
- return *realm.heap().allocate<Object>(realm, *realm.intrinsics().new_object_shape());
+ return realm.heap().allocate<Object>(realm, *realm.intrinsics().new_object_shape());
else
- return *realm.heap().allocate<Object>(realm, ConstructWithPrototypeTag::Tag, *prototype);
+ return realm.heap().allocate<Object>(realm, ConstructWithPrototypeTag::Tag, *prototype);
}
Object::Object(GlobalObjectTag, Realm& realm)
diff --git a/Userland/Libraries/LibJS/Runtime/PrimitiveString.cpp b/Userland/Libraries/LibJS/Runtime/PrimitiveString.cpp
index 2b0a3ed4d6..cecc841b6e 100644
--- a/Userland/Libraries/LibJS/Runtime/PrimitiveString.cpp
+++ b/Userland/Libraries/LibJS/Runtime/PrimitiveString.cpp
@@ -125,7 +125,7 @@ NonnullGCPtr<PrimitiveString> PrimitiveString::create(VM& vm, Utf16String string
return vm.single_ascii_character_string(static_cast<u8>(code_unit));
}
- return *vm.heap().allocate_without_realm<PrimitiveString>(move(string));
+ return vm.heap().allocate_without_realm<PrimitiveString>(move(string));
}
NonnullGCPtr<PrimitiveString> PrimitiveString::create(VM& vm, DeprecatedString string)
@@ -142,7 +142,7 @@ NonnullGCPtr<PrimitiveString> PrimitiveString::create(VM& vm, DeprecatedString s
auto& string_cache = vm.string_cache();
auto it = string_cache.find(string);
if (it == string_cache.end()) {
- auto* new_string = vm.heap().allocate_without_realm<PrimitiveString>(string);
+ auto new_string = vm.heap().allocate_without_realm<PrimitiveString>(string);
string_cache.set(move(string), new_string);
return *new_string;
}
@@ -166,7 +166,7 @@ NonnullGCPtr<PrimitiveString> PrimitiveString::create(VM& vm, PrimitiveString& l
if (rhs_empty)
return lhs;
- return *vm.heap().allocate_without_realm<PrimitiveString>(lhs, rhs);
+ return vm.heap().allocate_without_realm<PrimitiveString>(lhs, rhs);
}
void PrimitiveString::resolve_rope_if_needed() const
diff --git a/Userland/Libraries/LibJS/Runtime/Promise.cpp b/Userland/Libraries/LibJS/Runtime/Promise.cpp
index 658fe85a33..40a721ce22 100644
--- a/Userland/Libraries/LibJS/Runtime/Promise.cpp
+++ b/Userland/Libraries/LibJS/Runtime/Promise.cpp
@@ -44,7 +44,7 @@ ThrowCompletionOr<Object*> promise_resolve(VM& vm, Object& constructor, Value va
NonnullGCPtr<Promise> Promise::create(Realm& realm)
{
- return *realm.heap().allocate<Promise>(realm, *realm.intrinsics().promise_prototype());
+ return realm.heap().allocate<Promise>(realm, *realm.intrinsics().promise_prototype());
}
// 27.2 Promise Objects, https://tc39.es/ecma262/#sec-promise-objects
@@ -62,7 +62,7 @@ Promise::ResolvingFunctions Promise::create_resolving_functions()
auto& realm = *vm.current_realm();
// 1. Let alreadyResolved be the Record { [[Value]]: false }.
- auto* already_resolved = vm.heap().allocate_without_realm<AlreadyResolved>();
+ auto already_resolved = vm.heap().allocate_without_realm<AlreadyResolved>();
// 2. Let stepsResolve be the algorithm steps defined in Promise Resolve Functions.
// 3. Let lengthResolve be the number of non-optional parameters of the function definition in Promise Resolve Functions.
diff --git a/Userland/Libraries/LibJS/Runtime/PromiseCapability.cpp b/Userland/Libraries/LibJS/Runtime/PromiseCapability.cpp
index 7a4f1565c5..e3715ce70d 100644
--- a/Userland/Libraries/LibJS/Runtime/PromiseCapability.cpp
+++ b/Userland/Libraries/LibJS/Runtime/PromiseCapability.cpp
@@ -13,7 +13,7 @@ namespace JS {
NonnullGCPtr<PromiseCapability> PromiseCapability::create(VM& vm, GCPtr<Object> promise, GCPtr<FunctionObject> resolve, GCPtr<FunctionObject> reject)
{
- return NonnullGCPtr { *vm.heap().allocate_without_realm<PromiseCapability>(promise, resolve, reject) };
+ return vm.heap().allocate_without_realm<PromiseCapability>(promise, resolve, reject);
}
PromiseCapability::PromiseCapability(GCPtr<Object> promise, GCPtr<FunctionObject> resolve, GCPtr<FunctionObject> reject)
diff --git a/Userland/Libraries/LibJS/Runtime/PromiseConstructor.cpp b/Userland/Libraries/LibJS/Runtime/PromiseConstructor.cpp
index c01564c928..3215f78f96 100644
--- a/Userland/Libraries/LibJS/Runtime/PromiseConstructor.cpp
+++ b/Userland/Libraries/LibJS/Runtime/PromiseConstructor.cpp
@@ -45,10 +45,10 @@ static ThrowCompletionOr<Value> perform_promise_common(VM& vm, Iterator& iterato
VERIFY(promise_resolve.is_function());
// 1. Let values be a new empty List.
- auto* values = vm.heap().allocate_without_realm<PromiseValueList>();
+ auto values = vm.heap().allocate_without_realm<PromiseValueList>();
// 2. Let remainingElementsCount be the Record { [[Value]]: 1 }.
- auto* remaining_elements_count = vm.heap().allocate_without_realm<RemainingElements>(1);
+ auto remaining_elements_count = vm.heap().allocate_without_realm<RemainingElements>(1);
// 3. Let index be 0.
size_t index = 0;
diff --git a/Userland/Libraries/LibJS/Runtime/PromiseReaction.cpp b/Userland/Libraries/LibJS/Runtime/PromiseReaction.cpp
index e6e7fb3997..9de245875a 100644
--- a/Userland/Libraries/LibJS/Runtime/PromiseReaction.cpp
+++ b/Userland/Libraries/LibJS/Runtime/PromiseReaction.cpp
@@ -12,7 +12,7 @@ namespace JS {
NonnullGCPtr<PromiseReaction> PromiseReaction::create(VM& vm, Type type, GCPtr<PromiseCapability> capability, Optional<JobCallback> handler)
{
- return *vm.heap().allocate_without_realm<PromiseReaction>(type, capability, move(handler));
+ return vm.heap().allocate_without_realm<PromiseReaction>(type, capability, move(handler));
}
PromiseReaction::PromiseReaction(Type type, GCPtr<PromiseCapability> capability, Optional<JobCallback> handler)
diff --git a/Userland/Libraries/LibJS/Runtime/PromiseResolvingElementFunctions.cpp b/Userland/Libraries/LibJS/Runtime/PromiseResolvingElementFunctions.cpp
index 53f7c47cdc..4354e59aef 100644
--- a/Userland/Libraries/LibJS/Runtime/PromiseResolvingElementFunctions.cpp
+++ b/Userland/Libraries/LibJS/Runtime/PromiseResolvingElementFunctions.cpp
@@ -55,7 +55,7 @@ void PromiseResolvingElementFunction::visit_edges(Cell::Visitor& visitor)
NonnullGCPtr<PromiseAllResolveElementFunction> PromiseAllResolveElementFunction::create(Realm& realm, size_t index, PromiseValueList& values, NonnullGCPtr<PromiseCapability> capability, RemainingElements& remaining_elements)
{
- return *realm.heap().allocate<PromiseAllResolveElementFunction>(realm, index, values, capability, remaining_elements, *realm.intrinsics().function_prototype());
+ return realm.heap().allocate<PromiseAllResolveElementFunction>(realm, index, values, capability, remaining_elements, *realm.intrinsics().function_prototype());
}
PromiseAllResolveElementFunction::PromiseAllResolveElementFunction(size_t index, PromiseValueList& values, NonnullGCPtr<PromiseCapability> capability, RemainingElements& remaining_elements, Object& prototype)
@@ -87,7 +87,7 @@ ThrowCompletionOr<Value> PromiseAllResolveElementFunction::resolve_element()
NonnullGCPtr<PromiseAllSettledResolveElementFunction> PromiseAllSettledResolveElementFunction::create(Realm& realm, size_t index, PromiseValueList& values, NonnullGCPtr<PromiseCapability> capability, RemainingElements& remaining_elements)
{
- return *realm.heap().allocate<PromiseAllSettledResolveElementFunction>(realm, index, values, capability, remaining_elements, *realm.intrinsics().function_prototype());
+ return realm.heap().allocate<PromiseAllSettledResolveElementFunction>(realm, index, values, capability, remaining_elements, *realm.intrinsics().function_prototype());
}
PromiseAllSettledResolveElementFunction::PromiseAllSettledResolveElementFunction(size_t index, PromiseValueList& values, NonnullGCPtr<PromiseCapability> capability, RemainingElements& remaining_elements, Object& prototype)
@@ -128,7 +128,7 @@ ThrowCompletionOr<Value> PromiseAllSettledResolveElementFunction::resolve_elemen
NonnullGCPtr<PromiseAllSettledRejectElementFunction> PromiseAllSettledRejectElementFunction::create(Realm& realm, size_t index, PromiseValueList& values, NonnullGCPtr<PromiseCapability> capability, RemainingElements& remaining_elements)
{
- return *realm.heap().allocate<PromiseAllSettledRejectElementFunction>(realm, index, values, capability, remaining_elements, *realm.intrinsics().function_prototype());
+ return realm.heap().allocate<PromiseAllSettledRejectElementFunction>(realm, index, values, capability, remaining_elements, *realm.intrinsics().function_prototype());
}
PromiseAllSettledRejectElementFunction::PromiseAllSettledRejectElementFunction(size_t index, PromiseValueList& values, NonnullGCPtr<PromiseCapability> capability, RemainingElements& remaining_elements, Object& prototype)
@@ -169,7 +169,7 @@ ThrowCompletionOr<Value> PromiseAllSettledRejectElementFunction::resolve_element
NonnullGCPtr<PromiseAnyRejectElementFunction> PromiseAnyRejectElementFunction::create(Realm& realm, size_t index, PromiseValueList& errors, NonnullGCPtr<PromiseCapability> capability, RemainingElements& remaining_elements)
{
- return *realm.heap().allocate<PromiseAnyRejectElementFunction>(realm, index, errors, capability, remaining_elements, *realm.intrinsics().function_prototype());
+ return realm.heap().allocate<PromiseAnyRejectElementFunction>(realm, index, errors, capability, remaining_elements, *realm.intrinsics().function_prototype());
}
PromiseAnyRejectElementFunction::PromiseAnyRejectElementFunction(size_t index, PromiseValueList& errors, NonnullGCPtr<PromiseCapability> capability, RemainingElements& remaining_elements, Object& prototype)
diff --git a/Userland/Libraries/LibJS/Runtime/PromiseResolvingFunction.cpp b/Userland/Libraries/LibJS/Runtime/PromiseResolvingFunction.cpp
index fe0b4d9cb9..c79e9e1f3b 100644
--- a/Userland/Libraries/LibJS/Runtime/PromiseResolvingFunction.cpp
+++ b/Userland/Libraries/LibJS/Runtime/PromiseResolvingFunction.cpp
@@ -13,7 +13,7 @@ namespace JS {
NonnullGCPtr<PromiseResolvingFunction> PromiseResolvingFunction::create(Realm& realm, Promise& promise, AlreadyResolved& already_resolved, FunctionType function)
{
- return *realm.heap().allocate<PromiseResolvingFunction>(realm, promise, already_resolved, move(function), *realm.intrinsics().function_prototype());
+ return realm.heap().allocate<PromiseResolvingFunction>(realm, promise, already_resolved, move(function), *realm.intrinsics().function_prototype());
}
PromiseResolvingFunction::PromiseResolvingFunction(Promise& promise, AlreadyResolved& already_resolved, FunctionType native_function, Object& prototype)
diff --git a/Userland/Libraries/LibJS/Runtime/ProxyObject.cpp b/Userland/Libraries/LibJS/Runtime/ProxyObject.cpp
index c8e79102af..e25197715a 100644
--- a/Userland/Libraries/LibJS/Runtime/ProxyObject.cpp
+++ b/Userland/Libraries/LibJS/Runtime/ProxyObject.cpp
@@ -17,7 +17,7 @@ namespace JS {
NonnullGCPtr<ProxyObject> ProxyObject::create(Realm& realm, Object& target, Object& handler)
{
- return *realm.heap().allocate<ProxyObject>(realm, target, handler, *realm.intrinsics().object_prototype());
+ return realm.heap().allocate<ProxyObject>(realm, target, handler, *realm.intrinsics().object_prototype());
}
ProxyObject::ProxyObject(Object& target, Object& handler, Object& prototype)
diff --git a/Userland/Libraries/LibJS/Runtime/Realm.cpp b/Userland/Libraries/LibJS/Runtime/Realm.cpp
index ff7206219f..a75aec04e4 100644
--- a/Userland/Libraries/LibJS/Runtime/Realm.cpp
+++ b/Userland/Libraries/LibJS/Runtime/Realm.cpp
@@ -18,7 +18,7 @@ namespace JS {
NonnullGCPtr<Realm> Realm::create(VM& vm)
{
// 1. Let realmRec be a new Realm Record.
- auto* realm = vm.heap().allocate_without_realm<Realm>();
+ auto realm = vm.heap().allocate_without_realm<Realm>();
// 2. Perform CreateIntrinsics(realmRec).
Intrinsics::create(*realm);
@@ -28,7 +28,7 @@ NonnullGCPtr<Realm> Realm::create(VM& vm)
// 5. Set realmRec.[[TemplateMap]] to a new empty List.
// 6. Return realmRec.
- return *realm;
+ return realm;
}
// 9.6 InitializeHostDefinedRealm ( ), https://tc39.es/ecma262/#sec-initializehostdefinedrealm
diff --git a/Userland/Libraries/LibJS/Runtime/RegExpObject.cpp b/Userland/Libraries/LibJS/Runtime/RegExpObject.cpp
index 7c0f49e25a..041de097ca 100644
--- a/Userland/Libraries/LibJS/Runtime/RegExpObject.cpp
+++ b/Userland/Libraries/LibJS/Runtime/RegExpObject.cpp
@@ -126,12 +126,12 @@ ThrowCompletionOr<DeprecatedString> parse_regex_pattern(VM& vm, StringView patte
NonnullGCPtr<RegExpObject> RegExpObject::create(Realm& realm)
{
- return *realm.heap().allocate<RegExpObject>(realm, *realm.intrinsics().regexp_prototype());
+ return realm.heap().allocate<RegExpObject>(realm, *realm.intrinsics().regexp_prototype());
}
NonnullGCPtr<RegExpObject> RegExpObject::create(Realm& realm, Regex<ECMA262> regex, DeprecatedString pattern, DeprecatedString flags)
{
- return *realm.heap().allocate<RegExpObject>(realm, move(regex), move(pattern), move(flags), *realm.intrinsics().regexp_prototype());
+ return realm.heap().allocate<RegExpObject>(realm, move(regex), move(pattern), move(flags), *realm.intrinsics().regexp_prototype());
}
RegExpObject::RegExpObject(Object& prototype)
diff --git a/Userland/Libraries/LibJS/Runtime/RegExpStringIterator.cpp b/Userland/Libraries/LibJS/Runtime/RegExpStringIterator.cpp
index 284462e69f..0419110055 100644
--- a/Userland/Libraries/LibJS/Runtime/RegExpStringIterator.cpp
+++ b/Userland/Libraries/LibJS/Runtime/RegExpStringIterator.cpp
@@ -12,7 +12,7 @@ namespace JS {
// 22.2.7.1 CreateRegExpStringIterator ( R, S, global, fullUnicode ), https://tc39.es/ecma262/#sec-createregexpstringiterator
NonnullGCPtr<RegExpStringIterator> RegExpStringIterator::create(Realm& realm, Object& regexp_object, Utf16String string, bool global, bool unicode)
{
- return *realm.heap().allocate<RegExpStringIterator>(realm, *realm.intrinsics().regexp_string_iterator_prototype(), regexp_object, move(string), global, unicode);
+ return realm.heap().allocate<RegExpStringIterator>(realm, *realm.intrinsics().regexp_string_iterator_prototype(), regexp_object, move(string), global, unicode);
}
RegExpStringIterator::RegExpStringIterator(Object& prototype, Object& regexp_object, Utf16String string, bool global, bool unicode)
diff --git a/Userland/Libraries/LibJS/Runtime/Set.cpp b/Userland/Libraries/LibJS/Runtime/Set.cpp
index 9a6dec409b..4f1966dc2c 100644
--- a/Userland/Libraries/LibJS/Runtime/Set.cpp
+++ b/Userland/Libraries/LibJS/Runtime/Set.cpp
@@ -10,7 +10,7 @@ namespace JS {
NonnullGCPtr<Set> Set::create(Realm& realm)
{
- return *realm.heap().allocate<Set>(realm, *realm.intrinsics().set_prototype());
+ return realm.heap().allocate<Set>(realm, *realm.intrinsics().set_prototype());
}
Set::Set(Object& prototype)
diff --git a/Userland/Libraries/LibJS/Runtime/SetIterator.cpp b/Userland/Libraries/LibJS/Runtime/SetIterator.cpp
index c951e67d5b..f75f17e626 100644
--- a/Userland/Libraries/LibJS/Runtime/SetIterator.cpp
+++ b/Userland/Libraries/LibJS/Runtime/SetIterator.cpp
@@ -11,7 +11,7 @@ namespace JS {
NonnullGCPtr<SetIterator> SetIterator::create(Realm& realm, Set& set, Object::PropertyKind iteration_kind)
{
- return *realm.heap().allocate<SetIterator>(realm, set, iteration_kind, *realm.intrinsics().set_iterator_prototype());
+ return realm.heap().allocate<SetIterator>(realm, set, iteration_kind, *realm.intrinsics().set_iterator_prototype());
}
SetIterator::SetIterator(Set& set, Object::PropertyKind iteration_kind, Object& prototype)
diff --git a/Userland/Libraries/LibJS/Runtime/Shape.cpp b/Userland/Libraries/LibJS/Runtime/Shape.cpp
index a4243d4a29..11423b931d 100644
--- a/Userland/Libraries/LibJS/Runtime/Shape.cpp
+++ b/Userland/Libraries/LibJS/Runtime/Shape.cpp
@@ -12,7 +12,7 @@ namespace JS {
Shape* Shape::create_unique_clone() const
{
- auto* new_shape = heap().allocate_without_realm<Shape>(m_realm);
+ auto new_shape = heap().allocate_without_realm<Shape>(m_realm);
new_shape->m_unique = true;
new_shape->m_prototype = m_prototype;
ensure_property_table();
@@ -57,10 +57,10 @@ Shape* Shape::create_put_transition(StringOrSymbol const& property_key, Property
TransitionKey key { property_key, attributes };
if (auto* existing_shape = get_or_prune_cached_forward_transition(key))
return existing_shape;
- auto* new_shape = heap().allocate_without_realm<Shape>(*this, property_key, attributes, TransitionType::Put);
+ auto new_shape = heap().allocate_without_realm<Shape>(*this, property_key, attributes, TransitionType::Put);
if (!m_forward_transitions)
m_forward_transitions = make<HashMap<TransitionKey, WeakPtr<Shape>>>();
- m_forward_transitions->set(key, new_shape);
+ m_forward_transitions->set(key, new_shape.ptr());
return new_shape;
}
@@ -69,10 +69,10 @@ Shape* Shape::create_configure_transition(StringOrSymbol const& property_key, Pr
TransitionKey key { property_key, attributes };
if (auto* existing_shape = get_or_prune_cached_forward_transition(key))
return existing_shape;
- auto* new_shape = heap().allocate_without_realm<Shape>(*this, property_key, attributes, TransitionType::Configure);
+ auto new_shape = heap().allocate_without_realm<Shape>(*this, property_key, attributes, TransitionType::Configure);
if (!m_forward_transitions)
m_forward_transitions = make<HashMap<TransitionKey, WeakPtr<Shape>>>();
- m_forward_transitions->set(key, new_shape);
+ m_forward_transitions->set(key, new_shape.ptr());
return new_shape;
}
@@ -80,10 +80,10 @@ Shape* Shape::create_prototype_transition(Object* new_prototype)
{
if (auto* existing_shape = get_or_prune_cached_prototype_transition(new_prototype))
return existing_shape;
- auto* new_shape = heap().allocate_without_realm<Shape>(*this, new_prototype);
+ auto new_shape = heap().allocate_without_realm<Shape>(*this, new_prototype);
if (!m_prototype_transitions)
m_prototype_transitions = make<HashMap<Object*, WeakPtr<Shape>>>();
- m_prototype_transitions->set(new_prototype, new_shape);
+ m_prototype_transitions->set(new_prototype, new_shape.ptr());
return new_shape;
}
diff --git a/Userland/Libraries/LibJS/Runtime/StringIterator.cpp b/Userland/Libraries/LibJS/Runtime/StringIterator.cpp
index 6d8255976d..5b3a92131d 100644
--- a/Userland/Libraries/LibJS/Runtime/StringIterator.cpp
+++ b/Userland/Libraries/LibJS/Runtime/StringIterator.cpp
@@ -12,7 +12,7 @@ namespace JS {
NonnullGCPtr<StringIterator> StringIterator::create(Realm& realm, DeprecatedString string)
{
- return *realm.heap().allocate<StringIterator>(realm, move(string), *realm.intrinsics().string_iterator_prototype());
+ return realm.heap().allocate<StringIterator>(realm, move(string), *realm.intrinsics().string_iterator_prototype());
}
StringIterator::StringIterator(DeprecatedString string, Object& prototype)
diff --git a/Userland/Libraries/LibJS/Runtime/StringObject.cpp b/Userland/Libraries/LibJS/Runtime/StringObject.cpp
index 1c451d7446..51da264983 100644
--- a/Userland/Libraries/LibJS/Runtime/StringObject.cpp
+++ b/Userland/Libraries/LibJS/Runtime/StringObject.cpp
@@ -17,7 +17,7 @@ namespace JS {
// 10.4.3.4 StringCreate ( value, prototype ), https://tc39.es/ecma262/#sec-stringcreate
NonnullGCPtr<StringObject> StringObject::create(Realm& realm, PrimitiveString& primitive_string, Object& prototype)
{
- return *realm.heap().allocate<StringObject>(realm, primitive_string, prototype);
+ return realm.heap().allocate<StringObject>(realm, primitive_string, prototype);
}
StringObject::StringObject(PrimitiveString& string, Object& prototype)
diff --git a/Userland/Libraries/LibJS/Runtime/Symbol.cpp b/Userland/Libraries/LibJS/Runtime/Symbol.cpp
index 9dd6b3f237..eabb625b24 100644
--- a/Userland/Libraries/LibJS/Runtime/Symbol.cpp
+++ b/Userland/Libraries/LibJS/Runtime/Symbol.cpp
@@ -19,7 +19,7 @@ Symbol::Symbol(Optional<DeprecatedString> description, bool is_global)
NonnullGCPtr<Symbol> Symbol::create(VM& vm, Optional<DeprecatedString> description, bool is_global)
{
- return *vm.heap().allocate_without_realm<Symbol>(move(description), is_global);
+ return vm.heap().allocate_without_realm<Symbol>(move(description), is_global);
}
}
diff --git a/Userland/Libraries/LibJS/Runtime/SymbolObject.cpp b/Userland/Libraries/LibJS/Runtime/SymbolObject.cpp
index 8426020955..b59a83401b 100644
--- a/Userland/Libraries/LibJS/Runtime/SymbolObject.cpp
+++ b/Userland/Libraries/LibJS/Runtime/SymbolObject.cpp
@@ -12,7 +12,7 @@ namespace JS {
NonnullGCPtr<SymbolObject> SymbolObject::create(Realm& realm, Symbol& primitive_symbol)
{
- return *realm.heap().allocate<SymbolObject>(realm, primitive_symbol, *realm.intrinsics().symbol_prototype());
+ return realm.heap().allocate<SymbolObject>(realm, primitive_symbol, *realm.intrinsics().symbol_prototype());
}
SymbolObject::SymbolObject(Symbol& symbol, Object& prototype)
diff --git a/Userland/Libraries/LibJS/Runtime/TypedArray.cpp b/Userland/Libraries/LibJS/Runtime/TypedArray.cpp
index 42746970de..d5e327f31c 100644
--- a/Userland/Libraries/LibJS/Runtime/TypedArray.cpp
+++ b/Userland/Libraries/LibJS/Runtime/TypedArray.cpp
@@ -425,7 +425,7 @@ void TypedArrayBase::visit_edges(Visitor& visitor)
{ \
auto* prototype = TRY(get_prototype_from_constructor(realm.vm(), new_target, &Intrinsics::snake_name##_prototype)); \
auto array_buffer = TRY(ArrayBuffer::create(realm, length * sizeof(UnderlyingBufferDataType))); \
- return NonnullGCPtr { *realm.heap().allocate<ClassName>(realm, *prototype, length, *array_buffer) }; \
+ return realm.heap().allocate<ClassName>(realm, *prototype, length, *array_buffer); \
} \
\
ThrowCompletionOr<NonnullGCPtr<ClassName>> ClassName::create(Realm& realm, u32 length) \
@@ -436,7 +436,7 @@ void TypedArrayBase::visit_edges(Visitor& visitor)
\
NonnullGCPtr<ClassName> ClassName::create(Realm& realm, u32 length, ArrayBuffer& array_buffer) \
{ \
- return *realm.heap().allocate<ClassName>(realm, *realm.intrinsics().snake_name##_prototype(), length, array_buffer); \
+ return realm.heap().allocate<ClassName>(realm, *realm.intrinsics().snake_name##_prototype(), length, array_buffer); \
} \
\
ClassName::ClassName(Object& prototype, u32 length, ArrayBuffer& array_buffer) \
diff --git a/Userland/Libraries/LibJS/Runtime/WeakMap.cpp b/Userland/Libraries/LibJS/Runtime/WeakMap.cpp
index eb5e0bd906..8bcb04ade3 100644
--- a/Userland/Libraries/LibJS/Runtime/WeakMap.cpp
+++ b/Userland/Libraries/LibJS/Runtime/WeakMap.cpp
@@ -10,7 +10,7 @@ namespace JS {
NonnullGCPtr<WeakMap> WeakMap::create(Realm& realm)
{
- return *realm.heap().allocate<WeakMap>(realm, *realm.intrinsics().weak_map_prototype());
+ return realm.heap().allocate<WeakMap>(realm, *realm.intrinsics().weak_map_prototype());
}
WeakMap::WeakMap(Object& prototype)
diff --git a/Userland/Libraries/LibJS/Runtime/WeakRef.cpp b/Userland/Libraries/LibJS/Runtime/WeakRef.cpp
index 546f58bbf2..9f80170eb5 100644
--- a/Userland/Libraries/LibJS/Runtime/WeakRef.cpp
+++ b/Userland/Libraries/LibJS/Runtime/WeakRef.cpp
@@ -10,12 +10,12 @@ namespace JS {
NonnullGCPtr<WeakRef> WeakRef::create(Realm& realm, Object& value)
{
- return *realm.heap().allocate<WeakRef>(realm, value, *realm.intrinsics().weak_ref_prototype());
+ return realm.heap().allocate<WeakRef>(realm, value, *realm.intrinsics().weak_ref_prototype());
}
NonnullGCPtr<WeakRef> WeakRef::create(Realm& realm, Symbol& value)
{
- return *realm.heap().allocate<WeakRef>(realm, value, *realm.intrinsics().weak_ref_prototype());
+ return realm.heap().allocate<WeakRef>(realm, value, *realm.intrinsics().weak_ref_prototype());
}
WeakRef::WeakRef(Object& value, Object& prototype)
diff --git a/Userland/Libraries/LibJS/Runtime/WeakSet.cpp b/Userland/Libraries/LibJS/Runtime/WeakSet.cpp
index 89b1e9e0f2..ceaf10f6cf 100644
--- a/Userland/Libraries/LibJS/Runtime/WeakSet.cpp
+++ b/Userland/Libraries/LibJS/Runtime/WeakSet.cpp
@@ -10,7 +10,7 @@ namespace JS {
NonnullGCPtr<WeakSet> WeakSet::create(Realm& realm)
{
- return *realm.heap().allocate<WeakSet>(realm, *realm.intrinsics().weak_set_prototype());
+ return realm.heap().allocate<WeakSet>(realm, *realm.intrinsics().weak_set_prototype());
}
WeakSet::WeakSet(Object& prototype)
diff --git a/Userland/Libraries/LibJS/Runtime/WrappedFunction.cpp b/Userland/Libraries/LibJS/Runtime/WrappedFunction.cpp
index 3400c5a489..8c220ba39d 100644
--- a/Userland/Libraries/LibJS/Runtime/WrappedFunction.cpp
+++ b/Userland/Libraries/LibJS/Runtime/WrappedFunction.cpp
@@ -22,7 +22,7 @@ ThrowCompletionOr<NonnullGCPtr<WrappedFunction>> WrappedFunction::create(Realm&
// 5. Set wrapped.[[WrappedTargetFunction]] to Target.
// 6. Set wrapped.[[Realm]] to callerRealm.
auto& prototype = *caller_realm.intrinsics().function_prototype();
- auto* wrapped = vm.heap().allocate<WrappedFunction>(realm, caller_realm, target, prototype);
+ auto wrapped = vm.heap().allocate<WrappedFunction>(realm, caller_realm, target, prototype);
// 7. Let result be CopyNameAndLength(wrapped, Target).
auto result = copy_name_and_length(vm, *wrapped, target);
@@ -32,7 +32,7 @@ ThrowCompletionOr<NonnullGCPtr<WrappedFunction>> WrappedFunction::create(Realm&
return vm.throw_completion<TypeError>(ErrorType::WrappedFunctionCopyNameAndLengthThrowCompletion);
// 9. Return wrapped.
- return NonnullGCPtr { *wrapped };
+ return wrapped;
}
// 2 Wrapped Function Exotic Objects, https://tc39.es/proposal-shadowrealm/#sec-wrapped-function-exotic-objects
diff --git a/Userland/Libraries/LibJS/Script.cpp b/Userland/Libraries/LibJS/Script.cpp
index 80bb3193ce..56fa37807f 100644
--- a/Userland/Libraries/LibJS/Script.cpp
+++ b/Userland/Libraries/LibJS/Script.cpp
@@ -24,7 +24,7 @@ Result<NonnullGCPtr<Script>, Vector<ParserError>> Script::parse(StringView sourc
return parser.errors();
// 3. Return Script Record { [[Realm]]: realm, [[ECMAScriptCode]]: script, [[HostDefined]]: hostDefined }.
- return NonnullGCPtr(*realm.heap().allocate_without_realm<Script>(realm, filename, move(script), host_defined));
+ return realm.heap().allocate_without_realm<Script>(realm, filename, move(script), host_defined);
}
Script::Script(Realm& realm, StringView filename, NonnullRefPtr<Program> parse_node, HostDefined* host_defined)
diff --git a/Userland/Libraries/LibJS/SourceTextModule.cpp b/Userland/Libraries/LibJS/SourceTextModule.cpp
index 63b3addcaa..8e3f96e877 100644
--- a/Userland/Libraries/LibJS/SourceTextModule.cpp
+++ b/Userland/Libraries/LibJS/SourceTextModule.cpp
@@ -244,7 +244,7 @@ Result<NonnullGCPtr<SourceTextModule>, Vector<ParserError>> SourceTextModule::pa
// [[HostDefined]]: hostDefined, [[ECMAScriptCode]]: body, [[Context]]: empty, [[ImportMeta]]: empty,
// [[RequestedModules]]: requestedModules, [[ImportEntries]]: importEntries, [[LocalExportEntries]]: localExportEntries,
// [[IndirectExportEntries]]: indirectExportEntries, [[StarExportEntries]]: starExportEntries, [[DFSIndex]]: empty, [[DFSAncestorIndex]]: empty }.
- return NonnullGCPtr(*realm.heap().allocate_without_realm<SourceTextModule>(
+ return realm.heap().allocate_without_realm<SourceTextModule>(
realm,
filename,
host_defined,
@@ -255,7 +255,7 @@ Result<NonnullGCPtr<SourceTextModule>, Vector<ParserError>> SourceTextModule::pa
move(local_export_entries),
move(indirect_export_entries),
move(star_export_entries),
- move(default_export)));
+ move(default_export));
}
// 16.2.1.6.2 GetExportedNames ( [ exportStarSet ] ), https://tc39.es/ecma262/#sec-getexportednames
@@ -347,7 +347,7 @@ ThrowCompletionOr<void> SourceTextModule::initialize_environment(VM& vm)
// Note: This must be true because we use a reference.
// 5. Let env be NewModuleEnvironment(realm.[[GlobalEnv]]).
- auto* environment = vm.heap().allocate_without_realm<ModuleEnvironment>(&realm().global_environment());
+ auto environment = vm.heap().allocate_without_realm<ModuleEnvironment>(&realm().global_environment());
// 6. Set module.[[Environment]] to env.
set_environment(environment);
diff --git a/Userland/Libraries/LibJS/SyntheticModule.cpp b/Userland/Libraries/LibJS/SyntheticModule.cpp
index c9802a25a6..eb0fdbfeaa 100644
--- a/Userland/Libraries/LibJS/SyntheticModule.cpp
+++ b/Userland/Libraries/LibJS/SyntheticModule.cpp
@@ -51,7 +51,7 @@ ThrowCompletionOr<void> SyntheticModule::link(VM& vm)
// Note: This must be true because we use a reference.
// 3. Let env be NewModuleEnvironment(realm.[[GlobalEnv]]).
- auto* environment = vm.heap().allocate_without_realm<ModuleEnvironment>(&realm().global_environment());
+ auto environment = vm.heap().allocate_without_realm<ModuleEnvironment>(&realm().global_environment());
// 4. Set module.[[Environment]] to env.
set_environment(environment);
@@ -139,7 +139,7 @@ NonnullGCPtr<SyntheticModule> SyntheticModule::create_default_export_synthetic_m
};
// 2. Return CreateSyntheticModule("default", closure, realm)
- return *realm.heap().allocate_without_realm<SyntheticModule>(Vector<FlyString> { "default" }, move(closure), realm, filename);
+ return realm.heap().allocate_without_realm<SyntheticModule>(Vector<FlyString> { "default" }, move(closure), realm, filename);
}
// 1.4 ParseJSONModule ( source ), https://tc39.es/proposal-json-modules/#sec-parse-json-module
diff --git a/Userland/Libraries/LibWeb/Bindings/Intrinsics.h b/Userland/Libraries/LibWeb/Bindings/Intrinsics.h
index e1f23779d2..610100c185 100644
--- a/Userland/Libraries/LibWeb/Bindings/Intrinsics.h
+++ b/Userland/Libraries/LibWeb/Bindings/Intrinsics.h
@@ -34,9 +34,9 @@ public:
if (it != m_prototypes.end())
return *it->value;
auto& realm = *m_realm;
- auto* prototype = heap().allocate<T>(realm, realm);
+ auto prototype = heap().allocate<T>(realm, realm);
m_prototypes.set(class_name, prototype);
- return *prototype;
+ return prototype;
}
template<typename T>
@@ -46,9 +46,9 @@ public:
if (it != m_constructors.end())
return *it->value;
auto& realm = *m_realm;
- auto* constructor = heap().allocate<T>(realm, realm);
+ auto constructor = heap().allocate<T>(realm, realm);
m_constructors.set(class_name, constructor);
- return *constructor;
+ return constructor;
}
private:
diff --git a/Userland/Libraries/LibWeb/Bindings/MainThreadVM.cpp b/Userland/Libraries/LibWeb/Bindings/MainThreadVM.cpp
index e719d17b3e..f4aca506d4 100644
--- a/Userland/Libraries/LibWeb/Bindings/MainThreadVM.cpp
+++ b/Userland/Libraries/LibWeb/Bindings/MainThreadVM.cpp
@@ -375,8 +375,8 @@ 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 host_defined = make<HostDefined>(nullptr, *intrinsics);
+ auto intrinsics = root_realm->heap().allocate<Intrinsics>(*root_realm, *root_realm);
+ auto host_defined = make<HostDefined>(nullptr, intrinsics);
root_realm->set_host_defined(move(host_defined));
custom_data.internal_realm = root_realm;
diff --git a/Userland/Libraries/LibWeb/CSS/CSSRuleList.cpp b/Userland/Libraries/LibWeb/CSS/CSSRuleList.cpp
index 55f8631a87..e6a8e2f1e0 100644
--- a/Userland/Libraries/LibWeb/CSS/CSSRuleList.cpp
+++ b/Userland/Libraries/LibWeb/CSS/CSSRuleList.cpp
@@ -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);
for (auto* rule : rules)
rule_list->m_rules.append(*rule);
return rule_list;
diff --git a/Userland/Libraries/LibWeb/CSS/MediaQueryList.cpp b/Userland/Libraries/LibWeb/CSS/MediaQueryList.cpp
index b6afd4f2c0..91b2d64c70 100644
--- a/Userland/Libraries/LibWeb/CSS/MediaQueryList.cpp
+++ b/Userland/Libraries/LibWeb/CSS/MediaQueryList.cpp
@@ -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));
}
MediaQueryList::MediaQueryList(DOM::Document& document, NonnullRefPtrVector<MediaQuery>&& media)
diff --git a/Userland/Libraries/LibWeb/CSS/Screen.cpp b/Userland/Libraries/LibWeb/CSS/Screen.cpp
index b066b744c7..15762d036b 100644
--- a/Userland/Libraries/LibWeb/CSS/Screen.cpp
+++ b/Userland/Libraries/LibWeb/CSS/Screen.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021, Linus Groh <linusg@serenityos.org>
+ * Copyright (c) 2021-2022, Linus Groh <linusg@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
@@ -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);
}
Screen::Screen(HTML::Window& window)
diff --git a/Userland/Libraries/LibWeb/Crypto/Crypto.cpp b/Userland/Libraries/LibWeb/Crypto/Crypto.cpp
index 3f41847065..61dde15e80 100644
--- a/Userland/Libraries/LibWeb/Crypto/Crypto.cpp
+++ b/Userland/Libraries/LibWeb/Crypto/Crypto.cpp
@@ -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);
}
Crypto::Crypto(JS::Realm& realm)
diff --git a/Userland/Libraries/LibWeb/Crypto/SubtleCrypto.cpp b/Userland/Libraries/LibWeb/Crypto/SubtleCrypto.cpp
index ef0f18e829..077e48ec83 100644
--- a/Userland/Libraries/LibWeb/Crypto/SubtleCrypto.cpp
+++ b/Userland/Libraries/LibWeb/Crypto/SubtleCrypto.cpp
@@ -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);
}
SubtleCrypto::SubtleCrypto(JS::Realm& realm)
diff --git a/Userland/Libraries/LibWeb/DOM/AbortController.cpp b/Userland/Libraries/LibWeb/DOM/AbortController.cpp
index 57b2c0c7e2..9764c1586e 100644
--- a/Userland/Libraries/LibWeb/DOM/AbortController.cpp
+++ b/Userland/Libraries/LibWeb/DOM/AbortController.cpp
@@ -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));
}
// https://dom.spec.whatwg.org/#dom-abortcontroller-abortcontroller
diff --git a/Userland/Libraries/LibWeb/DOM/AbortSignal.cpp b/Userland/Libraries/LibWeb/DOM/AbortSignal.cpp
index c4199cf7fa..24e89a4275 100644
--- a/Userland/Libraries/LibWeb/DOM/AbortSignal.cpp
+++ b/Userland/Libraries/LibWeb/DOM/AbortSignal.cpp
@@ -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);
}
AbortSignal::AbortSignal(JS::Realm& realm)
diff --git a/Userland/Libraries/LibWeb/DOM/Attr.cpp b/Userland/Libraries/LibWeb/DOM/Attr.cpp
index 7ff4ee8dd6..4d6075b026 100644
--- a/Userland/Libraries/LibWeb/DOM/Attr.cpp
+++ b/Userland/Libraries/LibWeb/DOM/Attr.cpp
@@ -15,7 +15,7 @@ namespace Web::DOM {
JS::NonnullGCPtr<Attr> Attr::create(Document& document, FlyString 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);
}
JS::NonnullGCPtr<Attr> Attr::clone(Document& document)
diff --git a/Userland/Libraries/LibWeb/DOM/Comment.cpp b/Userland/Libraries/LibWeb/DOM/Comment.cpp
index c25c96e969..b38a2dbfba 100644
--- a/Userland/Libraries/LibWeb/DOM/Comment.cpp
+++ b/Userland/Libraries/LibWeb/DOM/Comment.cpp
@@ -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);
}
}
diff --git a/Userland/Libraries/LibWeb/DOM/DOMImplementation.cpp b/Userland/Libraries/LibWeb/DOM/DOMImplementation.cpp
index 0f3b0b3ff5..71f0df6967 100644
--- a/Userland/Libraries/LibWeb/DOM/DOMImplementation.cpp
+++ b/Userland/Libraries/LibWeb/DOM/DOMImplementation.cpp
@@ -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);
}
DOMImplementation::DOMImplementation(Document& document)
diff --git a/Userland/Libraries/LibWeb/DOM/Document.cpp b/Userland/Libraries/LibWeb/DOM/Document.cpp
index bc08f546bd..3f5dd2ac91 100644
--- a/Userland/Libraries/LibWeb/DOM/Document.cpp
+++ b/Userland/Libraries/LibWeb/DOM/Document.cpp
@@ -289,7 +289,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);
}
Document::Document(JS::Realm& realm, const AK::URL& url)
@@ -680,7 +680,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)));
if (auto* page = this->page()) {
if (browsing_context() == &page->top_level_browsing_context())
@@ -1221,17 +1221,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);
}
JS::NonnullGCPtr<Text> Document::create_text_node(DeprecatedString const& data)
{
- return *heap().allocate<Text>(realm(), *this, data);
+ return heap().allocate<Text>(realm(), *this, data);
}
JS::NonnullGCPtr<Comment> Document::create_comment(DeprecatedString const& data)
{
- return *heap().allocate<Comment>(realm(), *this, data);
+ return heap().allocate<Comment>(realm(), *this, data);
}
// https://dom.spec.whatwg.org/#dom-document-createprocessinginstruction
diff --git a/Userland/Libraries/LibWeb/DOM/DocumentFragment.cpp b/Userland/Libraries/LibWeb/DOM/DocumentFragment.cpp
index beaac1d61a..2f9c183568 100644
--- a/Userland/Libraries/LibWeb/DOM/DocumentFragment.cpp
+++ b/Userland/Libraries/LibWeb/DOM/DocumentFragment.cpp
@@ -30,7 +30,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());
}
}
diff --git a/Userland/Libraries/LibWeb/DOM/DocumentType.cpp b/Userland/Libraries/LibWeb/DOM/DocumentType.cpp
index f5620412a5..cf2310c85d 100644
--- a/Userland/Libraries/LibWeb/DOM/DocumentType.cpp
+++ b/Userland/Libraries/LibWeb/DOM/DocumentType.cpp
@@ -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);
}
DocumentType::DocumentType(Document& document)
diff --git a/Userland/Libraries/LibWeb/DOM/Element.cpp b/Userland/Libraries/LibWeb/DOM/Element.cpp
index 0579c1e14d..54e136072c 100644
--- a/Userland/Libraries/LibWeb/DOM/Element.cpp
+++ b/Userland/Libraries/LibWeb/DOM/Element.cpp
@@ -1174,11 +1174,11 @@ 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.
- JS::NonnullGCPtr<Text> text = *heap().allocate<DOM::Text>(realm(), document(), data);
+ auto text = 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.
- (void)TRY(insert_adjacent(where, move(text)));
+ (void)TRY(insert_adjacent(where, text));
return {};
}
diff --git a/Userland/Libraries/LibWeb/DOM/ElementFactory.cpp b/Userland/Libraries/LibWeb/DOM/ElementFactory.cpp
index 72281d0c51..617d24f8aa 100644
--- a/Userland/Libraries/LibWeb/DOM/ElementFactory.cpp
+++ b/Userland/Libraries/LibWeb/DOM/ElementFactory.cpp
@@ -120,180 +120,180 @@ JS::NonnullGCPtr<Element> create_element(Document& document, FlyString local_nam
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));
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));
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));
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));
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));
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));
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));
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));
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));
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));
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));
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));
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));
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));
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));
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));
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));
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));
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));
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));
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));
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));
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));
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));
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));
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));
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));
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));
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));
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));
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));
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));
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));
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));
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));
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));
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));
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));
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));
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));
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));
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));
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));
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));
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));
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));
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));
// 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));
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));
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));
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));
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));
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));
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));
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));
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));
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));
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));
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));
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));
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));
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));
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));
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));
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));
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));
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));
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));
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));
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));
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));
// 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));
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));
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));
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));
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));
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));
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));
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));
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));
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));
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));
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));
// 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));
}
}
diff --git a/Userland/Libraries/LibWeb/DOM/Event.cpp b/Userland/Libraries/LibWeb/DOM/Event.cpp
index 635a0a6de8..752f1ec0bb 100644
--- a/Userland/Libraries/LibWeb/DOM/Event.cpp
+++ b/Userland/Libraries/LibWeb/DOM/Event.cpp
@@ -16,7 +16,7 @@ namespace Web::DOM {
JS::NonnullGCPtr<Event> Event::create(JS::Realm& realm, FlyString 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);
}
JS::NonnullGCPtr<Event> Event::construct_impl(JS::Realm& realm, FlyString const& event_name, EventInit const& event_init)
diff --git a/Userland/Libraries/LibWeb/DOM/EventTarget.cpp b/Userland/Libraries/LibWeb/DOM/EventTarget.cpp
index cffa67e03c..6eb41e5bc3 100644
--- a/Userland/Libraries/LibWeb/DOM/EventTarget.cpp
+++ b/Userland/Libraries/LibWeb/DOM/EventTarget.cpp
@@ -128,7 +128,7 @@ void EventTarget::add_event_listener(FlyString const& type, IDLEventListener* ca
// 2. Add an event listener with this and an event listener whose type is type, callback is callback, capture is capture, passive is passive,
// once is once, and signal is signal.
- auto* event_listener = heap().allocate_without_realm<DOMEventListener>();
+ auto event_listener = heap().allocate_without_realm<DOMEventListener>();
event_listener->type = type;
event_listener->callback = callback;
event_listener->signal = move(flattened_options.signal);
@@ -464,7 +464,7 @@ WebIDL::CallbackType* EventTarget::get_current_value_of_event_handler(FlyString
function->set_script_or_module({});
// 12. Set eventHandler's value to the result of creating a Web IDL EventHandler callback function object whose object reference is function and whose callback context is settings object.
- event_handler->value = realm.heap().allocate_without_realm<WebIDL::CallbackType>(*function, settings_object);
+ event_handler->value = realm.heap().allocate_without_realm<WebIDL::CallbackType>(*function, settings_object).ptr();
}
// 4. Return eventHandler's value.
@@ -498,7 +498,7 @@ void EventTarget::set_event_handler_attribute(FlyString const& name, WebIDL::Cal
// 3. Set eventHandler's value to the given value.
if (event_handler_iterator == handler_map.end()) {
// NOTE: See the optimization comment in get_current_value_of_event_handler about why this is done.
- auto* new_event_handler = heap().allocate_without_realm<HTML::EventHandler>(*value);
+ auto new_event_handler = heap().allocate_without_realm<HTML::EventHandler>(*value);
// 4. Activate an event handler given eventTarget and name.
// Optimization: We pass in the event handler here instead of having activate_event_handler do another hash map lookup just to get the same object.
@@ -556,10 +556,10 @@ void EventTarget::activate_event_handler(FlyString const& name, HTML::EventHandl
0, "", &realm);
// NOTE: As per the spec, the callback context is arbitrary.
- auto* callback = realm.heap().allocate_without_realm<WebIDL::CallbackType>(*callback_function, Bindings::host_defined_environment_settings_object(realm));
+ auto callback = realm.heap().allocate_without_realm<WebIDL::CallbackType>(*callback_function, Bindings::host_defined_environment_settings_object(realm));
// 5. Let listener be a new event listener whose type is the event handler event type corresponding to eventHandler and callback is callback.
- auto* listener = realm.heap().allocate_without_realm<DOMEventListener>();
+ auto listener = realm.heap().allocate_without_realm<DOMEventListener>();
listener->type = name;
listener->callback = IDLEventListener::create(realm, *callback).ptr();
@@ -714,7 +714,7 @@ void EventTarget::element_event_handler_attribute_changed(FlyString const& local
// NOTE: See the optimization comments in set_event_handler_attribute.
if (event_handler_iterator == handler_map.end()) {
- auto* new_event_handler = heap().allocate_without_realm<HTML::EventHandler>(value);
+ auto new_event_handler = heap().allocate_without_realm<HTML::EventHandler>(value);
// 6. Activate an event handler given eventTarget and name.
event_target->activate_event_handler(local_name, *new_event_handler);
diff --git a/Userland/Libraries/LibWeb/DOM/HTMLCollection.cpp b/Userland/Libraries/LibWeb/DOM/HTMLCollection.cpp
index 550e946e6e..59b05d09ce 100644
--- a/Userland/Libraries/LibWeb/DOM/HTMLCollection.cpp
+++ b/Userland/Libraries/LibWeb/DOM/HTMLCollection.cpp
@@ -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));
}
HTMLCollection::HTMLCollection(ParentNode& root, Function<bool(Element const&)> filter)
diff --git a/Userland/Libraries/LibWeb/DOM/IDLEventListener.cpp b/Userland/Libraries/LibWeb/DOM/IDLEventListener.cpp
index dd392d90f6..57c2362c74 100644
--- a/Userland/Libraries/LibWeb/DOM/IDLEventListener.cpp
+++ b/Userland/Libraries/LibWeb/DOM/IDLEventListener.cpp
@@ -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));
}
IDLEventListener::IDLEventListener(JS::Realm& realm, JS::NonnullGCPtr<WebIDL::CallbackType> callback)
diff --git a/Userland/Libraries/LibWeb/DOM/LiveNodeList.cpp b/Userland/Libraries/LibWeb/DOM/LiveNodeList.cpp
index c0b5ea5478..28c7a591a0 100644
--- a/Userland/Libraries/LibWeb/DOM/LiveNodeList.cpp
+++ b/Userland/Libraries/LibWeb/DOM/LiveNodeList.cpp
@@ -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));
}
LiveNodeList::LiveNodeList(JS::Realm& realm, Node& root, Function<bool(Node const&)> filter)
diff --git a/Userland/Libraries/LibWeb/DOM/MutationObserver.cpp b/Userland/Libraries/LibWeb/DOM/MutationObserver.cpp
index 6d05a282be..8d242f7227 100644
--- a/Userland/Libraries/LibWeb/DOM/MutationObserver.cpp
+++ b/Userland/Libraries/LibWeb/DOM/MutationObserver.cpp
@@ -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);
}
// https://dom.spec.whatwg.org/#dom-mutationobserver-mutationobserver
@@ -142,7 +142,7 @@ Vector<JS::Handle<MutationRecord>> MutationObserver::take_records()
JS::NonnullGCPtr<RegisteredObserver> RegisteredObserver::create(MutationObserver& observer, MutationObserverInit const& options)
{
- return *observer.heap().allocate_without_realm<RegisteredObserver>(observer, options);
+ return observer.heap().allocate_without_realm<RegisteredObserver>(observer, options);
}
RegisteredObserver::RegisteredObserver(MutationObserver& observer, MutationObserverInit const& options)
@@ -161,7 +161,7 @@ void RegisteredObserver::visit_edges(Cell::Visitor& visitor)
JS::NonnullGCPtr<TransientRegisteredObserver> TransientRegisteredObserver::create(MutationObserver& observer, MutationObserverInit const& options, RegisteredObserver& source)
{
- return *observer.heap().allocate_without_realm<TransientRegisteredObserver>(observer, options, source);
+ return observer.heap().allocate_without_realm<TransientRegisteredObserver>(observer, options, source);
}
TransientRegisteredObserver::TransientRegisteredObserver(MutationObserver& observer, MutationObserverInit const& options, RegisteredObserver& source)
diff --git a/Userland/Libraries/LibWeb/DOM/MutationRecord.cpp b/Userland/Libraries/LibWeb/DOM/MutationRecord.cpp
index be3a760580..7c280a9437 100644
--- a/Userland/Libraries/LibWeb/DOM/MutationRecord.cpp
+++ b/Userland/Libraries/LibWeb/DOM/MutationRecord.cpp
@@ -14,7 +14,7 @@ namespace Web::DOM {
JS::NonnullGCPtr<MutationRecord> MutationRecord::create(JS::Realm& realm, FlyString 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);
}
MutationRecord::MutationRecord(JS::Realm& realm, FlyString 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)
diff --git a/Userland/Libraries/LibWeb/DOM/NamedNodeMap.cpp b/Userland/Libraries/LibWeb/DOM/NamedNodeMap.cpp
index 6f4c9a37ca..5146580e19 100644
--- a/Userland/Libraries/LibWeb/DOM/NamedNodeMap.cpp
+++ b/Userland/Libraries/LibWeb/DOM/NamedNodeMap.cpp
@@ -15,7 +15,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);
}
NamedNodeMap::NamedNodeMap(Element& element)
diff --git a/Userland/Libraries/LibWeb/DOM/NodeFilter.cpp b/Userland/Libraries/LibWeb/DOM/NodeFilter.cpp
index 2ab9d17469..760e909bd0 100644
--- a/Userland/Libraries/LibWeb/DOM/NodeFilter.cpp
+++ b/Userland/Libraries/LibWeb/DOM/NodeFilter.cpp
@@ -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);
}
NodeFilter::NodeFilter(JS::Realm& realm, WebIDL::CallbackType& callback)
diff --git a/Userland/Libraries/LibWeb/DOM/NodeIterator.cpp b/Userland/Libraries/LibWeb/DOM/NodeIterator.cpp
index 8fd7264625..b9fbaa256f 100644
--- a/Userland/Libraries/LibWeb/DOM/NodeIterator.cpp
+++ b/Userland/Libraries/LibWeb/DOM/NodeIterator.cpp
@@ -45,7 +45,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);
// 4. Set iterator’s whatToShow to whatToShow.
iterator->m_what_to_show = what_to_show;
@@ -54,7 +54,7 @@ JS::NonnullGCPtr<NodeIterator> NodeIterator::create(Node& root, unsigned what_to
iterator->m_filter = filter;
// 6. Return iterator.
- return *iterator;
+ return iterator;
}
// https://dom.spec.whatwg.org/#dom-nodeiterator-detach
diff --git a/Userland/Libraries/LibWeb/DOM/NodeOperations.cpp b/Userland/Libraries/LibWeb/DOM/NodeOperations.cpp
index d7bbaac102..1ebd908e0b 100644
--- a/Userland/Libraries/LibWeb/DOM/NodeOperations.cpp
+++ b/Userland/Libraries/LibWeb/DOM/NodeOperations.cpp
@@ -26,14 +26,13 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<Node>> convert_nodes_to_single_node(Vector<
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 document.heap().allocate<DOM::Text>(document.realm(), document, node.get<DeprecatedString>());
};
if (nodes.size() == 1)
return potentially_convert_string_to_text_node(nodes.first());
- // This is NNGCP<Node> instead of NNGCP<DocumentFragment> to be compatible with the return type.
- JS::NonnullGCPtr<Node> document_fragment = *document.heap().allocate<DOM::DocumentFragment>(document.realm(), document);
+ auto document_fragment = document.heap().allocate<DOM::DocumentFragment>(document.realm(), document);
for (auto& unconverted_node : nodes) {
auto node = potentially_convert_string_to_text_node(unconverted_node);
(void)TRY(document_fragment->append_child(node));
diff --git a/Userland/Libraries/LibWeb/DOM/Range.cpp b/Userland/Libraries/LibWeb/DOM/Range.cpp
index 0d92932129..e7ffac96b0 100644
--- a/Userland/Libraries/LibWeb/DOM/Range.cpp
+++ b/Userland/Libraries/LibWeb/DOM/Range.cpp
@@ -34,13 +34,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);
}
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);
}
JS::NonnullGCPtr<Range> Range::construct_impl(JS::Realm& realm)
@@ -396,12 +396,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);
}
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);
}
JS::NonnullGCPtr<Range> Range::normalized() const
@@ -555,11 +555,11 @@ 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 = heap().allocate<DOM::DocumentFragment>(realm(), const_cast<Document&>(start_container()->document()));
// 2. If range is collapsed, then return fragment.
if (collapsed())
- return JS::NonnullGCPtr(*fragment);
+ return fragment;
// 3. Let original start node, original start offset, original end node, and original end offset
// be range’s start node, start offset, end node, and end offset, respectively.
@@ -585,7 +585,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<DocumentFragment>> Range::extract()
TRY(static_cast<CharacterData&>(*original_start_node).replace_data(original_start_offset, original_end_offset - original_start_offset, ""));
// 5. Return fragment.
- return JS::NonnullGCPtr(*fragment);
+ return fragment;
}
// 5. Let common ancestor be original start node.
@@ -735,7 +735,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<DocumentFragment>> Range::extract()
TRY(set_end(*new_node, new_offset));
// 21. Return fragment.
- return JS::NonnullGCPtr(*fragment);
+ return fragment;
}
// https://dom.spec.whatwg.org/#contained
@@ -884,11 +884,11 @@ 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 = heap().allocate<DOM::DocumentFragment>(realm(), const_cast<Document&>(start_container()->document()));
// 2. If range is collapsed, then return fragment.
if (collapsed())
- return JS::NonnullGCPtr(*fragment);
+ return fragment;
// 3. Let original start node, original start offset, original end node, and original end offset
// be range’s start node, start offset, end node, and end offset, respectively.
@@ -911,7 +911,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<DocumentFragment>> Range::clone_the_content
TRY(fragment->append_child(clone));
// 4. Return fragment.
- return JS::NonnullGCPtr(*fragment);
+ return fragment;
}
// 5. Let common ancestor be original start node.
@@ -1033,7 +1033,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<DocumentFragment>> Range::clone_the_content
}
// 18. Return fragment.
- return JS::NonnullGCPtr(*fragment);
+ return fragment;
}
// https://dom.spec.whatwg.org/#dom-range-deletecontents
diff --git a/Userland/Libraries/LibWeb/DOM/StaticNodeList.cpp b/Userland/Libraries/LibWeb/DOM/StaticNodeList.cpp
index 339ba80f2b..76e46ea362 100644
--- a/Userland/Libraries/LibWeb/DOM/StaticNodeList.cpp
+++ b/Userland/Libraries/LibWeb/DOM/StaticNodeList.cpp
@@ -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));
}
StaticNodeList::StaticNodeList(JS::Realm& realm, Vector<JS::Handle<Node>> static_nodes)
diff --git a/Userland/Libraries/LibWeb/DOM/StaticRange.cpp b/Userland/Libraries/LibWeb/DOM/StaticRange.cpp
index 7cd142ff73..45140d78d2 100644
--- a/Userland/Libraries/LibWeb/DOM/StaticRange.cpp
+++ b/Userland/Libraries/LibWeb/DOM/StaticRange.cpp
@@ -33,7 +33,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);
+ return realm.heap().allocate<StaticRange>(realm, *init.start_container, init.start_offset, *init.end_container, init.end_offset).ptr();
}
}
diff --git a/Userland/Libraries/LibWeb/DOM/Text.cpp b/Userland/Libraries/LibWeb/DOM/Text.cpp
index f6399176b1..9fb0967b52 100644
--- a/Userland/Libraries/LibWeb/DOM/Text.cpp
+++ b/Userland/Libraries/LibWeb/DOM/Text.cpp
@@ -37,7 +37,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);
}
void Text::set_owner_input_element(Badge<HTML::HTMLInputElement>, HTML::HTMLInputElement& input_element)
@@ -63,7 +63,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 = JS::NonnullGCPtr(*heap().allocate<Text>(realm(), document(), new_data));
+ auto new_node = heap().allocate<Text>(realm(), document(), new_data);
// 6. Let parent be node’s parent.
JS::GCPtr<Node> parent = this->parent();
diff --git a/Userland/Libraries/LibWeb/DOM/TreeWalker.cpp b/Userland/Libraries/LibWeb/DOM/TreeWalker.cpp
index 2711aab3dc..fbaa0245eb 100644
--- a/Userland/Libraries/LibWeb/DOM/TreeWalker.cpp
+++ b/Userland/Libraries/LibWeb/DOM/TreeWalker.cpp
@@ -36,7 +36,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);
// 3. Set walker’s whatToShow to whatToShow.
walker->m_what_to_show = what_to_show;
@@ -45,7 +45,7 @@ JS::NonnullGCPtr<TreeWalker> TreeWalker::create(Node& root, unsigned what_to_sho
walker->m_filter = filter;
// 5. Return walker.
- return *walker;
+ return walker;
}
// https://dom.spec.whatwg.org/#dom-treewalker-currentnode
diff --git a/Userland/Libraries/LibWeb/DOMParsing/InnerHTML.cpp b/Userland/Libraries/LibWeb/DOMParsing/InnerHTML.cpp
index 6a648f14c1..cefafb2d8f 100644
--- a/Userland/Libraries/LibWeb/DOMParsing/InnerHTML.cpp
+++ b/Userland/Libraries/LibWeb/DOMParsing/InnerHTML.cpp
@@ -28,7 +28,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<DOM::DocumentFragment>> parse_fragment(Depr
(void)TRY(fragment->append_child(*child));
}
- return JS::NonnullGCPtr(*fragment);
+ return fragment;
}
// https://w3c.github.io/DOM-Parsing/#dom-innerhtml-innerhtml
diff --git a/Userland/Libraries/LibWeb/DOMParsing/XMLSerializer.cpp b/Userland/Libraries/LibWeb/DOMParsing/XMLSerializer.cpp
index c72d5da40c..42f5d23ca0 100644
--- a/Userland/Libraries/LibWeb/DOMParsing/XMLSerializer.cpp
+++ b/Userland/Libraries/LibWeb/DOMParsing/XMLSerializer.cpp
@@ -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);
}
XMLSerializer::XMLSerializer(JS::Realm& realm)
diff --git a/Userland/Libraries/LibWeb/Encoding/TextDecoder.cpp b/Userland/Libraries/LibWeb/Encoding/TextDecoder.cpp
index 43c2e21642..bbcb29d462 100644
--- a/Userland/Libraries/LibWeb/Encoding/TextDecoder.cpp
+++ b/Userland/Libraries/LibWeb/Encoding/TextDecoder.cpp
@@ -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 JS::NonnullGCPtr(*realm.heap().allocate<TextDecoder>(realm, realm, *decoder, move(encoding), false, false));
+ return realm.heap().allocate<TextDecoder>(realm, realm, *decoder, move(encoding), false, false);
}
// https://encoding.spec.whatwg.org/#dom-textdecoder
diff --git a/Userland/Libraries/LibWeb/Encoding/TextEncoder.cpp b/Userland/Libraries/LibWeb/Encoding/TextEncoder.cpp
index 3624e03c28..f5128b6520 100644
--- a/Userland/Libraries/LibWeb/Encoding/TextEncoder.cpp
+++ b/Userland/Libraries/LibWeb/Encoding/TextEncoder.cpp
@@ -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);
}
TextEncoder::TextEncoder(JS::Realm& realm)
diff --git a/Userland/Libraries/LibWeb/Fetch/Fetching/PendingResponse.cpp b/Userland/Libraries/LibWeb/Fetch/Fetching/PendingResponse.cpp
index 37dc4a180e..74f4411b85 100644
--- a/Userland/Libraries/LibWeb/Fetch/Fetching/PendingResponse.cpp
+++ b/Userland/Libraries/LibWeb/Fetch/Fetching/PendingResponse.cpp
@@ -14,12 +14,12 @@ namespace Web::Fetch::Fetching {
JS::NonnullGCPtr<PendingResponse> PendingResponse::create(JS::VM& vm, JS::NonnullGCPtr<Infrastructure::Request> request)
{
- return { *vm.heap().allocate_without_realm<PendingResponse>(request) };
+ return vm.heap().allocate_without_realm<PendingResponse>(request);
}
JS::NonnullGCPtr<PendingResponse> PendingResponse::create(JS::VM& vm, JS::NonnullGCPtr<Infrastructure::Request> request, JS::NonnullGCPtr<Infrastructure::Response> response)
{
- return { *vm.heap().allocate_without_realm<PendingResponse>(request, response) };
+ return vm.heap().allocate_without_realm<PendingResponse>(request, response);
}
PendingResponse::PendingResponse(JS::NonnullGCPtr<Infrastructure::Request> request, JS::GCPtr<Infrastructure::Response> response)
diff --git a/Userland/Libraries/LibWeb/Fetch/Headers.cpp b/Userland/Libraries/LibWeb/Fetch/Headers.cpp
index 2cdb3d56ea..4ff34700f8 100644
--- a/Userland/Libraries/LibWeb/Fetch/Headers.cpp
+++ b/Userland/Libraries/LibWeb/Fetch/Headers.cpp
@@ -16,7 +16,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 = realm.heap().allocate<Headers>(realm, realm, Infrastructure::HeaderList::create(vm));
// 1. Set this’s guard to "none".
headers->m_guard = Guard::None;
@@ -25,7 +25,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<Headers>> Headers::construct_impl(JS::Realm
if (init.has_value())
TRY(headers->fill(*init));
- return JS::NonnullGCPtr(*headers);
+ return headers;
}
Headers::Headers(JS::Realm& realm, JS::NonnullGCPtr<Infrastructure::HeaderList> header_list)
diff --git a/Userland/Libraries/LibWeb/Fetch/HeadersIterator.cpp b/Userland/Libraries/LibWeb/Fetch/HeadersIterator.cpp
index 0afc37b487..9544118575 100644
--- a/Userland/Libraries/LibWeb/Fetch/HeadersIterator.cpp
+++ b/Userland/Libraries/LibWeb/Fetch/HeadersIterator.cpp
@@ -14,7 +14,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);
}
HeadersIterator::HeadersIterator(Headers const& headers, JS::Object::PropertyKind iteration_kind)
diff --git a/Userland/Libraries/LibWeb/Fetch/Infrastructure/ConnectionTimingInfo.cpp b/Userland/Libraries/LibWeb/Fetch/Infrastructure/ConnectionTimingInfo.cpp
index 3658690981..9f4e968a74 100644
--- a/Userland/Libraries/LibWeb/Fetch/Infrastructure/ConnectionTimingInfo.cpp
+++ b/Userland/Libraries/LibWeb/Fetch/Infrastructure/ConnectionTimingInfo.cpp
@@ -14,7 +14,7 @@ ConnectionTimingInfo::ConnectionTimingInfo() = default;
JS::NonnullGCPtr<ConnectionTimingInfo> ConnectionTimingInfo::create(JS::VM& vm)
{
- return { *vm.heap().allocate_without_realm<ConnectionTimingInfo>() };
+ return vm.heap().allocate_without_realm<ConnectionTimingInfo>();
}
}
diff --git a/Userland/Libraries/LibWeb/Fetch/Infrastructure/FetchAlgorithms.cpp b/Userland/Libraries/LibWeb/Fetch/Infrastructure/FetchAlgorithms.cpp
index 22e0ebe5a6..a353a3197d 100644
--- a/Userland/Libraries/LibWeb/Fetch/Infrastructure/FetchAlgorithms.cpp
+++ b/Userland/Libraries/LibWeb/Fetch/Infrastructure/FetchAlgorithms.cpp
@@ -12,7 +12,7 @@ namespace Web::Fetch::Infrastructure {
JS::NonnullGCPtr<FetchAlgorithms> FetchAlgorithms::create(JS::VM& vm, Input input)
{
- return { *vm.heap().allocate_without_realm<FetchAlgorithms>(move(input)) };
+ return vm.heap().allocate_without_realm<FetchAlgorithms>(move(input));
}
FetchAlgorithms::FetchAlgorithms(Input input)
diff --git a/Userland/Libraries/LibWeb/Fetch/Infrastructure/FetchController.cpp b/Userland/Libraries/LibWeb/Fetch/Infrastructure/FetchController.cpp
index 451de59ec0..b26a01d80f 100644
--- a/Userland/Libraries/LibWeb/Fetch/Infrastructure/FetchController.cpp
+++ b/Userland/Libraries/LibWeb/Fetch/Infrastructure/FetchController.cpp
@@ -15,7 +15,7 @@ FetchController::FetchController() = default;
JS::NonnullGCPtr<FetchController> FetchController::create(JS::VM& vm)
{
- return { *vm.heap().allocate_without_realm<FetchController>() };
+ return vm.heap().allocate_without_realm<FetchController>();
}
void FetchController::visit_edges(JS::Cell::Visitor& visitor)
diff --git a/Userland/Libraries/LibWeb/Fetch/Infrastructure/FetchParams.cpp b/Userland/Libraries/LibWeb/Fetch/Infrastructure/FetchParams.cpp
index 257c42869d..cf395ff7ad 100644
--- a/Userland/Libraries/LibWeb/Fetch/Infrastructure/FetchParams.cpp
+++ b/Userland/Libraries/LibWeb/Fetch/Infrastructure/FetchParams.cpp
@@ -23,7 +23,7 @@ JS::NonnullGCPtr<FetchParams> FetchParams::create(JS::VM& vm, JS::NonnullGCPtr<R
{
auto algorithms = Infrastructure::FetchAlgorithms::create(vm, {});
auto controller = Infrastructure::FetchController::create(vm);
- return { *vm.heap().allocate_without_realm<FetchParams>(request, algorithms, controller, timing_info) };
+ return vm.heap().allocate_without_realm<FetchParams>(request, algorithms, controller, timing_info);
}
void FetchParams::visit_edges(JS::Cell::Visitor& visitor)
diff --git a/Userland/Libraries/LibWeb/Fetch/Infrastructure/FetchTimingInfo.cpp b/Userland/Libraries/LibWeb/Fetch/Infrastructure/FetchTimingInfo.cpp
index 0e4a43adda..562ad4ff9d 100644
--- a/Userland/Libraries/LibWeb/Fetch/Infrastructure/FetchTimingInfo.cpp
+++ b/Userland/Libraries/LibWeb/Fetch/Infrastructure/FetchTimingInfo.cpp
@@ -14,7 +14,7 @@ FetchTimingInfo::FetchTimingInfo() = default;
JS::NonnullGCPtr<FetchTimingInfo> FetchTimingInfo::create(JS::VM& vm)
{
- return { *vm.heap().allocate_without_realm<FetchTimingInfo>() };
+ return vm.heap().allocate_without_realm<FetchTimingInfo>();
}
void FetchTimingInfo::visit_edges(JS::Cell::Visitor& visitor)
diff --git a/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Bodies.cpp b/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Bodies.cpp
index 475da2f53f..806c867b96 100644
--- a/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Bodies.cpp
+++ b/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Bodies.cpp
@@ -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 = 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 };
diff --git a/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Headers.cpp b/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Headers.cpp
index 5ab9841ae1..b6862eb63e 100644
--- a/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Headers.cpp
+++ b/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Headers.cpp
@@ -48,7 +48,7 @@ ErrorOr<Header> Header::from_string_pair(StringView name, StringView value)
JS::NonnullGCPtr<HeaderList> HeaderList::create(JS::VM& vm)
{
- return { *vm.heap().allocate_without_realm<HeaderList>() };
+ return vm.heap().allocate_without_realm<HeaderList>();
}
// https://fetch.spec.whatwg.org/#header-list-contains
diff --git a/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Requests.cpp b/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Requests.cpp
index 7e7da22c9d..a8bdd656a1 100644
--- a/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Requests.cpp
+++ b/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Requests.cpp
@@ -28,7 +28,7 @@ void Request::visit_edges(JS::Cell::Visitor& visitor)
JS::NonnullGCPtr<Request> Request::create(JS::VM& vm)
{
- return { *vm.heap().allocate_without_realm<Request>(HeaderList::create(vm)) };
+ return vm.heap().allocate_without_realm<Request>(HeaderList::create(vm));
}
// https://fetch.spec.whatwg.org/#concept-request-url
diff --git a/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Responses.cpp b/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Responses.cpp
index edf487e4b9..f3238163cc 100644
--- a/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Responses.cpp
+++ b/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Responses.cpp
@@ -29,7 +29,7 @@ void Response::visit_edges(JS::Cell::Visitor& visitor)
JS::NonnullGCPtr<Response> Response::create(JS::VM& vm)
{
- return { *vm.heap().allocate_without_realm<Response>(HeaderList::create(vm)) };
+ return vm.heap().allocate_without_realm<Response>(HeaderList::create(vm));
}
// https://fetch.spec.whatwg.org/#ref-for-concept-network-error%E2%91%A3
@@ -193,7 +193,7 @@ ErrorOr<JS::NonnullGCPtr<BasicFilteredResponse>> BasicFilteredResponse::create(J
TRY(header_list->append(header));
}
- return { *vm.heap().allocate_without_realm<BasicFilteredResponse>(internal_response, header_list) };
+ return vm.heap().allocate_without_realm<BasicFilteredResponse>(internal_response, header_list);
}
BasicFilteredResponse::BasicFilteredResponse(JS::NonnullGCPtr<Response> internal_response, JS::NonnullGCPtr<HeaderList> header_list)
@@ -223,7 +223,7 @@ ErrorOr<JS::NonnullGCPtr<CORSFilteredResponse>> CORSFilteredResponse::create(JS:
TRY(header_list->append(header));
}
- return { *vm.heap().allocate_without_realm<CORSFilteredResponse>(internal_response, header_list) };
+ return vm.heap().allocate_without_realm<CORSFilteredResponse>(internal_response, header_list);
}
CORSFilteredResponse::CORSFilteredResponse(JS::NonnullGCPtr<Response> internal_response, JS::NonnullGCPtr<HeaderList> header_list)
@@ -242,7 +242,7 @@ JS::NonnullGCPtr<OpaqueFilteredResponse> OpaqueFilteredResponse::create(JS::VM&
{
// An opaque filtered response is a filtered response whose type is "opaque", URL list is the empty list,
// status is 0, status message is the empty byte sequence, header list is empty, and body is null.
- return { *vm.heap().allocate_without_realm<OpaqueFilteredResponse>(internal_response, HeaderList::create(vm)) };
+ return vm.heap().allocate_without_realm<OpaqueFilteredResponse>(internal_response, HeaderList::create(vm));
}
OpaqueFilteredResponse::OpaqueFilteredResponse(JS::NonnullGCPtr<Response> internal_response, JS::NonnullGCPtr<HeaderList> header_list)
@@ -261,7 +261,7 @@ JS::NonnullGCPtr<OpaqueRedirectFilteredResponse> OpaqueRedirectFilteredResponse:
{
// An opaque-redirect filtered response is a filtered response whose type is "opaqueredirect",
// status is 0, status message is the empty byte sequence, header list is empty, and body is null.
- return { *vm.heap().allocate_without_realm<OpaqueRedirectFilteredResponse>(internal_response, HeaderList::create(vm)) };
+ return vm.heap().allocate_without_realm<OpaqueRedirectFilteredResponse>(internal_response, HeaderList::create(vm));
}
OpaqueRedirectFilteredResponse::OpaqueRedirectFilteredResponse(JS::NonnullGCPtr<Response> internal_response, JS::NonnullGCPtr<HeaderList> header_list)
diff --git a/Userland/Libraries/LibWeb/Fetch/Request.cpp b/Userland/Libraries/LibWeb/Fetch/Request.cpp
index 2ef5c8f5d9..5ae2acdfd4 100644
--- a/Userland/Libraries/LibWeb/Fetch/Request.cpp
+++ b/Userland/Libraries/LibWeb/Fetch/Request.cpp
@@ -77,7 +77,7 @@ 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);
// 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());
@@ -87,7 +87,7 @@ JS::NonnullGCPtr<Request> Request::create(JS::Realm& realm, JS::NonnullGCPtr<Inf
request_object->m_signal = realm.heap().allocate<DOM::AbortSignal>(realm, realm);
// 5. Return requestObject.
- return JS::NonnullGCPtr { *request_object };
+ return request_object;
}
// https://fetch.spec.whatwg.org/#dom-request
@@ -96,7 +96,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 = JS::NonnullGCPtr { *realm.heap().allocate<Request>(realm, realm, Infrastructure::Request::create(vm)) };
+ auto request_object = realm.heap().allocate<Request>(realm, realm, Infrastructure::Request::create(vm));
// 1. Let request be null.
JS::GCPtr<Infrastructure::Request> input_request;
diff --git a/Userland/Libraries/LibWeb/Fetch/Response.cpp b/Userland/Libraries/LibWeb/Fetch/Response.cpp
index 944c09e1be..c443181dab 100644
--- a/Userland/Libraries/LibWeb/Fetch/Response.cpp
+++ b/Userland/Libraries/LibWeb/Fetch/Response.cpp
@@ -69,14 +69,14 @@ 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);
// 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->set_guard(guard);
// 4. Return responseObject.
- return JS::NonnullGCPtr { *response_object };
+ return response_object;
}
// https://fetch.spec.whatwg.org/#initialize-a-response
@@ -126,7 +126,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<Response>> Response::construct_impl(JS::Rea
auto& vm = realm.vm();
// Referred to as 'this' in the spec.
- auto response_object = JS::NonnullGCPtr { *realm.heap().allocate<Response>(realm, realm, Infrastructure::Response::create(vm)) };
+ auto response_object = 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
diff --git a/Userland/Libraries/LibWeb/FileAPI/Blob.cpp b/Userland/Libraries/LibWeb/FileAPI/Blob.cpp
index fbff037466..6d86e6c773 100644
--- a/Userland/Libraries/LibWeb/FileAPI/Blob.cpp
+++ b/Userland/Libraries/LibWeb/FileAPI/Blob.cpp
@@ -16,7 +16,7 @@ namespace Web::FileAPI {
JS::NonnullGCPtr<Blob> Blob::create(JS::Realm& realm, ByteBuffer byte_buffer, DeprecatedString type)
{
- return JS::NonnullGCPtr(*realm.heap().allocate<Blob>(realm, realm, move(byte_buffer), move(type)));
+ return realm.heap().allocate<Blob>(realm, realm, move(byte_buffer), move(type));
}
// https://w3c.github.io/FileAPI/#convert-line-endings-to-native
@@ -139,7 +139,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 JS::NonnullGCPtr(*realm.heap().allocate<Blob>(realm, realm));
+ return realm.heap().allocate<Blob>(realm, realm);
ByteBuffer byte_buffer {};
// 2. Let bytes be the result of processing blob parts given blobParts and options.
@@ -164,7 +164,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 JS::NonnullGCPtr(*realm.heap().allocate<Blob>(realm, realm, move(byte_buffer), move(type)));
+ return 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)
@@ -233,7 +233,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_RETURN_OOM(realm(), m_byte_buffer.slice(relative_start, span));
- return JS::NonnullGCPtr(*heap().allocate<Blob>(realm(), realm(), move(byte_buffer), move(relative_content_type)));
+ return heap().allocate<Blob>(realm(), realm(), move(byte_buffer), move(relative_content_type));
}
// https://w3c.github.io/FileAPI/#dom-blob-text
diff --git a/Userland/Libraries/LibWeb/FileAPI/File.cpp b/Userland/Libraries/LibWeb/FileAPI/File.cpp
index f418446588..52f4297189 100644
--- a/Userland/Libraries/LibWeb/FileAPI/File.cpp
+++ b/Userland/Libraries/LibWeb/FileAPI/File.cpp
@@ -58,7 +58,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 JS::NonnullGCPtr(*realm.heap().allocate<File>(realm, realm, move(bytes), move(name), move(type), last_modified));
+ return 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)
diff --git a/Userland/Libraries/LibWeb/FileAPI/FileList.cpp b/Userland/Libraries/LibWeb/FileAPI/FileList.cpp
index 988b1e030e..248a1234c0 100644
--- a/Userland/Libraries/LibWeb/FileAPI/FileList.cpp
+++ b/Userland/Libraries/LibWeb/FileAPI/FileList.cpp
@@ -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));
}
FileList::FileList(JS::Realm& realm, Vector<JS::NonnullGCPtr<File>>&& files)
diff --git a/Userland/Libraries/LibWeb/Geometry/DOMPoint.cpp b/Userland/Libraries/LibWeb/Geometry/DOMPoint.cpp
index c6fd9c84a6..93fc4bdd57 100644
--- a/Userland/Libraries/LibWeb/Geometry/DOMPoint.cpp
+++ b/Userland/Libraries/LibWeb/Geometry/DOMPoint.cpp
@@ -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);
}
DOMPoint::DOMPoint(JS::Realm& realm, double x, double y, double z, double w)
diff --git a/Userland/Libraries/LibWeb/Geometry/DOMPointReadOnly.cpp b/Userland/Libraries/LibWeb/Geometry/DOMPointReadOnly.cpp
index 7258beabd2..a24a192bd1 100644
--- a/Userland/Libraries/LibWeb/Geometry/DOMPointReadOnly.cpp
+++ b/Userland/Libraries/LibWeb/Geometry/DOMPointReadOnly.cpp
@@ -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);
}
DOMPointReadOnly::DOMPointReadOnly(JS::Realm& realm, double x, double y, double z, double w)
diff --git a/Userland/Libraries/LibWeb/Geometry/DOMRect.cpp b/Userland/Libraries/LibWeb/Geometry/DOMRect.cpp
index aacadfb06a..b732bcf211 100644
--- a/Userland/Libraries/LibWeb/Geometry/DOMRect.cpp
+++ b/Userland/Libraries/LibWeb/Geometry/DOMRect.cpp
@@ -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);
}
JS::NonnullGCPtr<DOMRect> DOMRect::create(JS::Realm& realm, Gfx::FloatRect const& rect)
diff --git a/Userland/Libraries/LibWeb/Geometry/DOMRectList.cpp b/Userland/Libraries/LibWeb/Geometry/DOMRectList.cpp
index 0e60ddb281..9dbf69dd14 100644
--- a/Userland/Libraries/LibWeb/Geometry/DOMRectList.cpp
+++ b/Userland/Libraries/LibWeb/Geometry/DOMRectList.cpp
@@ -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));
}
DOMRectList::DOMRectList(JS::Realm& realm, Vector<JS::NonnullGCPtr<DOMRect>> rects)
diff --git a/Userland/Libraries/LibWeb/Geometry/DOMRectReadOnly.cpp b/Userland/Libraries/LibWeb/Geometry/DOMRectReadOnly.cpp
index 681df18913..82b778a930 100644
--- a/Userland/Libraries/LibWeb/Geometry/DOMRectReadOnly.cpp
+++ b/Userland/Libraries/LibWeb/Geometry/DOMRectReadOnly.cpp
@@ -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);
}
DOMRectReadOnly::DOMRectReadOnly(JS::Realm& realm, double x, double y, double width, double height)
diff --git a/Userland/Libraries/LibWeb/HTML/CanvasGradient.cpp b/Userland/Libraries/LibWeb/HTML/CanvasGradient.cpp
index 1ed6297e7d..e1468820b6 100644
--- a/Userland/Libraries/LibWeb/HTML/CanvasGradient.cpp
+++ b/Userland/Libraries/LibWeb/HTML/CanvasGradient.cpp
@@ -19,7 +19,7 @@ JS::NonnullGCPtr<CanvasGradient> CanvasGradient::create_radial(JS::Realm& realm,
(void)x1;
(void)y1;
(void)r1;
- return *realm.heap().allocate<CanvasGradient>(realm, realm, Type::Radial);
+ return realm.heap().allocate<CanvasGradient>(realm, realm, Type::Radial);
}
JS::NonnullGCPtr<CanvasGradient> CanvasGradient::create_linear(JS::Realm& realm, double x0, double y0, double x1, double y1)
@@ -28,7 +28,7 @@ JS::NonnullGCPtr<CanvasGradient> CanvasGradient::create_linear(JS::Realm& realm,
(void)y0;
(void)x1;
(void)y1;
- return *realm.heap().allocate<CanvasGradient>(realm, realm, Type::Linear);
+ return realm.heap().allocate<CanvasGradient>(realm, realm, Type::Linear);
}
JS::NonnullGCPtr<CanvasGradient> CanvasGradient::create_conic(JS::Realm& realm, double start_angle, double x, double y)
@@ -36,7 +36,7 @@ JS::NonnullGCPtr<CanvasGradient> CanvasGradient::create_conic(JS::Realm& realm,
(void)start_angle;
(void)x;
(void)y;
- return *realm.heap().allocate<CanvasGradient>(realm, realm, Type::Conic);
+ return realm.heap().allocate<CanvasGradient>(realm, realm, Type::Conic);
}
CanvasGradient::CanvasGradient(JS::Realm& realm, Type type)
diff --git a/Userland/Libraries/LibWeb/HTML/CanvasRenderingContext2D.cpp b/Userland/Libraries/LibWeb/HTML/CanvasRenderingContext2D.cpp
index 57619c030c..70851fde79 100644
--- a/Userland/Libraries/LibWeb/HTML/CanvasRenderingContext2D.cpp
+++ b/Userland/Libraries/LibWeb/HTML/CanvasRenderingContext2D.cpp
@@ -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);
}
CanvasRenderingContext2D::CanvasRenderingContext2D(JS::Realm& realm, HTMLCanvasElement& element)
diff --git a/Userland/Libraries/LibWeb/HTML/DOMParser.cpp b/Userland/Libraries/LibWeb/HTML/DOMParser.cpp
index 6aa861bdf2..987447a034 100644
--- a/Userland/Libraries/LibWeb/HTML/DOMParser.cpp
+++ b/Userland/Libraries/LibWeb/HTML/DOMParser.cpp
@@ -15,7 +15,7 @@ namespace Web::HTML {
WebIDL::ExceptionOr<JS::NonnullGCPtr<DOMParser>> DOMParser::construct_impl(JS::Realm& realm)
{
- return JS::NonnullGCPtr(*realm.heap().allocate<DOMParser>(realm, realm));
+ return realm.heap().allocate<DOMParser>(realm, realm);
}
DOMParser::DOMParser(JS::Realm& realm)
diff --git a/Userland/Libraries/LibWeb/HTML/DOMStringMap.cpp b/Userland/Libraries/LibWeb/HTML/DOMStringMap.cpp
index 904e09a96b..2df3643a1a 100644
--- a/Userland/Libraries/LibWeb/HTML/DOMStringMap.cpp
+++ b/Userland/Libraries/LibWeb/HTML/DOMStringMap.cpp
@@ -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);
}
DOMStringMap::DOMStringMap(DOM::Element& element)
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp
index ef824c4448..3c8316930b 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp
+++ b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp
@@ -376,7 +376,7 @@ 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);
auto initial_value = m_value;
if (initial_value.is_null())
initial_value = DeprecatedString::empty();
@@ -390,8 +390,8 @@ void HTMLInputElement::create_shadow_tree_if_needed()
m_text_node->set_is_password_input({}, true);
MUST(element->append_child(*m_text_node));
- MUST(shadow_root->append_child(move(element)));
- set_shadow_root(move(shadow_root));
+ MUST(shadow_root->append_child(element));
+ set_shadow_root(shadow_root);
}
void HTMLInputElement::did_receive_focus()
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLOptionsCollection.cpp b/Userland/Libraries/LibWeb/HTML/HTMLOptionsCollection.cpp
index 49b46ff6ed..4782523d10 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLOptionsCollection.cpp
+++ b/Userland/Libraries/LibWeb/HTML/HTMLOptionsCollection.cpp
@@ -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));
}
HTMLOptionsCollection::HTMLOptionsCollection(DOM::ParentNode& root, Function<bool(DOM::Element const&)> filter)
diff --git a/Userland/Libraries/LibWeb/HTML/History.cpp b/Userland/Libraries/LibWeb/HTML/History.cpp
index 762b90c6ad..63deb9f798 100644
--- a/Userland/Libraries/LibWeb/HTML/History.cpp
+++ b/Userland/Libraries/LibWeb/HTML/History.cpp
@@ -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);
}
History::History(JS::Realm& realm, DOM::Document& document)
diff --git a/Userland/Libraries/LibWeb/HTML/MessageChannel.cpp b/Userland/Libraries/LibWeb/HTML/MessageChannel.cpp
index 8e71b7504b..b0c706a57a 100644
--- a/Userland/Libraries/LibWeb/HTML/MessageChannel.cpp
+++ b/Userland/Libraries/LibWeb/HTML/MessageChannel.cpp
@@ -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);
}
MessageChannel::MessageChannel(JS::Realm& realm)
diff --git a/Userland/Libraries/LibWeb/HTML/MessagePort.cpp b/Userland/Libraries/LibWeb/HTML/MessagePort.cpp
index b65a366583..461ff967b6 100644
--- a/Userland/Libraries/LibWeb/HTML/MessagePort.cpp
+++ b/Userland/Libraries/LibWeb/HTML/MessagePort.cpp
@@ -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);
}
MessagePort::MessagePort(JS::Realm& realm)
diff --git a/Userland/Libraries/LibWeb/HTML/Navigator.cpp b/Userland/Libraries/LibWeb/HTML/Navigator.cpp
index 797566297f..ed25204e08 100644
--- a/Userland/Libraries/LibWeb/HTML/Navigator.cpp
+++ b/Userland/Libraries/LibWeb/HTML/Navigator.cpp
@@ -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);
}
Navigator::Navigator(JS::Realm& realm)
diff --git a/Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.cpp b/Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.cpp
index 4a001fc4f6..27d9b1e3eb 100644
--- a/Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.cpp
+++ b/Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.cpp
@@ -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()), adjusted_insertion_location.insert_before_sibling);
}
void HTMLParser::handle_in_head(HTMLToken& token)
@@ -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())));
return;
}
@@ -3181,8 +3181,8 @@ 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());
- MUST(document().append_child(*comment));
+ auto comment = document().heap().allocate<DOM::Comment>(document().realm(), document(), token.comment());
+ MUST(document().append_child(comment));
return;
}
@@ -3540,21 +3540,21 @@ Vector<JS::Handle<DOM::Node>> HTMLParser::parse_html_fragment(DOM::Element& cont
JS::NonnullGCPtr<HTMLParser> HTMLParser::create_for_scripting(DOM::Document& document)
{
- return *document.heap().allocate_without_realm<HTMLParser>(document);
+ return document.heap().allocate_without_realm<HTMLParser>(document);
}
JS::NonnullGCPtr<HTMLParser> HTMLParser::create_with_uncertain_encoding(DOM::Document& document, ByteBuffer const& input)
{
if (document.has_encoding())
- return *document.heap().allocate_without_realm<HTMLParser>(document, input, document.encoding().value());
+ return document.heap().allocate_without_realm<HTMLParser>(document, input, document.encoding().value());
auto encoding = run_encoding_sniffing_algorithm(document, input);
dbgln_if(HTML_PARSER_DEBUG, "The encoding sniffing algorithm returned encoding '{}'", encoding);
- return *document.heap().allocate_without_realm<HTMLParser>(document, input, encoding);
+ return document.heap().allocate_without_realm<HTMLParser>(document, input, encoding);
}
JS::NonnullGCPtr<HTMLParser> HTMLParser::create(DOM::Document& document, StringView input, DeprecatedString const& encoding)
{
- return *document.heap().allocate_without_realm<HTMLParser>(document, input, encoding);
+ return document.heap().allocate_without_realm<HTMLParser>(document, input, encoding);
}
// https://html.spec.whatwg.org/multipage/parsing.html#html-fragment-serialisation-algorithm
diff --git a/Userland/Libraries/LibWeb/HTML/Path2D.cpp b/Userland/Libraries/LibWeb/HTML/Path2D.cpp
index 52ca1daa5c..58d5383156 100644
--- a/Userland/Libraries/LibWeb/HTML/Path2D.cpp
+++ b/Userland/Libraries/LibWeb/HTML/Path2D.cpp
@@ -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);
}
// https://html.spec.whatwg.org/multipage/canvas.html#dom-path2d
diff --git a/Userland/Libraries/LibWeb/HTML/Scripting/ClassicScript.cpp b/Userland/Libraries/LibWeb/HTML/Scripting/ClassicScript.cpp
index d4dedf47a5..40c2452f22 100644
--- a/Userland/Libraries/LibWeb/HTML/Scripting/ClassicScript.cpp
+++ b/Userland/Libraries/LibWeb/HTML/Scripting/ClassicScript.cpp
@@ -60,14 +60,14 @@ JS::NonnullGCPtr<ClassicScript> ClassicScript::create(DeprecatedString filename,
script->m_error_to_rethrow = parse_error;
// 2. Return script.
- return JS::NonnullGCPtr(*script);
+ return script;
}
// 12. Set script's record to result.
script->m_script_record = *result.release_value();
// 13. Return script.
- return JS::NonnullGCPtr(*script);
+ return script;
}
// https://html.spec.whatwg.org/multipage/webappapis.html#run-a-classic-script
diff --git a/Userland/Libraries/LibWeb/HTML/Scripting/ModuleScript.cpp b/Userland/Libraries/LibWeb/HTML/Scripting/ModuleScript.cpp
index dfc380302a..a81eb658eb 100644
--- a/Userland/Libraries/LibWeb/HTML/Scripting/ModuleScript.cpp
+++ b/Userland/Libraries/LibWeb/HTML/Scripting/ModuleScript.cpp
@@ -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);
// 3. Set script's settings object to settings.
// NOTE: This was already done when constructing.
diff --git a/Userland/Libraries/LibWeb/HTML/Scripting/WindowEnvironmentSettingsObject.cpp b/Userland/Libraries/LibWeb/HTML/Scripting/WindowEnvironmentSettingsObject.cpp
index b234c6e3d2..ff8585c6ee 100644
--- a/Userland/Libraries/LibWeb/HTML/Scripting/WindowEnvironmentSettingsObject.cpp
+++ b/Userland/Libraries/LibWeb/HTML/Scripting/WindowEnvironmentSettingsObject.cpp
@@ -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));
// 4. If reservedEnvironment is non-null, then:
if (reserved_environment.has_value()) {
@@ -71,8 +71,8 @@ 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 host_defined = make<Bindings::HostDefined>(*settings_object, *intrinsics);
+ auto intrinsics = realm->heap().allocate<Bindings::Intrinsics>(*realm, *realm);
+ auto host_defined = make<Bindings::HostDefined>(settings_object, intrinsics);
realm->set_host_defined(move(host_defined));
// Non-Standard: We cannot fully initialize window object until *after* the we set up
diff --git a/Userland/Libraries/LibWeb/HTML/Scripting/WorkerEnvironmentSettingsObject.h b/Userland/Libraries/LibWeb/HTML/Scripting/WorkerEnvironmentSettingsObject.h
index 6280ce7bd5..1fd43d2352 100644
--- a/Userland/Libraries/LibWeb/HTML/Scripting/WorkerEnvironmentSettingsObject.h
+++ b/Userland/Libraries/LibWeb/HTML/Scripting/WorkerEnvironmentSettingsObject.h
@@ -30,14 +30,14 @@ public:
auto settings_object = realm->heap().allocate<WorkerEnvironmentSettingsObject>(*realm, move(execution_context));
settings_object->target_browsing_context = nullptr;
- auto* intrinsics = realm->heap().allocate<Bindings::Intrinsics>(*realm, *realm);
- auto host_defined = make<Bindings::HostDefined>(*settings_object, *intrinsics);
+ auto intrinsics = realm->heap().allocate<Bindings::Intrinsics>(*realm, *realm);
+ auto host_defined = make<Bindings::HostDefined>(settings_object, intrinsics);
realm->set_host_defined(move(host_defined));
// FIXME: Shared workers should use the shared worker method
Bindings::add_dedicated_worker_exposed_interfaces(realm->global_object(), *realm);
- return *settings_object;
+ return settings_object;
}
virtual ~WorkerEnvironmentSettingsObject() override = default;
diff --git a/Userland/Libraries/LibWeb/HTML/Storage.cpp b/Userland/Libraries/LibWeb/HTML/Storage.cpp
index 04c2a62fa9..a21e2d89b8 100644
--- a/Userland/Libraries/LibWeb/HTML/Storage.cpp
+++ b/Userland/Libraries/LibWeb/HTML/Storage.cpp
@@ -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);
}
Storage::Storage(JS::Realm& realm)
diff --git a/Userland/Libraries/LibWeb/HTML/TextMetrics.cpp b/Userland/Libraries/LibWeb/HTML/TextMetrics.cpp
index 1ea23bbd8a..5041db4006 100644
--- a/Userland/Libraries/LibWeb/HTML/TextMetrics.cpp
+++ b/Userland/Libraries/LibWeb/HTML/TextMetrics.cpp
@@ -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);
}
TextMetrics::TextMetrics(JS::Realm& realm)
diff --git a/Userland/Libraries/LibWeb/HTML/Timer.cpp b/Userland/Libraries/LibWeb/HTML/Timer.cpp
index 228b514481..28fcfde499 100644
--- a/Userland/Libraries/LibWeb/HTML/Timer.cpp
+++ b/Userland/Libraries/LibWeb/HTML/Timer.cpp
@@ -12,7 +12,7 @@ namespace Web::HTML {
JS::NonnullGCPtr<Timer> Timer::create(Window& window, i32 milliseconds, Function<void()> callback, i32 id)
{
- return *window.heap().allocate_without_realm<Timer>(window, milliseconds, move(callback), id);
+ return window.heap().allocate_without_realm<Timer>(window, milliseconds, move(callback), id);
}
Timer::Timer(Window& window, i32 milliseconds, Function<void()> callback, i32 id)
diff --git a/Userland/Libraries/LibWeb/HTML/Window.cpp b/Userland/Libraries/LibWeb/HTML/Window.cpp
index f4d39a476a..5b4147b3d4 100644
--- a/Userland/Libraries/LibWeb/HTML/Window.cpp
+++ b/Userland/Libraries/LibWeb/HTML/Window.cpp
@@ -86,7 +86,7 @@ private:
JS::NonnullGCPtr<Window> Window::create(JS::Realm& realm)
{
- return *realm.heap().allocate<Window>(realm, realm);
+ return realm.heap().allocate<Window>(realm, realm);
}
Window::Window(JS::Realm& realm)
@@ -1340,7 +1340,7 @@ JS_DEFINE_NATIVE_FUNCTION(Window::request_animation_frame)
auto* callback_object = TRY(vm.argument(0).to_object(vm));
if (!callback_object->is_function())
return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAFunctionNoParam);
- auto* callback = vm.heap().allocate_without_realm<WebIDL::CallbackType>(*callback_object, HTML::incumbent_settings_object());
+ auto callback = vm.heap().allocate_without_realm<WebIDL::CallbackType>(*callback_object, HTML::incumbent_settings_object());
return JS::Value(impl->request_animation_frame_impl(*callback));
}
@@ -1363,7 +1363,7 @@ JS_DEFINE_NATIVE_FUNCTION(Window::queue_microtask)
if (!callback_object->is_function())
return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAFunctionNoParam);
- auto* callback = vm.heap().allocate_without_realm<WebIDL::CallbackType>(*callback_object, HTML::incumbent_settings_object());
+ auto callback = vm.heap().allocate_without_realm<WebIDL::CallbackType>(*callback_object, HTML::incumbent_settings_object());
impl->queue_microtask_impl(*callback);
return JS::js_undefined();
@@ -1379,7 +1379,7 @@ JS_DEFINE_NATIVE_FUNCTION(Window::request_idle_callback)
return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAFunctionNoParam);
// FIXME: accept options object
- auto* callback = vm.heap().allocate_without_realm<WebIDL::CallbackType>(*callback_object, HTML::incumbent_settings_object());
+ auto callback = vm.heap().allocate_without_realm<WebIDL::CallbackType>(*callback_object, HTML::incumbent_settings_object());
return JS::Value(impl->request_idle_callback_impl(*callback));
}
diff --git a/Userland/Libraries/LibWeb/HTML/Worker.cpp b/Userland/Libraries/LibWeb/HTML/Worker.cpp
index 23ad8dc99a..846fb1fca3 100644
--- a/Userland/Libraries/LibWeb/HTML/Worker.cpp
+++ b/Userland/Libraries/LibWeb/HTML/Worker.cpp
@@ -83,7 +83,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<Worker>> Worker::create(FlyString const& sc
worker->run_a_worker(url, outside_settings, *outside_port, options);
// 10. Return worker
- return JS::NonnullGCPtr(*worker);
+ return worker;
}
// https://html.spec.whatwg.org/multipage/workers.html#run-a-worker
diff --git a/Userland/Libraries/LibWeb/HTML/WorkerNavigator.cpp b/Userland/Libraries/LibWeb/HTML/WorkerNavigator.cpp
index ecc556ff64..e86d942b56 100644
--- a/Userland/Libraries/LibWeb/HTML/WorkerNavigator.cpp
+++ b/Userland/Libraries/LibWeb/HTML/WorkerNavigator.cpp
@@ -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);
}
WorkerNavigator::WorkerNavigator(WorkerGlobalScope& global_scope)
diff --git a/Userland/Libraries/LibWeb/IntersectionObserver/IntersectionObserver.cpp b/Userland/Libraries/LibWeb/IntersectionObserver/IntersectionObserver.cpp
index 19b58562b2..ec4522deeb 100644
--- a/Userland/Libraries/LibWeb/IntersectionObserver/IntersectionObserver.cpp
+++ b/Userland/Libraries/LibWeb/IntersectionObserver/IntersectionObserver.cpp
@@ -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);
}
IntersectionObserver::IntersectionObserver(JS::Realm& realm)
diff --git a/Userland/Libraries/LibWeb/Layout/TreeBuilder.cpp b/Userland/Libraries/LibWeb/Layout/TreeBuilder.cpp
index 759fe1132c..7facd9595b 100644
--- a/Userland/Libraries/LibWeb/Layout/TreeBuilder.cpp
+++ b/Userland/Libraries/LibWeb/Layout/TreeBuilder.cpp
@@ -170,7 +170,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);
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));
@@ -301,8 +301,8 @@ 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_node = document.heap().allocate_without_realm<Layout::TextNode>(document, *text);
+ auto text = document.heap().allocate<DOM::Text>(document.realm(), document, *placeholder_value);
+ auto text_node = document.heap().allocate_without_realm<Layout::TextNode>(document, *text);
text_node->set_generated(true);
push_parent(verify_cast<NodeWithStyle>(*layout_node));
diff --git a/Userland/Libraries/LibWeb/RequestIdleCallback/IdleDeadline.cpp b/Userland/Libraries/LibWeb/RequestIdleCallback/IdleDeadline.cpp
index 169ef2b96b..9fa2c62674 100644
--- a/Userland/Libraries/LibWeb/RequestIdleCallback/IdleDeadline.cpp
+++ b/Userland/Libraries/LibWeb/RequestIdleCallback/IdleDeadline.cpp
@@ -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);
}
IdleDeadline::IdleDeadline(JS::Realm& realm, bool did_timeout)
diff --git a/Userland/Libraries/LibWeb/ResizeObserver/ResizeObserver.cpp b/Userland/Libraries/LibWeb/ResizeObserver/ResizeObserver.cpp
index 98d340a175..638ed78934 100644
--- a/Userland/Libraries/LibWeb/ResizeObserver/ResizeObserver.cpp
+++ b/Userland/Libraries/LibWeb/ResizeObserver/ResizeObserver.cpp
@@ -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);
}
ResizeObserver::ResizeObserver(JS::Realm& realm)
diff --git a/Userland/Libraries/LibWeb/SVG/SVGAnimatedLength.cpp b/Userland/Libraries/LibWeb/SVG/SVGAnimatedLength.cpp
index cb338dd951..cb0e635aad 100644
--- a/Userland/Libraries/LibWeb/SVG/SVGAnimatedLength.cpp
+++ b/Userland/Libraries/LibWeb/SVG/SVGAnimatedLength.cpp
@@ -11,7 +11,7 @@ namespace Web::SVG {
JS::NonnullGCPtr<SVGAnimatedLength> SVGAnimatedLength::create(JS::Realm& realm, JS::NonnullGCPtr<SVGLength> base_val, JS::NonnullGCPtr<SVGLength> anim_val)
{
- return *realm.heap().allocate<SVGAnimatedLength>(realm, realm, move(base_val), move(anim_val));
+ return realm.heap().allocate<SVGAnimatedLength>(realm, realm, move(base_val), move(anim_val));
}
SVGAnimatedLength::SVGAnimatedLength(JS::Realm& realm, JS::NonnullGCPtr<SVGLength> base_val, JS::NonnullGCPtr<SVGLength> anim_val)
diff --git a/Userland/Libraries/LibWeb/SVG/SVGLength.cpp b/Userland/Libraries/LibWeb/SVG/SVGLength.cpp
index 6919433e10..2a268304ce 100644
--- a/Userland/Libraries/LibWeb/SVG/SVGLength.cpp
+++ b/Userland/Libraries/LibWeb/SVG/SVGLength.cpp
@@ -11,7 +11,7 @@ namespace Web::SVG {
JS::NonnullGCPtr<SVGLength> SVGLength::create(JS::Realm& realm, u8 unit_type, float value)
{
- return *realm.heap().allocate<SVGLength>(realm, realm, unit_type, value);
+ return realm.heap().allocate<SVGLength>(realm, realm, unit_type, value);
}
SVGLength::SVGLength(JS::Realm& realm, u8 unit_type, float value)
diff --git a/Userland/Libraries/LibWeb/Selection/Selection.cpp b/Userland/Libraries/LibWeb/Selection/Selection.cpp
index 7aaacd4854..34f225374e 100644
--- a/Userland/Libraries/LibWeb/Selection/Selection.cpp
+++ b/Userland/Libraries/LibWeb/Selection/Selection.cpp
@@ -13,7 +13,7 @@ namespace Web::Selection {
JS::NonnullGCPtr<Selection> Selection::create(JS::NonnullGCPtr<JS::Realm> realm, JS::NonnullGCPtr<DOM::Document> document)
{
- return *realm->heap().allocate<Selection>(realm, realm, document);
+ return realm->heap().allocate<Selection>(realm, realm, document);
}
Selection::Selection(JS::NonnullGCPtr<JS::Realm> realm, JS::NonnullGCPtr<DOM::Document> document)
diff --git a/Userland/Libraries/LibWeb/Streams/ReadableStream.cpp b/Userland/Libraries/LibWeb/Streams/ReadableStream.cpp
index bbd1b21af8..1b555abf71 100644
--- a/Userland/Libraries/LibWeb/Streams/ReadableStream.cpp
+++ b/Userland/Libraries/LibWeb/Streams/ReadableStream.cpp
@@ -14,9 +14,7 @@ namespace Web::Streams {
// https://streams.spec.whatwg.org/#rs-constructor
WebIDL::ExceptionOr<JS::NonnullGCPtr<ReadableStream>> ReadableStream::construct_impl(JS::Realm& realm)
{
- auto* readable_stream = realm.heap().allocate<ReadableStream>(realm, realm);
-
- return JS::NonnullGCPtr { *readable_stream };
+ return realm.heap().allocate<ReadableStream>(realm, realm);
}
ReadableStream::ReadableStream(JS::Realm& realm)
diff --git a/Userland/Libraries/LibWeb/URL/URL.cpp b/Userland/Libraries/LibWeb/URL/URL.cpp
index b0fbe54fac..c52a3b4921 100644
--- a/Userland/Libraries/LibWeb/URL/URL.cpp
+++ b/Userland/Libraries/LibWeb/URL/URL.cpp
@@ -15,7 +15,7 @@ namespace Web::URL {
JS::NonnullGCPtr<URL> URL::create(JS::Realm& realm, AK::URL url, JS::NonnullGCPtr<URLSearchParams> query)
{
- return *realm.heap().allocate<URL>(realm, realm, move(url), move(query));
+ return realm.heap().allocate<URL>(realm, realm, move(url), move(query));
}
WebIDL::ExceptionOr<JS::NonnullGCPtr<URL>> URL::construct_impl(JS::Realm& realm, DeprecatedString const& url, DeprecatedString const& base)
diff --git a/Userland/Libraries/LibWeb/URL/URLSearchParams.cpp b/Userland/Libraries/LibWeb/URL/URLSearchParams.cpp
index 808380be92..f5766c6337 100644
--- a/Userland/Libraries/LibWeb/URL/URLSearchParams.cpp
+++ b/Userland/Libraries/LibWeb/URL/URLSearchParams.cpp
@@ -84,7 +84,7 @@ Vector<QueryParam> url_decode(StringView input)
JS::NonnullGCPtr<URLSearchParams> URLSearchParams::create(JS::Realm& realm, Vector<QueryParam> list)
{
- return *realm.heap().allocate<URLSearchParams>(realm, realm, move(list));
+ return realm.heap().allocate<URLSearchParams>(realm, realm, move(list));
}
// https://url.spec.whatwg.org/#dom-urlsearchparams-urlsearchparams
diff --git a/Userland/Libraries/LibWeb/URL/URLSearchParamsIterator.cpp b/Userland/Libraries/LibWeb/URL/URLSearchParamsIterator.cpp
index f8cc777bfa..902dd499b4 100644
--- a/Userland/Libraries/LibWeb/URL/URLSearchParamsIterator.cpp
+++ b/Userland/Libraries/LibWeb/URL/URLSearchParamsIterator.cpp
@@ -14,7 +14,7 @@ namespace Web::URL {
JS::NonnullGCPtr<URLSearchParamsIterator> URLSearchParamsIterator::create(URLSearchParams const& url_search_params, JS::Object::PropertyKind iteration_kind)
{
- return *url_search_params.heap().allocate<URLSearchParamsIterator>(url_search_params.realm(), url_search_params, iteration_kind);
+ return url_search_params.heap().allocate<URLSearchParamsIterator>(url_search_params.realm(), url_search_params, iteration_kind);
}
URLSearchParamsIterator::URLSearchParamsIterator(URLSearchParams const& url_search_params, JS::Object::PropertyKind iteration_kind)
diff --git a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceConstructor.cpp b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceConstructor.cpp
index 0f40dd5429..026f633d7c 100644
--- a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceConstructor.cpp
+++ b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceConstructor.cpp
@@ -36,7 +36,7 @@ JS::ThrowCompletionOr<JS::Object*> WebAssemblyInstanceConstructor::construct(Fun
return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAnObjectOfType, "WebAssembly.Module");
auto& module_object = static_cast<WebAssemblyModuleObject&>(*module_argument);
auto result = TRY(WebAssemblyObject::instantiate_module(vm, module_object.module()));
- return heap().allocate<WebAssemblyInstanceObject>(realm, realm, result);
+ return heap().allocate<WebAssemblyInstanceObject>(realm, realm, result).ptr();
}
void WebAssemblyInstanceConstructor::initialize(JS::Realm& realm)
diff --git a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyMemoryConstructor.cpp b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyMemoryConstructor.cpp
index 1cde4c1994..01beff4b04 100644
--- a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyMemoryConstructor.cpp
+++ b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyMemoryConstructor.cpp
@@ -46,7 +46,7 @@ JS::ThrowCompletionOr<JS::Object*> WebAssemblyMemoryConstructor::construct(Funct
if (!address.has_value())
return vm.throw_completion<JS::TypeError>("Wasm Memory allocation failed");
- return vm.heap().allocate<WebAssemblyMemoryObject>(realm, realm, *address);
+ return vm.heap().allocate<WebAssemblyMemoryObject>(realm, realm, *address).ptr();
}
void WebAssemblyMemoryConstructor::initialize(JS::Realm& realm)
diff --git a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyModuleConstructor.cpp b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyModuleConstructor.cpp
index 17c985ff3c..2ffba3ebf6 100644
--- a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyModuleConstructor.cpp
+++ b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyModuleConstructor.cpp
@@ -33,7 +33,7 @@ JS::ThrowCompletionOr<JS::Object*> WebAssemblyModuleConstructor::construct(Funct
auto* buffer_object = TRY(vm.argument(0).to_object(vm));
auto result = TRY(parse_module(vm, buffer_object));
- return heap().allocate<WebAssemblyModuleObject>(realm, realm, result);
+ return heap().allocate<WebAssemblyModuleObject>(realm, realm, result).ptr();
}
void WebAssemblyModuleConstructor::initialize(JS::Realm& realm)
diff --git a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyTableConstructor.cpp b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyTableConstructor.cpp
index ca14bc3d8b..2a0db96664 100644
--- a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyTableConstructor.cpp
+++ b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyTableConstructor.cpp
@@ -77,7 +77,7 @@ JS::ThrowCompletionOr<JS::Object*> WebAssemblyTableConstructor::construct(Functi
for (auto& element : table.elements())
element = reference;
- return vm.heap().allocate<WebAssemblyTableObject>(realm, realm, *address);
+ return vm.heap().allocate<WebAssemblyTableObject>(realm, realm, *address).ptr();
}
void WebAssemblyTableConstructor::initialize(JS::Realm& realm)
diff --git a/Userland/Libraries/LibWeb/WebIDL/DOMException.cpp b/Userland/Libraries/LibWeb/WebIDL/DOMException.cpp
index 8553fda7f5..723eeef204 100644
--- a/Userland/Libraries/LibWeb/WebIDL/DOMException.cpp
+++ b/Userland/Libraries/LibWeb/WebIDL/DOMException.cpp
@@ -11,12 +11,12 @@ namespace Web::WebIDL {
JS::NonnullGCPtr<DOMException> DOMException::create(JS::Realm& realm, FlyString const& name, FlyString const& message)
{
- return *realm.heap().allocate<DOMException>(realm, realm, name, message);
+ return realm.heap().allocate<DOMException>(realm, realm, name, message);
}
JS::NonnullGCPtr<DOMException> DOMException::construct_impl(JS::Realm& realm, FlyString const& message, FlyString const& name)
{
- return *realm.heap().allocate<DOMException>(realm, realm, name, message);
+ return realm.heap().allocate<DOMException>(realm, realm, name, message);
}
DOMException::DOMException(JS::Realm& realm, FlyString const& name, FlyString const& message)
diff --git a/Userland/Libraries/LibWeb/WebSockets/WebSocket.cpp b/Userland/Libraries/LibWeb/WebSockets/WebSocket.cpp
index a2f8ff618b..e8abf405d6 100644
--- a/Userland/Libraries/LibWeb/WebSockets/WebSocket.cpp
+++ b/Userland/Libraries/LibWeb/WebSockets/WebSocket.cpp
@@ -57,7 +57,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<WebSocket>> WebSocket::construct_impl(JS::R
return WebIDL::SyntaxError::create(realm, "Presence of URL fragment is invalid");
// 5. If `protocols` is a string, set `protocols` to a sequence consisting of just that string
// 6. If any of the values in `protocols` occur more than once or otherwise fail to match the requirements, throw SyntaxError
- return JS::NonnullGCPtr(*realm.heap().allocate<WebSocket>(realm, window, url_record));
+ return realm.heap().allocate<WebSocket>(realm, window, url_record);
}
WebSocket::WebSocket(HTML::Window& window, AK::URL& url)
diff --git a/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp b/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp
index 50f11db242..71fe81eaf8 100644
--- a/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp
+++ b/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp
@@ -44,7 +44,7 @@ JS::NonnullGCPtr<XMLHttpRequest> XMLHttpRequest::construct_impl(JS::Realm& realm
{
auto& window = verify_cast<HTML::Window>(realm.global_object());
auto author_request_headers = Fetch::Infrastructure::HeaderList::create(realm.vm());
- return *realm.heap().allocate<XMLHttpRequest>(realm, window, *author_request_headers);
+ return realm.heap().allocate<XMLHttpRequest>(realm, window, *author_request_headers);
}
XMLHttpRequest::XMLHttpRequest(HTML::Window& window, Fetch::Infrastructure::HeaderList& author_request_headers)
diff --git a/Userland/Services/WebContent/WebContentConsoleClient.cpp b/Userland/Services/WebContent/WebContentConsoleClient.cpp
index 0afd762d69..e88bee4df8 100644
--- a/Userland/Services/WebContent/WebContentConsoleClient.cpp
+++ b/Userland/Services/WebContent/WebContentConsoleClient.cpp
@@ -25,7 +25,7 @@ WebContentConsoleClient::WebContentConsoleClient(JS::Console& console, JS::Realm
, m_client(client)
{
auto& window = verify_cast<Web::HTML::Window>(realm.global_object());
- m_console_global_environment_extensions = realm.heap().allocate<ConsoleGlobalEnvironmentExtensions>(realm, realm, window);
+ m_console_global_environment_extensions = realm.heap().allocate<ConsoleGlobalEnvironmentExtensions>(realm, realm, window).ptr();
}
void WebContentConsoleClient::handle_input(DeprecatedString const& js_source)