From 1a8b5ef80a9c3360547c6817804642b680f2df84 Mon Sep 17 00:00:00 2001 From: Idan Horowitz Date: Sat, 30 Apr 2022 20:06:57 +0300 Subject: LibJS: Stop fetching GlobalObject from target's realm in ArrayBuffer A function object's realm is not necessarily non-null (like when called via the Reflect API), so we can't blindly dereference it. Instead use the object's own GlobalObject. --- Userland/Libraries/LibJS/Runtime/ArrayBufferConstructor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Userland/Libraries') diff --git a/Userland/Libraries/LibJS/Runtime/ArrayBufferConstructor.cpp b/Userland/Libraries/LibJS/Runtime/ArrayBufferConstructor.cpp index 21e4ca444f..ac1e9f8500 100644 --- a/Userland/Libraries/LibJS/Runtime/ArrayBufferConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/ArrayBufferConstructor.cpp @@ -65,7 +65,7 @@ static ThrowCompletionOr> get_array_buffer_max_byte_length_opti // 1.2.1 ArrayBuffer ( length [, options ] ), https://tc39.es/proposal-resizablearraybuffer/#sec-arraybuffer-constructor ThrowCompletionOr ArrayBufferConstructor::construct(FunctionObject& new_target) { - auto& global_object = new_target.realm()->global_object(); + auto& global_object = this->global_object(); auto& vm = this->vm(); // 1. If NewTarget is undefined, throw a TypeError exception. -- cgit v1.2.3