mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 04:17:35 +00:00
Everywhere: Behaviour => Behavior
This commit is contained in:
parent
55b0b06897
commit
6ad427993a
48 changed files with 120 additions and 120 deletions
|
@ -104,7 +104,7 @@ bool Array::set_length(PropertyDescriptor const& property_descriptor)
|
|||
// 15. Let succeeded be ! OrdinaryDefineOwnProperty(A, "length", newLenDesc).
|
||||
// 16. If succeeded is false, return false.
|
||||
// NOTE: Because the length property does not actually exist calling OrdinaryDefineOwnProperty
|
||||
// will result in unintended behaviour, so instead we only implement here the small subset of
|
||||
// will result in unintended behavior, so instead we only implement here the small subset of
|
||||
// checks performed inside of it that would have mattered to us:
|
||||
|
||||
// 10.1.6.3 ValidateAndApplyPropertyDescriptor ( O, P, extensible, Desc, current ), https://tc39.es/ecma262/#sec-validateandapplypropertydescriptor
|
||||
|
|
|
@ -115,7 +115,7 @@ void iterator_close(Object& iterator)
|
|||
auto& vm = iterator.vm();
|
||||
auto& global_object = iterator.global_object();
|
||||
|
||||
// Emulates `completion` behaviour
|
||||
// Emulates `completion` behavior
|
||||
auto* completion_exception = vm.exception();
|
||||
vm.clear_exception();
|
||||
auto unwind_until = vm.unwind_until();
|
||||
|
|
|
@ -252,7 +252,7 @@ JS_DEFINE_NATIVE_FUNCTION(StringPrototype::repeat)
|
|||
if (n == 0)
|
||||
return js_string(vm, String::empty());
|
||||
|
||||
// NOTE: This is an optimization, it is not required by the specification but it produces equivalent behaviour
|
||||
// NOTE: This is an optimization, it is not required by the specification but it produces equivalent behavior
|
||||
if (string->is_empty())
|
||||
return js_string(vm, String::empty());
|
||||
|
||||
|
|
|
@ -173,7 +173,7 @@ Optional<ISODate> regulate_iso_date(GlobalObject& global_object, double year, do
|
|||
// 3. If overflow is "reject", then
|
||||
if (overflow == "reject"sv) {
|
||||
// IMPLEMENTATION DEFINED: This is an optimization that allows us to treat these doubles as normal integers from this point onwards.
|
||||
// This does not change the exposed behaviour as the call to IsValidISODate will immediately check that these values are valid ISO
|
||||
// This does not change the exposed behavior as the call to IsValidISODate will immediately check that these values are valid ISO
|
||||
// values (for years: -273975 - 273975, for months: 1 - 12, for days: 1 - 31) all of which are subsets of this check.
|
||||
if (!AK::is_within_range<i32>(year) || !AK::is_within_range<u8>(month) || !AK::is_within_range<u8>(day)) {
|
||||
vm.throw_exception<RangeError>(global_object, ErrorType::TemporalInvalidPlainDate);
|
||||
|
@ -193,7 +193,7 @@ Optional<ISODate> regulate_iso_date(GlobalObject& global_object, double year, do
|
|||
// 4. If overflow is "constrain", then
|
||||
else if (overflow == "constrain"sv) {
|
||||
// IMPLEMENTATION DEFINED: This is an optimization that allows us to treat this double as normal integer from this point onwards. This
|
||||
// does not change the exposed behaviour as the parent's call to CreateTemporalDate will immediately check that this value is a valid
|
||||
// does not change the exposed behavior as the parent's call to CreateTemporalDate will immediately check that this value is a valid
|
||||
// ISO value for years: -273975 - 273975, which is a subset of this check.
|
||||
if (!AK::is_within_range<i32>(year)) {
|
||||
vm.throw_exception<RangeError>(global_object, ErrorType::TemporalInvalidPlainDate);
|
||||
|
|
|
@ -73,7 +73,7 @@ Value PlainDateConstructor::construct(FunctionObject& new_target)
|
|||
return {};
|
||||
|
||||
// IMPLEMENTATION DEFINED: This is an optimization that allows us to treat these doubles as normal integers from this point onwards.
|
||||
// This does not change the exposed behaviour as the call to CreateTemporalDate will immediately check that these values are valid
|
||||
// This does not change the exposed behavior as the call to CreateTemporalDate will immediately check that these values are valid
|
||||
// ISO values (for years: -273975 - 273975, for months: 1 - 12, for days: 1 - 31) all of which are subsets of this check.
|
||||
if (!AK::is_within_range<i32>(y) || !AK::is_within_range<u8>(m) || !AK::is_within_range<u8>(d)) {
|
||||
vm.throw_exception<RangeError>(global_object, ErrorType::TemporalInvalidPlainDate);
|
||||
|
|
|
@ -103,7 +103,7 @@ Value PlainDateTimeConstructor::construct(FunctionObject& new_target)
|
|||
return {};
|
||||
|
||||
// IMPLEMENTATION DEFINED: This is an optimization that allows us to treat these doubles as normal integers from this point onwards.
|
||||
// This does not change the exposed behaviour as the call to CreateTemporalDateTime will immediately check that these values are valid
|
||||
// This does not change the exposed behavior as the call to CreateTemporalDateTime will immediately check that these values are valid
|
||||
// ISO values (for years: -273975 - 273975, for months: 1 - 12, for days: 1 - 31, for hours: 0 - 23, for minutes and seconds: 0 - 59,
|
||||
// milliseconds, microseconds, and nanoseconds: 0 - 999) all of which are subsets of this check.
|
||||
if (!AK::is_within_range<i32>(iso_year) || !AK::is_within_range<u8>(iso_month) || !AK::is_within_range<u8>(iso_day) || !AK::is_within_range<u8>(hour) || !AK::is_within_range<u8>(minute) || !AK::is_within_range<u8>(second) || !AK::is_within_range<u16>(millisecond) || !AK::is_within_range<u16>(microsecond) || !AK::is_within_range<u16>(nanosecond)) {
|
||||
|
|
|
@ -78,7 +78,7 @@ Value PlainMonthDayConstructor::construct(FunctionObject& new_target)
|
|||
return {};
|
||||
|
||||
// IMPLEMENTATION DEFINED: This is an optimization that allows us to treat these doubles as normal integers from this point onwards.
|
||||
// This does not change the exposed behaviour as the call to CreateTemporalMonthDay will immediately check that these values are valid
|
||||
// This does not change the exposed behavior as the call to CreateTemporalMonthDay will immediately check that these values are valid
|
||||
// ISO values (for years: -273975 - 273975, for months: 1 - 12, for days: 1 - 31) all of which are subsets of this check.
|
||||
if (!AK::is_within_range<i32>(ref) || !AK::is_within_range<u8>(m) || !AK::is_within_range<u8>(d)) {
|
||||
vm.throw_exception<RangeError>(global_object, ErrorType::TemporalInvalidPlainYearMonth);
|
||||
|
|
|
@ -81,7 +81,7 @@ Value PlainTimeConstructor::construct(FunctionObject& new_target)
|
|||
return {};
|
||||
|
||||
// IMPLEMENTATION DEFINED: This is an optimization that allows us to treat these doubles as normal integers from this point onwards.
|
||||
// This does not change the exposed behaviour as the call to CreateTemporalTime will immediately check that these values are valid
|
||||
// This does not change the exposed behavior as the call to CreateTemporalTime will immediately check that these values are valid
|
||||
// ISO values (for hours: 0 - 23, for minutes and seconds: 0 - 59, milliseconds, microseconds, and nanoseconds: 0 - 999) all of which
|
||||
// are subsets of this check.
|
||||
if (!AK::is_within_range<u8>(hour) || !AK::is_within_range<u8>(minute) || !AK::is_within_range<u8>(second) || !AK::is_within_range<u16>(millisecond) || !AK::is_within_range<u16>(microsecond) || !AK::is_within_range<u16>(nanosecond)) {
|
||||
|
|
|
@ -44,7 +44,7 @@ Optional<ISOYearMonth> regulate_iso_year_month(GlobalObject& global_object, doub
|
|||
// 3. If overflow is "constrain", then
|
||||
if (overflow == "constrain"sv) {
|
||||
// IMPLEMENTATION DEFINED: This is an optimization that allows us to treat `year` (a double) as normal integer from this point onwards.
|
||||
// This does not change the exposed behaviour as the subsequent call to CreateTemporalYearMonth will check that its value is a valid ISO
|
||||
// This does not change the exposed behavior as the subsequent call to CreateTemporalYearMonth will check that its value is a valid ISO
|
||||
// values (for years: -273975 - 273975) which is a subset of this check.
|
||||
// If RegulateISOYearMonth is ever used outside ISOYearMonthFromFields, this may need to be changed.
|
||||
if (!AK::is_within_range<i32>(year)) {
|
||||
|
@ -59,7 +59,7 @@ Optional<ISOYearMonth> regulate_iso_year_month(GlobalObject& global_object, doub
|
|||
// 4. If overflow is "reject", then
|
||||
if (overflow == "reject"sv) {
|
||||
// IMPLEMENTATION DEFINED: This is an optimization that allows us to treat these doubles as normal integers from this point onwards.
|
||||
// This does not change the exposed behaviour as the call to IsValidISOMonth and subsequent call to CreateTemporalDateTime will check
|
||||
// This does not change the exposed behavior as the call to IsValidISOMonth and subsequent call to CreateTemporalDateTime will check
|
||||
// that these values are valid ISO values (for years: -273975 - 273975, for months: 1 - 12) all of which are subsets of this check.
|
||||
if (!AK::is_within_range<i32>(year) || !AK::is_within_range<u8>(month)) {
|
||||
vm.throw_exception<RangeError>(global_object, ErrorType::TemporalInvalidPlainYearMonth);
|
||||
|
|
|
@ -78,7 +78,7 @@ Value PlainYearMonthConstructor::construct(FunctionObject& new_target)
|
|||
return {};
|
||||
|
||||
// IMPLEMENTATION DEFINED: This is an optimization that allows us to treat these doubles as normal integers from this point onwards.
|
||||
// This does not change the exposed behaviour as the call to CreateTemporalYearMonth will immediately check that these values are valid
|
||||
// This does not change the exposed behavior as the call to CreateTemporalYearMonth will immediately check that these values are valid
|
||||
// ISO values (for years: -273975 - 273975, for months: 1 - 12, for days: 1 - 31) all of which are subsets of this check.
|
||||
if (!AK::is_within_range<i32>(y) || !AK::is_within_range<u8>(m) || !AK::is_within_range<u8>(ref)) {
|
||||
vm.throw_exception<RangeError>(global_object, ErrorType::TemporalInvalidPlainYearMonth);
|
||||
|
|
|
@ -22,7 +22,7 @@ test("length is 2", () => {
|
|||
});
|
||||
});
|
||||
|
||||
describe("normal behaviour", () => {
|
||||
describe("normal behavior", () => {
|
||||
test("Noop", () => {
|
||||
TYPED_ARRAYS.forEach(T => {
|
||||
const array = new T([1, 2]);
|
||||
|
@ -37,7 +37,7 @@ describe("normal behaviour", () => {
|
|||
});
|
||||
});
|
||||
|
||||
test("basic behaviour", () => {
|
||||
test("basic behavior", () => {
|
||||
TYPED_ARRAYS.forEach(T => {
|
||||
const array = new T([1, 2, 3]);
|
||||
expect(array.copyWithin(1, 2)).toEqual(array);
|
||||
|
|
|
@ -112,7 +112,7 @@ describe("errors", () => {
|
|||
});
|
||||
});
|
||||
|
||||
describe("normal behaviour", () => {
|
||||
describe("normal behavior", () => {
|
||||
test("never calls callback with empty array", () => {
|
||||
TYPED_ARRAYS.forEach(T => {
|
||||
let callbackCalled = 0;
|
||||
|
|
|
@ -44,7 +44,7 @@ describe("errors", () => {
|
|||
BIGINT_TYPED_ARRAYS.forEach(T => errorTests(T));
|
||||
});
|
||||
|
||||
describe("normal behaviour", () => {
|
||||
describe("normal behavior", () => {
|
||||
test("basic functionality", () => {
|
||||
TYPED_ARRAYS.forEach(T => {
|
||||
const typedArray = new T([1, 2, 3]);
|
||||
|
|
|
@ -44,7 +44,7 @@ describe("errors", () => {
|
|||
BIGINT_TYPED_ARRAYS.forEach(T => errorTests(T));
|
||||
});
|
||||
|
||||
describe("normal behaviour", () => {
|
||||
describe("normal behavior", () => {
|
||||
test("basic functionality", () => {
|
||||
TYPED_ARRAYS.forEach(T => {
|
||||
const typedArray = new T([1, 2, 3]);
|
||||
|
|
|
@ -44,7 +44,7 @@ describe("errors", () => {
|
|||
BIGINT_TYPED_ARRAYS.forEach(T => errorTests(T));
|
||||
});
|
||||
|
||||
describe("normal behaviour", () => {
|
||||
describe("normal behavior", () => {
|
||||
test("basic functionality", () => {
|
||||
TYPED_ARRAYS.forEach(T => {
|
||||
const typedArray = new T([1, 2, 3]);
|
||||
|
|
|
@ -44,7 +44,7 @@ describe("errors", () => {
|
|||
BIGINT_TYPED_ARRAYS.forEach(T => errorTests(T));
|
||||
});
|
||||
|
||||
describe("normal behaviour", () => {
|
||||
describe("normal behavior", () => {
|
||||
test("basic functionality", () => {
|
||||
TYPED_ARRAYS.forEach(T => {
|
||||
const typedArray = new T([1, 2, 3]);
|
||||
|
|
|
@ -44,7 +44,7 @@ describe("errors", () => {
|
|||
BIGINT_TYPED_ARRAYS.forEach(T => errorTests(T));
|
||||
});
|
||||
|
||||
describe("normal behaviour", () => {
|
||||
describe("normal behavior", () => {
|
||||
test("never calls callback with empty array", () => {
|
||||
function emptyTest(T) {
|
||||
var callbackCalled = 0;
|
||||
|
|
|
@ -144,7 +144,7 @@ describe("errors", () => {
|
|||
});
|
||||
});
|
||||
|
||||
describe("normal behaviour", () => {
|
||||
describe("normal behavior", () => {
|
||||
test("never calls callback with empty array", () => {
|
||||
TYPED_ARRAYS.forEach(T => {
|
||||
let callbackCalled = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue