summaryrefslogtreecommitdiff
path: root/Userland/Libraries
diff options
context:
space:
mode:
authorIdan Horowitz <idan.horowitz@gmail.com>2022-04-30 20:06:57 +0300
committerLinus Groh <mail@linusgroh.de>2022-04-30 21:55:39 +0200
commit1a8b5ef80a9c3360547c6817804642b680f2df84 (patch)
treec7d53a9b2020a3934658471ea76c40917a829ba4 /Userland/Libraries
parent90982576684ca88b1f00ecb20010b9e9f7ff2db8 (diff)
downloadserenity-1a8b5ef80a9c3360547c6817804642b680f2df84.zip
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.
Diffstat (limited to 'Userland/Libraries')
-rw-r--r--Userland/Libraries/LibJS/Runtime/ArrayBufferConstructor.cpp2
1 files changed, 1 insertions, 1 deletions
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<Optional<size_t>> get_array_buffer_max_byte_length_opti
// 1.2.1 ArrayBuffer ( length [, options ] ), https://tc39.es/proposal-resizablearraybuffer/#sec-arraybuffer-constructor
ThrowCompletionOr<Object*> 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.