From f3117d46dc872a2d0f57273293b5691777b06279 Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Tue, 16 Aug 2022 20:33:17 +0100 Subject: LibJS: Remove GlobalObject from VM::throw_completion() This is a continuation of the previous five commits. A first big step into the direction of no longer having to pass a realm (or currently, a global object) trough layers upon layers of AOs! Unlike the create() APIs we can safely assume that this is only ever called when a running execution context and therefore current realm exists. If not, you can always manually allocate the Error and put it in a Completion :^) In the spec, throw exceptions implicitly use the current realm's intrinsics as well: https://tc39.es/ecma262/#sec-throw-an-exception --- Userland/Libraries/LibWeb/Fetch/Headers.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Userland/Libraries/LibWeb/Fetch/Headers.cpp') diff --git a/Userland/Libraries/LibWeb/Fetch/Headers.cpp b/Userland/Libraries/LibWeb/Fetch/Headers.cpp index 72bfc49966..24a754e31b 100644 --- a/Userland/Libraries/LibWeb/Fetch/Headers.cpp +++ b/Userland/Libraries/LibWeb/Fetch/Headers.cpp @@ -165,7 +165,7 @@ JS::ThrowCompletionOr Headers::for_each(ForEachCallback callback) auto value_pairs_to_iterate_over = [&]() -> JS::ThrowCompletionOr> { auto headers_or_error = m_header_list.sort_and_combine(); if (headers_or_error.is_error()) - return vm.throw_completion(global_object, JS::ErrorType::NotEnoughMemoryToAllocate); + return vm.throw_completion(JS::ErrorType::NotEnoughMemoryToAllocate); return headers_or_error.release_value(); }; -- cgit v1.2.3