diff --git a/Userland/Libraries/LibJS/Runtime/ArrayBufferPrototype.cpp b/Userland/Libraries/LibJS/Runtime/ArrayBufferPrototype.cpp index e71aa4b5fb..0039aa1a61 100644 --- a/Userland/Libraries/LibJS/Runtime/ArrayBufferPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/ArrayBufferPrototype.cpp @@ -48,7 +48,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayBufferPrototype::byte_length_getter) // 3. If IsSharedArrayBuffer(O) is true, throw a TypeError exception. if (array_buffer_object->is_shared_array_buffer()) - return vm.throw_completion(ErrorType::ThisCannotBeSharedArrayBuffer); + return vm.throw_completion(ErrorType::SharedArrayBuffer); // NOTE: These steps are done in byte_length() // 4. If IsDetachedBuffer(O) is true, return +0𝔽. @@ -66,7 +66,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayBufferPrototype::max_byte_length) // 3. If IsSharedArrayBuffer(O) is true, throw a TypeError exception. if (array_buffer_object->is_shared_array_buffer()) - return vm.throw_completion(ErrorType::ThisCannotBeSharedArrayBuffer); + return vm.throw_completion(ErrorType::SharedArrayBuffer); // 4. If IsDetachedBuffer(O) is true, return +0𝔽. if (array_buffer_object->is_detached()) @@ -98,7 +98,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayBufferPrototype::resizable) // 3. If IsSharedArrayBuffer(O) is true, throw a TypeError exception. if (array_buffer_object->is_shared_array_buffer()) - return vm.throw_completion(ErrorType::ThisCannotBeSharedArrayBuffer); + return vm.throw_completion(ErrorType::SharedArrayBuffer); // 4. If IsFixedLengthArrayBuffer(O) is false, return true; otherwise return false. return Value { !array_buffer_object->is_fixed_length() }; @@ -118,7 +118,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayBufferPrototype::resize) // 3. If IsSharedArrayBuffer(O) is true, throw a TypeError exception. if (array_buffer_object->is_shared_array_buffer()) - return vm.throw_completion(ErrorType::ThisCannotBeSharedArrayBuffer); + return vm.throw_completion(ErrorType::SharedArrayBuffer); // 4. Let newByteLength be ? ToIndex(newLength). auto new_byte_length = TRY(new_length.to_index(vm)); diff --git a/Userland/Libraries/LibJS/Runtime/ErrorTypes.h b/Userland/Libraries/LibJS/Runtime/ErrorTypes.h index 09fd781905..061ddc981b 100644 --- a/Userland/Libraries/LibJS/Runtime/ErrorTypes.h +++ b/Userland/Libraries/LibJS/Runtime/ErrorTypes.h @@ -224,6 +224,7 @@ M(RestrictedGlobalProperty, "Cannot declare global property '{}'") \ M(ShadowRealmEvaluateAbruptCompletion, "The evaluated script did not complete normally") \ M(ShadowRealmWrappedValueNonFunctionObject, "Wrapped value must be primitive or a function object, got {}") \ + M(SharedArrayBuffer, "The array buffer object cannot be a SharedArrayBuffer") \ M(SpeciesConstructorDidNotCreate, "Species constructor did not create {}") \ M(SpeciesConstructorReturned, "Species constructor returned {}") \ M(StringNonGlobalRegExp, "RegExp argument is non-global") \ @@ -298,7 +299,6 @@ M(TemporalUnknownCriticalAnnotation, "Unknown annotation key in critical annotation: '{}'") \ M(TemporalZonedDateTimeRoundZeroOrNegativeLengthDay, "Cannot round a ZonedDateTime in a calendar or time zone that has zero or " \ "negative length days") \ - M(ThisCannotBeSharedArrayBuffer, "|this| cannot be a SharedArrayBuffer") \ M(ThisHasNotBeenInitialized, "|this| has not been initialized") \ M(ThisIsAlreadyInitialized, "|this| is already initialized") \ M(ToObjectNullOrUndefined, "ToObject on null or undefined") \