diff --git a/Userland/Libraries/LibJS/Runtime/ArrayBufferPrototype.cpp b/Userland/Libraries/LibJS/Runtime/ArrayBufferPrototype.cpp index 7ca18b68b4..fbfcddeac0 100644 --- a/Userland/Libraries/LibJS/Runtime/ArrayBufferPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/ArrayBufferPrototype.cpp @@ -41,6 +41,9 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayBufferPrototype::slice) { auto& realm = *vm.current_realm(); + auto start = vm.argument(0); + auto end = vm.argument(1); + // 1. Let O be the this value. // 2. Perform ? RequireInternalSlot(O, [[ArrayBufferData]]). auto array_buffer_object = TRY(typed_this_value(vm)); @@ -56,7 +59,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayBufferPrototype::slice) auto length = array_buffer_object->byte_length(); // 6. Let relativeStart be ? ToIntegerOrInfinity(start). - auto relative_start = TRY(vm.argument(0).to_integer_or_infinity(vm)); + auto relative_start = TRY(start.to_integer_or_infinity(vm)); double first; // 7. If relativeStart is -∞, let first be 0. @@ -70,7 +73,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayBufferPrototype::slice) first = min(relative_start, (double)length); // 10. If end is undefined, let relativeEnd be len; else let relativeEnd be ? ToIntegerOrInfinity(end). - auto relative_end = vm.argument(1).is_undefined() ? length : TRY(vm.argument(1).to_integer_or_infinity(vm)); + auto relative_end = end.is_undefined() ? length : TRY(end.to_integer_or_infinity(vm)); double final; // 11. If relativeEnd is -∞, let final be 0.