diff --git a/third_party/test262/harness/assert.js b/third_party/test262/harness/assert.js index 7ced0cd0b4129f..b4827d2f5ac096 100644 --- a/third_party/test262/harness/assert.js +++ b/third_party/test262/harness/assert.js @@ -3,10 +3,52 @@ /*--- description: | Collection of assertion functions used throughout test262 -defines: [assert] +defines: + - assert + - formatIdentityFreeValue + - formatSimpleValue + - isNegativeZero + - isPrimitive ---*/ +function isNegativeZero(value) { + return value === 0 && 1 / value === -Infinity; +} + +function isPrimitive(value) { + return !value || (typeof value !== 'object' && typeof value !== 'function'); +} + +function formatIdentityFreeValue(value) { + switch (value === null ? 'null' : typeof value) { + case 'string': + return typeof JSON !== "undefined" ? JSON.stringify(value) : '"' + value + '"'; + case 'bigint': + return String(value) + "n"; + case 'number': + if (isNegativeZero(value)) return '-0'; + // falls through + case 'boolean': + case 'undefined': + case 'null': + return String(value); + } +} + +function formatSimpleValue(value) { + var basic = formatIdentityFreeValue(value); + if (basic) return basic; + try { + return String(value); + } catch (err) { + if (err.name === 'TypeError') { + return Object.prototype.toString.call(value); + } + throw err; + } +} + function assert(mustBeTrue, message) { if (mustBeTrue === true) { return; @@ -101,10 +143,6 @@ assert.throws = function (expectedErrorConstructor, func, message) { throw new Test262Error(message); }; -function isPrimitive(value) { - return !value || (typeof value !== 'object' && typeof value !== 'function'); -} - assert.compareArray = function (actual, expected, message) { message = message === undefined ? '' : message; @@ -113,15 +151,15 @@ assert.compareArray = function (actual, expected, message) { } if (isPrimitive(actual)) { - assert(false, `Actual argument [${actual}] shouldn't be primitive. ${message}`); + assert(false, "Actual argument [" + actual + "] shouldn't be primitive. " + String(message)); } else if (isPrimitive(expected)) { - assert(false, `Expected argument [${expected}] shouldn't be primitive. ${message}`); + assert(false, "Expected argument [" + expected + "] shouldn't be primitive. " + String(message)); } var result = compareArray(actual, expected); if (result) return; var format = compareArray.format; - assert(false, `Actual ${format(actual)} and expected ${format(expected)} should have the same contents. ${message}`); + assert(false, "Actual " + format(actual) + " and expected " + format(expected) + " should have the same contents. " + String(message)); }; function compareArray(a, b) { @@ -137,34 +175,9 @@ function compareArray(a, b) { } compareArray.format = function (arrayLike) { - return `[${Array.prototype.map.call(arrayLike, String).join(', ')}]`; + return "[" + Array.prototype.map.call(arrayLike, String).join(", ") + "]"; }; -assert._formatIdentityFreeValue = function formatIdentityFreeValue(value) { - switch (value === null ? 'null' : typeof value) { - case 'string': - return typeof JSON !== "undefined" ? JSON.stringify(value) : `"${value}"`; - case 'bigint': - return `${value}n`; - case 'number': - if (value === 0 && 1 / value === -Infinity) return '-0'; - // falls through - case 'boolean': - case 'undefined': - case 'null': - return String(value); - } -}; +assert._formatIdentityFreeValue = formatIdentityFreeValue; -assert._toString = function (value) { - var basic = assert._formatIdentityFreeValue(value); - if (basic) return basic; - try { - return String(value); - } catch (err) { - if (err.name === 'TypeError') { - return Object.prototype.toString.call(value); - } - throw err; - } -}; +assert._toString = formatSimpleValue; diff --git a/third_party/test262/harness/propertyHelper.js b/third_party/test262/harness/propertyHelper.js index 51cc80c8808966..0acccfe87f0c40 100644 --- a/third_party/test262/harness/propertyHelper.js +++ b/third_party/test262/harness/propertyHelper.js @@ -7,6 +7,7 @@ description: | defines: - verifyProperty - verifyCallableProperty + - verifyAccessorProperty - verifyEqualTo # deprecated - verifyWritable # deprecated - verifyNotWritable # deprecated @@ -16,6 +17,7 @@ defines: - verifyNotConfigurable # deprecated - verifyPrimordialProperty - verifyPrimordialCallableProperty + - verifyPrimordialAccessorProperty ---*/ // @ts-check @@ -37,6 +39,7 @@ var nonIndexNumericPropertyName = Math.pow(2, 32) - 1; * @param {string|symbol} name * @param {PropertyDescriptor|undefined} desc * @param {object} [options] + * @param {boolean} [options.label] * @param {boolean} [options.restore] revert mutations from verifying writable/configurable */ function verifyProperty(obj, name, desc, options) { @@ -44,26 +47,23 @@ function verifyProperty(obj, name, desc, options) { arguments.length > 2, 'verifyProperty should receive at least 3 arguments: obj, name, and descriptor' ); + var label = options && options.label || String(name); var originalDesc = __getOwnPropertyDescriptor(obj, name); - var nameStr = String(name); // Allows checking for undefined descriptor if it's explicitly given. if (desc === undefined) { assert.sameValue( originalDesc, undefined, - "obj['" + nameStr + "'] descriptor should be undefined" + label + " descriptor should be undefined" ); // desc and originalDesc are both undefined, problem solved; return true; } - assert( - __hasOwnProperty(obj, name), - "obj should have an own property " + nameStr - ); + assert(__hasOwnProperty(obj, name), label + " should be an own property"); assert.notSameValue( desc, @@ -86,7 +86,7 @@ function verifyProperty(obj, name, desc, options) { names[i] === "configurable" || names[i] === "get" || names[i] === "set", - "Invalid descriptor field: " + names[i], + "Invalid descriptor field: " + names[i] ); } @@ -94,17 +94,17 @@ function verifyProperty(obj, name, desc, options) { if (__hasOwnProperty(desc, 'value')) { if (!isSameValue(desc.value, originalDesc.value)) { - __push(failures, "obj['" + nameStr + "'] descriptor value should be " + desc.value); + __push(failures, label + " descriptor value should be " + String(desc.value)); } if (!isSameValue(desc.value, obj[name])) { - __push(failures, "obj['" + nameStr + "'] value should be " + desc.value); + __push(failures, label + " value should be " + String(desc.value)); } } if (__hasOwnProperty(desc, 'enumerable') && desc.enumerable !== undefined) { if (desc.enumerable !== originalDesc.enumerable || desc.enumerable !== isEnumerable(obj, name)) { - __push(failures, "obj['" + nameStr + "'] descriptor should " + (desc.enumerable ? '' : 'not ') + "be enumerable"); + __push(failures, label + " descriptor should " + (desc.enumerable ? '' : 'not ') + "be enumerable"); } } @@ -113,14 +113,14 @@ function verifyProperty(obj, name, desc, options) { if (__hasOwnProperty(desc, 'writable') && desc.writable !== undefined) { if (desc.writable !== originalDesc.writable || desc.writable !== isWritable(obj, name)) { - __push(failures, "obj['" + nameStr + "'] descriptor should " + (desc.writable ? '' : 'not ') + "be writable"); + __push(failures, label + " descriptor should " + (desc.writable ? '' : 'not ') + "be writable"); } } if (__hasOwnProperty(desc, 'configurable') && desc.configurable !== undefined) { if (desc.configurable !== originalDesc.configurable || desc.configurable !== isConfigurable(obj, name)) { - __push(failures, "obj['" + nameStr + "'] descriptor should " + (desc.configurable ? '' : 'not ') + "be configurable"); + __push(failures, label + " descriptor should " + (desc.configurable ? '' : 'not ') + "be configurable"); } } @@ -219,13 +219,17 @@ function isWritable(obj, name, verifyProp, value) { * @param {number} functionLength * @param {PropertyDescriptor} [desc] defaults to data property conventions (writable, non-enumerable, configurable) * @param {object} [options] + * @param {boolean} [options.label] + * @param {typeof verifyProperty} [options.verifyProperty] * @param {boolean} [options.restore] revert mutations from verifying writable/configurable */ function verifyCallableProperty(obj, name, functionName, functionLength, desc, options) { - var value = obj[name]; + var label = options && options.label || String(name); + var propertyVerifier = options && options.verifyProperty || verifyProperty; + + var value = obj && obj[name]; - assert.sameValue(typeof value, "function", - "obj['" + String(name) + "'] descriptor should be a function"); + assert.sameValue(typeof value, "function", label + " should be a function"); // Every other data property described in clauses 19 through 28 and in // Annex B.2 has the attributes { [[Writable]]: true, [[Enumerable]]: false, @@ -242,7 +246,7 @@ function verifyCallableProperty(obj, name, functionName, functionLength, desc, o desc.value = value; } - verifyProperty(obj, name, desc, options); + propertyVerifier(obj, name, desc, options); if (functionName === undefined) { if (typeof name === "symbol") { @@ -256,24 +260,125 @@ function verifyCallableProperty(obj, name, functionName, functionLength, desc, o // [[Configurable]]: true }. // https://tc39.es/ecma262/multipage/ecmascript-standard-built-in-objects.html#sec-ecmascript-standard-built-in-objects // https://tc39.es/ecma262/multipage/ordinary-and-exotic-objects-behaviours.html#sec-setfunctionname - verifyProperty(value, "name", { + propertyVerifier(value, "name", { value: functionName, writable: false, enumerable: false, configurable: desc.configurable - }, options); + }, { label: label + " name", restore: options && options.restore }); // Unless otherwise specified, the "length" property of a built-in function // object has the attributes { [[Writable]]: false, [[Enumerable]]: false, // [[Configurable]]: true }. // https://tc39.es/ecma262/multipage/ecmascript-standard-built-in-objects.html#sec-ecmascript-standard-built-in-objects // https://tc39.es/ecma262/multipage/ordinary-and-exotic-objects-behaviours.html#sec-setfunctionlength - verifyProperty(value, "length", { + propertyVerifier(value, "length", { value: functionLength, writable: false, enumerable: false, configurable: desc.configurable - }, options); + }, { label: label + " length", restore: options && options.restore }); +} + +/** + * Verify that there is an accessor property associated with `obj[name]` and + * following the conventions for built-in objects. + * + * @param {object} obj + * @param {string|symbol} name + * @param {object} desc + * @param {boolean} [desc.enumerable] defaults to accessor property conventions (non-enumerable) + * @param {boolean} [desc.configurable] defaults to accessor property conventions (configurable) + * @param {undefined | Function | {name?: string|symbol, length?: number}} [desc.get] if an object, + * absent fields default to getter conventions (name derived from the property key with a "get " + * prefix, length 0) + * @param {undefined | Function | {name?: string|symbol, length?: number}} [desc.set] if an object, + * absent fields default to getter conventions (name derived from the property key with a "set " + * prefix, length 1) + * @param {object} [options] + * @param {boolean} [options.label] + * @param {typeof verifyProperty} [options.verifyProperty] + * @param {typeof verifyCallableProperty} [options.verifyCallableProperty] + * @param {boolean} [options.restore] revert mutations from verifying property attributes + */ +function verifyAccessorProperty(obj, name, desc, options) { + var checkGet = __hasOwnProperty(desc, "get"); + var checkSet = __hasOwnProperty(desc, "set"); + assert( + checkGet || checkSet, + 'verifyAccessorProperty requires at least one of "get" and "set"' + ); + var label = options && options.label || String(name); + var propertyVerifier = options && options.verifyProperty || verifyProperty; + var callabilityVerifier = options && options.verifyCallableProperty || verifyCallableProperty; + + var originalDesc = __getOwnPropertyDescriptor(obj, name); + + // Every built-in function object, including constructors, has a "name" + // property whose value is a String. Unless otherwise specified, this value is + // the name that is given to the function in this specification. Functions + // that are identified as anonymous functions use the empty String as the + // value of the "name" property. For functions that are specified as + // properties of objects, the name value is the property name string used to + // access the function. Functions that are specified as get or set accessor + // functions of built-in properties have "get" or "set" (respectively) passed + // to the prefix parameter when calling CreateBuiltinFunction. + // + // The value of the "name" property is explicitly specified for each built-in + // functions whose property key is a Symbol value. If such an explicitly + // specified value starts with the prefix "get " or "set " and the function + // for which it is specified is a get or set accessor function of a built-in + // property, the value without the prefix is passed to the name parameter, and + // the value "get" or "set" (respectively) is passed to the prefix parameter + // when calling CreateBuiltinFunction. + // https://tc39.es/ecma262/multipage/ecmascript-standard-built-in-objects.html + if (checkGet) { + var expectGetter = desc.get; + var getterLabel = label + " getter"; + if (expectGetter === undefined || typeof expectGetter === "function") { + assert.sameValue(originalDesc.get, expectGetter, getterLabel); + } else { + var getterName = expectGetter.name; + if (getterName === undefined) { + getterName = "get " + (typeof name === "symbol" ? "[" + name.description + "]" : name); + } + var getterLength = expectGetter.length !== undefined ? expectGetter.length : 0; + var getterOptions = { label: getterLabel }; + callabilityVerifier(originalDesc, "get", getterName, getterLength, {}, getterOptions); + } + } + if (checkSet) { + var expectSetter = desc.set; + var setterLabel = label + " setter"; + if (expectSetter === undefined || typeof expectSetter === "function") { + assert.sameValue(originalDesc.set, expectSetter, setterLabel); + } else { + var setterName = expectSetter.name; + if (setterName === undefined) { + setterName = "set " + (typeof name === "symbol" ? "[" + name.description + "]" : name); + } + var setterLength = expectSetter.length !== undefined ? expectSetter.length : 1; + var setterOptions = { label: setterLabel }; + callabilityVerifier(originalDesc, "set", setterName, setterLength, {}, setterOptions); + } + } + + // Every accessor property described in clauses 19 through 28 and in Annex B.2 + // has the attributes { [[Enumerable]]: false, [[Configurable]]: true } unless + // otherwise specified. + // https://tc39.es/ecma262/multipage/ecmascript-standard-built-in-objects.html + var resolvedDesc = { get: originalDesc.get, set: originalDesc.set }; + if (!__hasOwnProperty(desc, "enumerable")) { + resolvedDesc.enumerable = false; + } else if (desc.enumerable !== undefined) { + resolvedDesc.enumerable = desc.enumerable; + } + if (!__hasOwnProperty(desc, "configurable")) { + resolvedDesc.configurable = true; + } else if (desc.configurable !== undefined) { + resolvedDesc.configurable = desc.configurable; + } + propertyVerifier(obj, name, resolvedDesc, options); } /** @@ -367,5 +472,39 @@ var verifyPrimordialProperty = verifyProperty; * Use this function to verify the primordial function-valued properties. * For non-primordial functions, use verifyCallableProperty. * See: https://github.com/tc39/how-we-work/blob/main/terminology.md#primordial + * + * @type {typeof verifyCallableProperty} */ -var verifyPrimordialCallableProperty = verifyCallableProperty; +function verifyPrimordialCallableProperty(obj, name, functionName, functionLength, desc, options) { + var resolvedOptions = { + verifyProperty: options && options.verifyProperty !== undefined + ? options.verifyProperty + : verifyPrimordialProperty + }; + if (options && options.label !== undefined) resolvedOptions.label = options.label; + if (options && options.restore !== undefined) resolvedOptions.restore = options.restore; + + return verifyCallableProperty(obj, name, functionName, functionLength, desc, resolvedOptions); +} + +/** + * Use this function to verify the primordial accessor properties. + * For non-primordial functions, use verifyAccessorProperty. + * See: https://github.com/tc39/how-we-work/blob/main/terminology.md#primordial + * + * @type {typeof verifyAccessorProperty} + */ +function verifyPrimordialAccessorProperty(obj, name, desc, options) { + var resolvedOptions = { + verifyProperty: options && options.verifyProperty !== undefined + ? options.verifyProperty + : verifyPrimordialProperty, + verifyCallableProperty: options && options.verifyCallableProperty !== undefined + ? options.verifyCallableProperty + : verifyPrimordialCallableProperty + }; + if (options && options.label !== undefined) resolvedOptions.label = options.label; + if (options && options.restore !== undefined) resolvedOptions.restore = options.restore; + + return verifyAccessorProperty(obj, name, desc, resolvedOptions); +} diff --git a/third_party/test262/harness/sta.js b/third_party/test262/harness/sta.js index c95ed7a264c550..d291a94f462349 100644 --- a/third_party/test262/harness/sta.js +++ b/third_party/test262/harness/sta.js @@ -11,6 +11,7 @@ defines: [Test262Error, $DONOTEVALUATE] function Test262Error(message) { + if (!(this instanceof Test262Error)) return new Test262Error(message); this.message = message || ""; } diff --git a/third_party/test262/harness/temporalHelpers.js b/third_party/test262/harness/temporalHelpers.js index fb2d3a3fb910ad..7216cc551fc16b 100644 --- a/third_party/test262/harness/temporalHelpers.js +++ b/third_party/test262/harness/temporalHelpers.js @@ -113,6 +113,23 @@ var TemporalHelpers = { ], }, + + /** + * Apple's fork of ICU contains code for these calendars, but they are not yet + * allowed to be supported in AvailableCalendars. See + * https://github.com/tc39/ecma402/blob/main/meetings/notes-2025-12-04.md#datetimeformatconstructor-options-calendar-islamic-fallbackjs-should-allow-other-fallback-values-4677 + */ + NotYetSupportedCalendars: [ + "bangla", + "gujarati", + "kannada", + "marathi", + "odia", + "tamil", + "telugu", + "vikram", + ], + /* * Return the canonical era code. */ diff --git a/third_party/test262/harness/testTypedArray.js b/third_party/test262/harness/testTypedArray.js index e55e626213b945..a6418c2f70bf62 100644 --- a/third_party/test262/harness/testTypedArray.js +++ b/third_party/test262/harness/testTypedArray.js @@ -63,10 +63,6 @@ var allTypedArrayConstructors = typedArrayConstructors.concat(bigIntArrayConstru */ var TypedArray = Object.getPrototypeOf(Int8Array); -function isPrimitive(val) { - return !val || (typeof val !== "object" && typeof val !== "function"); -} - function makePassthrough(TA, primitiveOrIterable) { return primitiveOrIterable; } @@ -106,7 +102,7 @@ function makeArrayBuffer(TA, primitiveOrIterable) { return new TA(arr).buffer; } -var makeResizableArrayBuffer, makeGrownArrayBuffer, makeShrunkArrayBuffer; +var makeResizableArrayBuffer, makeGrownArrayBuffer, makeShrunkArrayBuffer, makeImmutableArrayBuffer; if (ArrayBuffer.prototype.resize) { var copyIntoArrayBuffer = function(destBuffer, srcBuffer) { var destView = new Uint8Array(destBuffer); @@ -156,6 +152,17 @@ if (ArrayBuffer.prototype.resize) { return shrunk; }; } +if (ArrayBuffer.prototype.transferToImmutable) { + makeImmutableArrayBuffer = function makeImmutableArrayBuffer(TA, primitiveOrIterable) { + if (isPrimitive(primitiveOrIterable)) { + var n = Number(primitiveOrIterable) * TA.BYTES_PER_ELEMENT; + if (!(n >= 0 && n < 9007199254740992)) return primitiveOrIterable; + return (new ArrayBuffer(n)).transferToImmutable(); + } + var mutable = makeArrayBuffer(TA, primitiveOrIterable); + return mutable.transferToImmutable(); + }; +} var typedArrayCtorArgFactories = [makePassthrough, makeArray, makeArrayLike]; if (makeIterable) typedArrayCtorArgFactories.push(makeIterable); @@ -163,9 +170,10 @@ typedArrayCtorArgFactories.push(makeArrayBuffer); if (makeResizableArrayBuffer) typedArrayCtorArgFactories.push(makeResizableArrayBuffer); if (makeGrownArrayBuffer) typedArrayCtorArgFactories.push(makeGrownArrayBuffer); if (makeShrunkArrayBuffer) typedArrayCtorArgFactories.push(makeShrunkArrayBuffer); +if (makeImmutableArrayBuffer) typedArrayCtorArgFactories.push(makeImmutableArrayBuffer); /** - * @typedef {"passthrough" | "arraylike" | "iterable" | "arraybuffer" | "resizable"} typedArrayArgFactoryFeature + * @typedef {"passthrough" | "arraylike" | "iterable" | "arraybuffer" | "resizable" | "immutable"} typedArrayArgFactoryFeature */ /** @@ -193,7 +201,8 @@ function ctorArgFactoryMatchesSome(argFactory, features) { argFactory === makeArrayBuffer || argFactory === makeResizableArrayBuffer || argFactory === makeGrownArrayBuffer || - argFactory === makeShrunkArrayBuffer + argFactory === makeShrunkArrayBuffer || + argFactory === makeImmutableArrayBuffer ) { return true; } @@ -207,6 +216,9 @@ function ctorArgFactoryMatchesSome(argFactory, features) { return true; } break; + case "immutable": + if (argFactory === makeImmutableArrayBuffer) return true; + break; default: throw Test262Error("unknown feature: " + features[i]); } @@ -321,9 +333,19 @@ var nonAtomicsFriendlyTypedArrayConstructors = floatArrayConstructors.concat([Ui * * @param {typedArrayConstructorCallback} f - the function to call for each typed array constructor. * @param {Array} selected - An optional Array with filtered typed arrays + * @param {typedArrayArgFactoryFeature[]} [includeArgFactories] - for selecting + * initial constructor argument factory functions, rather than starting with + * all argument factories + * @param {typedArrayArgFactoryFeature[]} [excludeArgFactories] - for excluding + * constructor argument factory functions, after an initial selection */ -function testWithNonAtomicsFriendlyTypedArrayConstructors(f) { - testWithTypedArrayConstructors(f, nonAtomicsFriendlyTypedArrayConstructors); +function testWithNonAtomicsFriendlyTypedArrayConstructors(f, includeArgFactories, excludeArgFactories) { + testWithAllTypedArrayConstructors( + f, + nonAtomicsFriendlyTypedArrayConstructors, + includeArgFactories, + excludeArgFactories + ); } /** @@ -331,16 +353,26 @@ function testWithNonAtomicsFriendlyTypedArrayConstructors(f) { * * @param {typedArrayConstructorCallback} f - the function to call for each typed array constructor. * @param {Array} selected - An optional Array with filtered typed arrays + * @param {typedArrayArgFactoryFeature[]} [includeArgFactories] - for selecting + * initial constructor argument factory functions, rather than starting with + * all argument factories + * @param {typedArrayArgFactoryFeature[]} [excludeArgFactories] - for excluding + * constructor argument factory functions, after an initial selection */ -function testWithAtomicsFriendlyTypedArrayConstructors(f) { - testWithTypedArrayConstructors(f, [ - Int32Array, - Int16Array, - Int8Array, - Uint32Array, - Uint16Array, - Uint8Array, - ]); +function testWithAtomicsFriendlyTypedArrayConstructors(f, includeArgFactories, excludeArgFactories) { + testWithAllTypedArrayConstructors( + f, + [ + Int32Array, + Int16Array, + Int8Array, + Uint32Array, + Uint16Array, + Uint8Array, + ], + includeArgFactories, + excludeArgFactories + ); } /** @@ -367,7 +399,7 @@ function testTypedArrayConversions(byteConversionValues, fn) { } fn(TA, value, exp, initial); }); - }); + }, null, ["passthrough"]); } /** diff --git a/third_party/test262/test/built-ins/ArrayBuffer/isView/arg-is-typedarray-buffer.js b/third_party/test262/test/built-ins/ArrayBuffer/isView/arg-is-typedarray-buffer.js index 8222634cc461de..884d43dbef345d 100644 --- a/third_party/test262/test/built-ins/ArrayBuffer/isView/arg-is-typedarray-buffer.js +++ b/third_party/test262/test/built-ins/ArrayBuffer/isView/arg-is-typedarray-buffer.js @@ -15,8 +15,8 @@ features: [TypedArray] includes: [testTypedArray.js] ---*/ -testWithTypedArrayConstructors(function(ctor) { - var sample = new ctor().buffer; +testWithAllTypedArrayConstructors(function(ctor, makeCtorArg) { + var sample = new ctor(makeCtorArg(0)).buffer; assert.sameValue(ArrayBuffer.isView(sample), false); -}, null, ["passthrough"]); +}); diff --git a/third_party/test262/test/built-ins/ArrayBuffer/isView/arg-is-typedarray-constructor.js b/third_party/test262/test/built-ins/ArrayBuffer/isView/arg-is-typedarray-constructor.js index edad6efeb7afab..f04ce6a05f6956 100644 --- a/third_party/test262/test/built-ins/ArrayBuffer/isView/arg-is-typedarray-constructor.js +++ b/third_party/test262/test/built-ins/ArrayBuffer/isView/arg-is-typedarray-constructor.js @@ -15,6 +15,6 @@ features: [TypedArray] includes: [testTypedArray.js] ---*/ -testWithTypedArrayConstructors(function(ctor) { +testWithAllTypedArrayConstructors(function(ctor) { assert.sameValue(ArrayBuffer.isView(ctor), false); }, null, ["passthrough"]); diff --git a/third_party/test262/test/built-ins/ArrayBuffer/isView/arg-is-typedarray-subclass-instance.js b/third_party/test262/test/built-ins/ArrayBuffer/isView/arg-is-typedarray-subclass-instance.js index 9c280b12397e15..4341f83421e0f4 100644 --- a/third_party/test262/test/built-ins/ArrayBuffer/isView/arg-is-typedarray-subclass-instance.js +++ b/third_party/test262/test/built-ins/ArrayBuffer/isView/arg-is-typedarray-subclass-instance.js @@ -15,10 +15,10 @@ features: [class, TypedArray] includes: [testTypedArray.js] ---*/ -testWithTypedArrayConstructors(function(ctor) { +testWithAllTypedArrayConstructors(function(ctor, makeCtorArg) { class TA extends ctor {} - var sample = new TA(); + var sample = new TA(makeCtorArg(0)); assert(ArrayBuffer.isView(sample)); -}, null, ["passthrough"]); +}); diff --git a/third_party/test262/test/built-ins/ArrayBuffer/isView/arg-is-typedarray.js b/third_party/test262/test/built-ins/ArrayBuffer/isView/arg-is-typedarray.js index 713d51f07e6549..4d6d1e6919063b 100644 --- a/third_party/test262/test/built-ins/ArrayBuffer/isView/arg-is-typedarray.js +++ b/third_party/test262/test/built-ins/ArrayBuffer/isView/arg-is-typedarray.js @@ -15,8 +15,8 @@ features: [TypedArray] includes: [testTypedArray.js] ---*/ -testWithTypedArrayConstructors(function(ctor) { - var sample = new ctor(); +testWithAllTypedArrayConstructors(function(ctor, makeCtorArg) { + var sample = new ctor(makeCtorArg(0)); assert.sameValue(ArrayBuffer.isView(sample), true); -}, null, ["passthrough"]); +}); diff --git a/third_party/test262/test/built-ins/ArrayBuffer/isView/invoked-as-a-fn.js b/third_party/test262/test/built-ins/ArrayBuffer/isView/invoked-as-a-fn.js index 4024087f045f1a..d8678e9b3889c3 100644 --- a/third_party/test262/test/built-ins/ArrayBuffer/isView/invoked-as-a-fn.js +++ b/third_party/test262/test/built-ins/ArrayBuffer/isView/invoked-as-a-fn.js @@ -17,10 +17,10 @@ includes: [testTypedArray.js] var isView = ArrayBuffer.isView; -testWithTypedArrayConstructors(function(ctor) { - var sample = new ctor(); +testWithAllTypedArrayConstructors(function(ctor, makeCtorArg) { + var sample = new ctor(makeCtorArg(0)); assert.sameValue(isView(sample), true, "instance of TypedArray"); -}, null, ["passthrough"]); +}); var dv = new DataView(new ArrayBuffer(1), 0, 0); assert.sameValue(isView(dv), true, "instance of DataView"); diff --git a/third_party/test262/test/built-ins/ArrayBuffer/prototype/immutable/prop-desc.js b/third_party/test262/test/built-ins/ArrayBuffer/prototype/immutable/prop-desc.js new file mode 100644 index 00000000000000..dcdb5fb90c41ef --- /dev/null +++ b/third_party/test262/test/built-ins/ArrayBuffer/prototype/immutable/prop-desc.js @@ -0,0 +1,30 @@ +// Copyright (C) 2025 Richard Gibson. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-get-arraybuffer.prototype.immutable +description: Checks the "immutable" property of ArrayBuffer.prototype. +info: | + ArrayBuffer.prototype.immutable is an accessor property whose set accessor + function is undefined. + + ECMAScript Standard Built-in Objects + ... + For functions that are specified as properties of objects, the name value is + the property name string used to access the function. Functions that are + specified as get or set accessor functions of built-in properties have "get" + or "set" (respectively) passed to the prefix parameter when calling + CreateBuiltinFunction. + ... + Every accessor property described in clauses 19 through 28 and in Annex B.2 + has the attributes { [[Enumerable]]: false, [[Configurable]]: true } unless + otherwise specified. If only a get accessor function is described, the set + accessor function is the default value, undefined. +features: [immutable-arraybuffer] +includes: [propertyHelper.js] +---*/ + +verifyPrimordialAccessorProperty(ArrayBuffer.prototype, "immutable", { + get: { name: "get immutable", length: 0 }, + set: undefined, +}, { label: "ArrayBuffer.prototype.immutable" }); diff --git a/third_party/test262/test/built-ins/ArrayBuffer/prototype/immutable/return-immutable.js b/third_party/test262/test/built-ins/ArrayBuffer/prototype/immutable/return-immutable.js new file mode 100644 index 00000000000000..04abdc0b534f90 --- /dev/null +++ b/third_party/test262/test/built-ins/ArrayBuffer/prototype/immutable/return-immutable.js @@ -0,0 +1,28 @@ +// Copyright (C) 2025 Richard Gibson. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-get-arraybuffer.prototype.immutable +description: Return value according to the [[ArrayBufferIsImmutable]] internal slot. +info: | + get ArrayBuffer.prototype.immutable + 1. Let O be the this value. + 2. Perform ? RequireInternalSlot(O, [[ArrayBufferData]]). + 3. If IsSharedArrayBuffer(O) is true, throw a TypeError exception. + 4. Return IsImmutableBuffer(O). + + IsImmutableBuffer ( arrayBuffer ) + 1. If arrayBuffer has an [[ArrayBufferIsImmutable]] internal slot, return true. + 2. Return false. +features: [ArrayBuffer, immutable-arraybuffer] +includes: [detachArrayBuffer.js] +---*/ + +var ab = new ArrayBuffer(1); +assert.sameValue(ab.immutable, false); + +var iab = ab.transferToImmutable(); +assert.sameValue(iab.immutable, true); + +$DETACHBUFFER(ab); +assert.sameValue(ab.immutable, false); diff --git a/third_party/test262/test/built-ins/ArrayBuffer/prototype/immutable/this-has-no-arraybufferdata-internal.js b/third_party/test262/test/built-ins/ArrayBuffer/prototype/immutable/this-has-no-arraybufferdata-internal.js new file mode 100644 index 00000000000000..e6d6d41844632d --- /dev/null +++ b/third_party/test262/test/built-ins/ArrayBuffer/prototype/immutable/this-has-no-arraybufferdata-internal.js @@ -0,0 +1,45 @@ +// Copyright (C) 2025 Richard Gibson. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-get-arraybuffer.prototype.immutable +description: > + Throws a TypeError exception when `this` does not have a [[ArrayBufferData]] + internal slot +info: | + get ArrayBuffer.prototype.immutable + 1. Let O be the this value. + 2. Perform ? RequireInternalSlot(O, [[ArrayBufferData]]). +features: [DataView, Int8Array, ArrayBuffer, immutable-arraybuffer] +---*/ + +var getter = Object.getOwnPropertyDescriptor( + ArrayBuffer.prototype, "immutable" +).get; + +assert.sameValue(typeof getter, "function", "Getter must exist."); + +var badReceivers = [ + ["plain object", {}], + ["array", []], + ["function", function(){}], + ["ArrayBuffer.prototype", ArrayBuffer.prototype], + ["TypedArray", new Int8Array(8)], + ["DataView", new DataView(new ArrayBuffer(8), 0)] +]; + +for (var i = 0; i < badReceivers.length; i++) { + var label = badReceivers[i][0]; + var value = badReceivers[i][1]; + assert.throws(TypeError, function() { + getter.call(value); + }, label); +} + +assert.throws(TypeError, function() { + ArrayBuffer.prototype.immutable; +}, "invoked as prototype property access"); + +assert.throws(TypeError, function() { + getter(); +}, "invoked as function"); diff --git a/third_party/test262/test/built-ins/ArrayBuffer/prototype/immutable/this-is-not-object.js b/third_party/test262/test/built-ins/ArrayBuffer/prototype/immutable/this-is-not-object.js new file mode 100644 index 00000000000000..fbc7370e839afc --- /dev/null +++ b/third_party/test262/test/built-ins/ArrayBuffer/prototype/immutable/this-is-not-object.js @@ -0,0 +1,39 @@ +// Copyright (C) 2025 Richard Gibson. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-get-arraybuffer.prototype.immutable +description: Throws a TypeError exception when `this` is not an object +info: | + get ArrayBuffer.prototype.immutable + 1. Let O be the this value. + 2. Perform ? RequireInternalSlot(O, [[ArrayBufferData]]). +features: [ArrayBuffer, immutable-arraybuffer] +---*/ + +var getter = Object.getOwnPropertyDescriptor( + ArrayBuffer.prototype, "immutable" +).get; + +assert.sameValue(typeof getter, "function", "Getter must exist."); + +var badReceivers = [ + ["undefined", undefined], + ["null", null], + ["number", 42], + ["string", "1"], + ["true", true], + ["false", false], + typeof Symbol === "undefined" ? undefined : ["unique symbol", Symbol("s")], + typeof Symbol === "undefined" || !Symbol.for ? undefined : ["registered symbol", Symbol.for("s")], + typeof BigInt === "undefined" ? undefined : ["bigint", BigInt(1)] +]; + +for (var i = 0; i < badReceivers.length; i++) { + if (!badReceivers[i]) continue; + var label = badReceivers[i][0]; + var value = badReceivers[i][1]; + assert.throws(TypeError, function() { + getter.call(value); + }, label); +} diff --git a/third_party/test262/test/built-ins/ArrayBuffer/prototype/immutable/this-is-sharedarraybuffer.js b/third_party/test262/test/built-ins/ArrayBuffer/prototype/immutable/this-is-sharedarraybuffer.js new file mode 100644 index 00000000000000..44c33243eaccd9 --- /dev/null +++ b/third_party/test262/test/built-ins/ArrayBuffer/prototype/immutable/this-is-sharedarraybuffer.js @@ -0,0 +1,24 @@ +// Copyright (C) 2025 Richard Gibson. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-get-arraybuffer.prototype.immutable +description: Throws a TypeError exception when `this` is a SharedArrayBuffer +info: | + get ArrayBuffer.prototype.immutable + 1. Let O be the this value. + 2. Perform ? RequireInternalSlot(O, [[ArrayBufferData]]). + 3. If IsSharedArrayBuffer(O) is true, throw a TypeError exception. +features: [SharedArrayBuffer, ArrayBuffer, immutable-arraybuffer] +---*/ + +var getter = Object.getOwnPropertyDescriptor( + ArrayBuffer.prototype, "immutable" +).get; + +assert.sameValue(typeof getter, "function", "Getter must exist."); + +var sab = new SharedArrayBuffer(4); +assert.throws(TypeError, function() { + getter.call(sab); +}); diff --git a/third_party/test262/test/built-ins/ArrayBuffer/prototype/sliceToImmutable/argument-coercion.js b/third_party/test262/test/built-ins/ArrayBuffer/prototype/sliceToImmutable/argument-coercion.js new file mode 100644 index 00000000000000..d860b4073ac25d --- /dev/null +++ b/third_party/test262/test/built-ins/ArrayBuffer/prototype/sliceToImmutable/argument-coercion.js @@ -0,0 +1,373 @@ +// Copyright (C) 2025 Richard Gibson. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-arraybuffer.prototype.slicetoimmutable +description: > + Requested start and end are coerced to integers and checked for validity, then + (if valid) an immutable ArrayBuffer with the correct length and contents is + returned +info: | + ArrayBuffer.prototype.sliceToImmutable ( start, end ) + ... + 5. Let len be O.[[ArrayBufferByteLength]]. + 6. Let bounds be ? ResolveBounds(len, start, end). + 7. Let first be bounds.[[From]]. + 8. Let final be bounds.[[To]]. + 9. Let newLen be max(final - first, 0). + ... + 12. Let fromBuf be O.[[ArrayBufferData]]. + 13. Let currentLen be O.[[ArrayBufferByteLength]]. + 14. If currentLen < final, throw a RangeError exception. + 15. Let newBuffer be ? AllocateImmutableArrayBuffer(%ArrayBuffer%, newLen, fromBuf, first, newLen). + 16. Return newBuffer. + + ResolveBounds ( len, start, end ) + 1. Let relativeStart be ? ToIntegerOrInfinity(start). + 2. If relativeStart = -โˆž, let from be 0. + 3. Else if relativeStart < 0, let from be max(len + relativeStart, 0). + 4. Else, let from be min(relativeStart, len). + 5. If end is undefined, let relativeEnd be len; else let relativeEnd be ? ToIntegerOrInfinity(end). + 6. If relativeEnd = -โˆž, let to be 0. + 7. Else if relativeEnd < 0, let to be max(len + relativeEnd, 0). + 8. Else, let to be min(relativeEnd, len). + 9. Return the Record { [[From]]: from, [[To]]: to }. + + ToIntegerOrInfinity ( argument ) + 1. Let number be ? ToNumber(argument). + 2. If number is one of NaN, +0๐”ฝ, or -0๐”ฝ, return 0. + 3. If number is +โˆž๐”ฝ, return +โˆž. + 4. If number is -โˆž๐”ฝ, return -โˆž. + 5. Return truncate(โ„(number)). +features: [immutable-arraybuffer] +includes: [compareArray.js] +---*/ + +var ab = new ArrayBuffer(8); +assert.sameValue(ab.sliceToImmutable().byteLength, 8, + "Must default to receiver byteLength."); +ab = new ArrayBuffer(8); +assert.sameValue(ab.sliceToImmutable(undefined, undefined).byteLength, 8, + "Must default (undefined, undefined) to receiver byteLength."); + +function make32ByteArrayBuffer() { + var ab = new ArrayBuffer(32); + var view = new Uint8Array(ab); + for (var i = 0; i < 8; i++) view[i] = i + 1; + return ab; +} + +var goodInputs = [ + // Unmodified non-negative integral numbers + [0, 0], + [1, 1], + [10, 10], + // Truncated non-negative integral numbers + [0.9, 0], + [1.9, 1], + [-0.9, 0], + // Negative integral numbers + [-1, -1], + [-1.9, -1], + [-2.9, -2], + // Coerced to integral numbers + [-0, 0], + [null, 0], + [false, 0], + [true, 1], + ["", 0], + ["8", 8], + ["+9", 9], + ["-9", -9], + ["10e0", 10], + ["+1.1E+1", 11], + ["+.12e2", 12], + ["130e-1", 13], + ["0b1110", 14], + ["0XF", 15], + ["0xf", 15], + ["0o20", 16], + // Coerced to NaN and mapped to 0 + [NaN, 0], + ["7up", 0], + ["1_0", 0], + ["0x00_ff", 0], + // Clamped + [-32, 0], + ["-32", 0], + [-Infinity, 0], + ["-Infinity", 0], + [33, 32], + ["33", 32], + [9007199254740992, 32], // Math.pow(2, 53) = 9007199254740992 + ["9007199254740992", 32], // Math.pow(2, 53) = 9007199254740992 + [Infinity, 32], + ["Infinity", 32] +]; + +for (var i = 0; i < goodInputs.length; i++) { + var rawStart = goodInputs[i][0]; + var intStart = goodInputs[i][1]; + for (var j = 0; j < goodInputs.length; j++) { + var rawEnd = goodInputs[j][0]; + var intEnd = goodInputs[j][1]; + var intLength = Math.max( + 0, + (intEnd >= 0 ? intEnd : 32 + intEnd) - (intStart >= 0 ? intStart : 32 + intStart) + ); + var source = make32ByteArrayBuffer(); + var expectContents = Array.from(new Uint8Array(source)).slice(rawStart, rawEnd); + var dest = source.sliceToImmutable(rawStart, rawEnd); + var label = "sliceToImmutable(" + formatSimpleValue(rawStart) + ", " + formatSimpleValue(rawEnd) + ")"; + assert.sameValue(dest.byteLength, intLength, label + ".byteLength"); + assert.compareArray(new Uint8Array(dest), expectContents, label + " contents"); + assert.sameValue(dest.immutable, true, label + ".immutable"); + } +} + +var whitespace = "\t\v\f\uFEFF\u3000\n\r\u2028\u2029"; +function pad(rawInput) { + if (typeof rawInput === "string") { + return { skip: false, string: whitespace + rawInput + whitespace }; + } else if (typeof rawInput === "number") { + return { + skip: false, + string: whitespace + (isNegativeZero(rawInput) ? "-0" : rawInput) + whitespace + }; + } + return { skip: true }; +} +for (var i = 0; i < goodInputs.length; i++) { + var rawStart = goodInputs[i][0]; + var intStart = goodInputs[i][1]; + var paddedStart = pad(rawStart); + if (paddedStart.skip) continue; + for (var j = 0; j < goodInputs.length; j++) { + var rawEnd = goodInputs[j][0]; + var intEnd = goodInputs[j][1]; + var paddedEnd = pad(rawEnd); + if (paddedEnd.skip) continue; + var intLength = Math.max( + 0, + (intEnd >= 0 ? intEnd : 32 + intEnd) - (intStart >= 0 ? intStart : 32 + intStart) + ); + var source = make32ByteArrayBuffer(); + var expectContents = Array.from(new Uint8Array(source)).slice(rawStart, rawEnd); + var dest = source.sliceToImmutable(paddedStart.string, paddedEnd.string); + var label = "sliceToImmutable(" + formatSimpleValue(paddedStart.string) + ", " + formatSimpleValue(paddedEnd.string) + ")"; + assert.sameValue(dest.byteLength, intLength, label + ".byteLength"); + assert.compareArray(new Uint8Array(dest), expectContents, label + " contents"); + assert.sameValue(dest.immutable, true, label + ".immutable"); + } +} + +for (var i = 0; i < goodInputs.length; i++) { + var rawStart = goodInputs[i][0]; + var intStart = goodInputs[i][1]; + for (var j = 0; j < goodInputs.length; j++) { + var rawEnd = goodInputs[j][0]; + var intEnd = goodInputs[j][1]; + var intLength = Math.max( + 0, + (intEnd >= 0 ? intEnd : 32 + intEnd) - (intStart >= 0 ? intStart : 32 + intStart) + ); + + var calls = []; + + var badStartValueOf = false; + var badStartToString = false; + var objStart = { + valueOf() { + calls.push("start.valueOf"); + return badStartValueOf ? {} : rawStart; + }, + toString() { + calls.push("start.toString"); + return badStartToString ? {} : rawStart; + } + }; + var badEndValueOf = false; + var badEndToString = false; + var objEnd = { + valueOf() { + calls.push("end.valueOf"); + return badEndValueOf ? {} : rawEnd; + }, + toString() { + calls.push("end.toString"); + return badEndToString ? {} : rawEnd; + } + }; + function reprArgs(startMethodName, endMethodName) { + var startRepr = "{ " + startMethodName + ": () => " + formatSimpleValue(rawStart) + " }"; + var endRepr = "{ " + endMethodName + ": () => " + formatSimpleValue(rawEnd) + " }"; + return "(" + startRepr + ", " + endRepr + ")"; + } + + var source = make32ByteArrayBuffer(); + var expectContents = Array.from(new Uint8Array(source)).slice(rawStart, rawEnd); + var dest = source.sliceToImmutable(objStart, objEnd); + assert.sameValue(dest.byteLength, intLength, + "sliceToImmutable" + reprArgs("valueOf", "valueOf") + ".byteLength"); + assert.compareArray(new Uint8Array(dest), expectContents, + "sliceToImmutable" + reprArgs("valueOf", "valueOf") + " contents"); + assert.sameValue(dest.immutable, true, + "sliceToImmutable" + reprArgs("valueOf", "valueOf") + ".immutable"); + assert.compareArray(calls, ["start.valueOf", "end.valueOf"], + "sliceToImmutable" + reprArgs("valueOf", "valueOf") + " calls"); + + badStartValueOf = true; + calls = []; + source = make32ByteArrayBuffer(); + dest = source.sliceToImmutable(objStart, objEnd); + assert.sameValue(dest.byteLength, intLength, + "sliceToImmutable" + reprArgs("toString", "valueOf") + ".byteLength"); + assert.compareArray(new Uint8Array(dest), expectContents, + "sliceToImmutable" + reprArgs("toString", "valueOf") + " contents"); + assert.sameValue(dest.immutable, true, + "sliceToImmutable" + reprArgs("toString", "valueOf") + ".immutable"); + assert.compareArray(calls, ["start.valueOf", "start.toString", "end.valueOf"], + "sliceToImmutable" + reprArgs("toString", "valueOf") + " calls"); + + badEndValueOf = true; + calls = []; + source = make32ByteArrayBuffer(); + dest = source.sliceToImmutable(objStart, objEnd); + assert.sameValue(dest.byteLength, intLength, + "sliceToImmutable" + reprArgs("toString", "toString") + ".byteLength"); + assert.compareArray(new Uint8Array(dest), expectContents, + "sliceToImmutable" + reprArgs("toString", "toString") + " contents"); + assert.sameValue(dest.immutable, true, + "sliceToImmutable" + reprArgs("toString", "toString") + ".immutable"); + assert.compareArray(calls, ["start.valueOf", "start.toString", "end.valueOf", "end.toString"], + "sliceToImmutable" + reprArgs("toString", "toString") + " calls"); + + badEndToString = true; + if (typeof Symbol === undefined || !Symbol.toPrimitive) continue; + calls = []; + objEnd[Symbol.toPrimitive] = function(hint) { + calls.push("end[Symbol.toPrimitive](" + hint + ")"); + return rawEnd; + }; + source = make32ByteArrayBuffer(); + dest = source.sliceToImmutable(objStart, objEnd); + assert.sameValue(dest.byteLength, intLength, + "sliceToImmutable" + reprArgs("toString", "[Symbol.toPrimitive]") + ".byteLength"); + assert.compareArray(new Uint8Array(dest), expectContents, + "sliceToImmutable" + reprArgs("toString", "[Symbol.toPrimitive]") + " contents"); + assert.sameValue(dest.immutable, true, + "sliceToImmutable" + reprArgs("toString", "[Symbol.toPrimitive]") + ".immutable"); + assert.compareArray( + calls, + ["start.valueOf", "start.toString", "end[Symbol.toPrimitive](number)"], + "sliceToImmutable" + reprArgs("toString", "[Symbol.toPrimitive]") + " calls" + ); + + badStartToString = true; + calls = []; + objStart[Symbol.toPrimitive] = function(hint) { + calls.push("start[Symbol.toPrimitive](" + hint + ")"); + return rawStart; + }; + source = make32ByteArrayBuffer(); + dest = source.sliceToImmutable(objStart, objEnd); + assert.sameValue(dest.byteLength, intLength, + "sliceToImmutable" + reprArgs("[Symbol.toPrimitive]", "[Symbol.toPrimitive]") + ".byteLength"); + assert.compareArray(new Uint8Array(dest), expectContents, + "sliceToImmutable" + reprArgs("[Symbol.toPrimitive]", "[Symbol.toPrimitive]") + " contents"); + assert.sameValue(dest.immutable, true, + "sliceToImmutable" + reprArgs("[Symbol.toPrimitive]", "[Symbol.toPrimitive]") + ".immutable"); + assert.compareArray( + calls, + ["start[Symbol.toPrimitive](number)", "end[Symbol.toPrimitive](number)"], + "sliceToImmutable" + reprArgs("[Symbol.toPrimitive]", "[Symbol.toPrimitive]") + " calls"); + } +} + +function CustomError() {} + +var badInputs = [ + // non-numbers + typeof Symbol === undefined ? undefined : [Symbol("1"), TypeError], + typeof Symbol === undefined || !Symbol.for ? undefined : [Symbol.for("1"), TypeError], + typeof BigInt === undefined ? undefined : [BigInt(1), TypeError], + // thrower + [ + { + valueOf() { + throw new CustomError(); + }, + toString() { + return "{ valueOf: throwError }"; + }, + }, + CustomError + ] +]; + +for (var i = 0; i < badInputs.length; i++) { + if (!badInputs[i]) continue; + var rawBad = badInputs[i][0]; + var expectedErr = badInputs[i][1]; + + var ab = make32ByteArrayBuffer(); + var rawGood = goodInputs[i % goodInputs.length][0]; + var calls = []; + var objGood = { + valueOf() { + calls.push("good.valueOf"); + return rawGood; + } + }; + assert.throws( + expectedErr, + function() { + ab.sliceToImmutable(rawBad, objGood); + }, + "sliceToImmutable(" + formatSimpleValue(rawBad) + ", { valueOf: () => " + formatSimpleValue(rawGood) + " })" + ); + assert.compareArray(calls, [], + "sliceToImmutable(" + formatSimpleValue(rawBad) + ", { valueOf: () => " + formatSimpleValue(rawGood) + " }) calls"); + + calls = []; + assert.throws( + expectedErr, + function() { + ab.sliceToImmutable(objGood, rawBad); + }, + "sliceToImmutable({ valueOf: () => " + formatSimpleValue(rawGood) + " }, " + formatSimpleValue(rawBad) + ")" + ); + assert.compareArray(calls, ["good.valueOf"], + "sliceToImmutable({ valueOf: () => " + formatSimpleValue(rawGood) + " }, " + formatSimpleValue(rawBad) + ") calls"); +} + +var calls = []; +var objBad = { + toString() { + calls.push("toString"); + return {}; + }, + valueOf() { + calls.push("valueOf"); + return {}; + } +}; +ab = make32ByteArrayBuffer(); +assert.throws(TypeError, function() { + ab.sliceToImmutable(objBad); +}, "sliceToImmutable(badOrdinaryToPrimitive)"); +assert.compareArray(calls, ["valueOf", "toString"], + "sliceToImmutable(badOrdinaryToPrimitive) calls"); +if (typeof Symbol !== undefined && Symbol.toPrimitive) { + calls = []; + objBad[Symbol.toPrimitive] = function(hint) { + calls.push("Symbol.toPrimitive(" + hint + ")"); + return {}; + }; + ab = make32ByteArrayBuffer(); + assert.throws(TypeError, function() { + ab.sliceToImmutable(objBad); + }, "sliceToImmutable(badExoticToPrimitive)"); + assert.compareArray(calls, ["Symbol.toPrimitive(number)"], + "sliceToImmutable(badExoticToPrimitive) calls"); +} diff --git a/third_party/test262/test/built-ins/ArrayBuffer/prototype/sliceToImmutable/modify-source-after-return.js b/third_party/test262/test/built-ins/ArrayBuffer/prototype/sliceToImmutable/modify-source-after-return.js new file mode 100644 index 00000000000000..0268158df47829 --- /dev/null +++ b/third_party/test262/test/built-ins/ArrayBuffer/prototype/sliceToImmutable/modify-source-after-return.js @@ -0,0 +1,37 @@ +// Copyright (C) 2025 Richard Gibson. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-arraybuffer.prototype.slicetoimmutable +description: Unaffected by post-hoc manipulation of the source +info: | + ArrayBuffer.prototype.sliceToImmutable ( start, end ) + ... + 15. Let newBuffer be ? AllocateImmutableArrayBuffer(%ArrayBuffer%, newLen, fromBuf, first, newLen). + 16. Return newBuffer. +features: [immutable-arraybuffer] +includes: [compareArray.js, detachArrayBuffer.js] +---*/ + +var source = new ArrayBuffer(8, { maxByteLength: 8 }); +var view = new Uint8Array(source); +for (var i = 0; i < 8; i++) view[i] = i + 1; + +var dest = source.sliceToImmutable(); +var expectContents = [1, 2, 3, 4, 5, 6, 7, 8]; +var destView = new Uint8Array(dest); +assert.compareArray(destView, expectContents); + +view[0] = 86; +assert.compareArray(destView, expectContents, "after source overwrite"); +assert.compareArray(new Uint8Array(dest), expectContents, "new view after source overwrite"); + +if (source.resize) { + source.resize(4); + assert.compareArray(destView, expectContents, "after resize"); + assert.compareArray(new Uint8Array(dest), expectContents, "new view after resize"); +} + +$DETACHBUFFER(source); +assert.compareArray(destView, expectContents, "after detach"); +assert.compareArray(new Uint8Array(dest), expectContents, "new view after detach"); diff --git a/third_party/test262/test/built-ins/ArrayBuffer/prototype/sliceToImmutable/not-a-constructor.js b/third_party/test262/test/built-ins/ArrayBuffer/prototype/sliceToImmutable/not-a-constructor.js new file mode 100644 index 00000000000000..8823ba52399555 --- /dev/null +++ b/third_party/test262/test/built-ins/ArrayBuffer/prototype/sliceToImmutable/not-a-constructor.js @@ -0,0 +1,23 @@ +// Copyright (C) 2025 Richard Gibson. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-arraybuffer.prototype.slicetoimmutable +description: ArrayBuffer.prototype.sliceToImmutable is not a constructor function +info: | + ECMAScript Standard Built-in Objects + ... + Built-in function objects that are not identified as constructors do not + implement the [[Construct]] internal method unless otherwise specified in the + description of a particular function. +features: [Reflect.construct, immutable-arraybuffer] +includes: [isConstructor.js] +---*/ + +assert(!isConstructor(ArrayBuffer.prototype.sliceToImmutable), + "ArrayBuffer.prototype.sliceToImmutable is not a constructor"); + +var arrayBuffer = new ArrayBuffer(8); +assert.throws(TypeError, function() { + new arrayBuffer.sliceToImmutable(); +}); diff --git a/third_party/test262/test/built-ins/ArrayBuffer/prototype/sliceToImmutable/prop-desc.js b/third_party/test262/test/built-ins/ArrayBuffer/prototype/sliceToImmutable/prop-desc.js new file mode 100644 index 00000000000000..367f292436a1e1 --- /dev/null +++ b/third_party/test262/test/built-ins/ArrayBuffer/prototype/sliceToImmutable/prop-desc.js @@ -0,0 +1,27 @@ +// Copyright (C) 2025 Richard Gibson. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-arraybuffer.prototype.slicetoimmutable +description: Checks the "sliceToImmutable" property of ArrayBuffer.prototype +info: | + ECMAScript Standard Built-in Objects + ... + Every built-in function object, including constructors, has a "length" + property whose value is a non-negative integral Number. Unless otherwise + specified, this value is the number of required parameters shown in the + subclause heading for the function description. Optional parameters and rest + parameters are not included in the parameter count. + ... + For functions that are specified as properties of objects, the name value is + the property name string used to access the function. +features: [immutable-arraybuffer] +includes: [propertyHelper.js] +---*/ + +verifyPrimordialCallableProperty( + ArrayBuffer.prototype, + "sliceToImmutable", + "sliceToImmutable", + 2 +); diff --git a/third_party/test262/test/built-ins/ArrayBuffer/prototype/sliceToImmutable/this-becomes-detached.js b/third_party/test262/test/built-ins/ArrayBuffer/prototype/sliceToImmutable/this-becomes-detached.js new file mode 100644 index 00000000000000..bca411f04fa99c --- /dev/null +++ b/third_party/test262/test/built-ins/ArrayBuffer/prototype/sliceToImmutable/this-becomes-detached.js @@ -0,0 +1,50 @@ +// Copyright (C) 2025 Richard Gibson. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-arraybuffer.prototype.slicetoimmutable +description: Throws if receiver is detached by bounds resolution +info: | + ArrayBuffer.prototype.sliceToImmutable ( start, end ) + ... + 6. Let bounds be ? ResolveBounds(len, start, end). + ... + 10. NOTE: Side-effects of the above steps may have detached or resized O. + 11. If IsDetachedBuffer(O) is true, throw a TypeError exception. + + ResolveBounds ( len, start, end ) + 1. Let relativeStart be ? ToIntegerOrInfinity(start). + 2. If relativeStart = -โˆž, let from be 0. + 3. Else if relativeStart < 0, let from be max(len + relativeStart, 0). + 4. Else, let from be min(relativeStart, len). + 5. If end is undefined, let relativeEnd be len; else let relativeEnd be ? ToIntegerOrInfinity(end). + 6. If relativeEnd = -โˆž, let to be 0. + 7. Else if relativeEnd < 0, let to be max(len + relativeEnd, 0). + 8. Else, let to be min(relativeEnd, len). + 9. Return the Record { [[From]]: from, [[To]]: to }. +features: [immutable-arraybuffer] +includes: [compareArray.js, detachArrayBuffer.js] +---*/ + +var fn = ArrayBuffer.prototype.sliceToImmutable; +assert.sameValue(typeof fn, "function", "Method must exist."); + +var ab = new ArrayBuffer(8); +var calls = []; +var objStart = { + valueOf() { + calls.push("start.valueOf"); + return 0; + } +}; +var objEnd = { + valueOf() { + $DETACHBUFFER(ab); + calls.push("end.valueOf"); + return 1; + } +}; +assert.throws(TypeError, function() { + ab.sliceToImmutable(objStart, objEnd); +}); +assert.compareArray(calls, ["start.valueOf", "end.valueOf"]); diff --git a/third_party/test262/test/built-ins/ArrayBuffer/prototype/sliceToImmutable/this-grows.js b/third_party/test262/test/built-ins/ArrayBuffer/prototype/sliceToImmutable/this-grows.js new file mode 100644 index 00000000000000..11a412cb1fe156 --- /dev/null +++ b/third_party/test262/test/built-ins/ArrayBuffer/prototype/sliceToImmutable/this-grows.js @@ -0,0 +1,54 @@ +// Copyright (C) 2025 Richard Gibson. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-arraybuffer.prototype.slicetoimmutable +description: Calculates bounds from original length if receiver grows. +info: | + ArrayBuffer.prototype.sliceToImmutable ( start, end ) + ... + 5. Let len be O.[[ArrayBufferByteLength]]. + 6. Let bounds be ? ResolveBounds(len, start, end). + 7. Let first be bounds.[[From]]. + 8. Let final be bounds.[[To]]. + 9. Let newLen be max(final - first, 0). + ... + 12. Let fromBuf be O.[[ArrayBufferData]]. + 13. Let currentLen be O.[[ArrayBufferByteLength]]. + 14. If currentLen < final, throw a RangeError exception. + 15. Let newBuffer be ? AllocateImmutableArrayBuffer(%ArrayBuffer%, newLen, fromBuf, first, newLen). + 16. Return newBuffer. + + ResolveBounds ( len, start, end ) + 1. Let relativeStart be ? ToIntegerOrInfinity(start). + 2. If relativeStart = -โˆž, let from be 0. + 3. Else if relativeStart < 0, let from be max(len + relativeStart, 0). + 4. Else, let from be min(relativeStart, len). + 5. If end is undefined, let relativeEnd be len; else let relativeEnd be ? ToIntegerOrInfinity(end). + 6. If relativeEnd = -โˆž, let to be 0. + 7. Else if relativeEnd < 0, let to be max(len + relativeEnd, 0). + 8. Else, let to be min(relativeEnd, len). + 9. Return the Record { [[From]]: from, [[To]]: to }. +features: [resizable-arraybuffer, immutable-arraybuffer] +includes: [compareArray.js] +---*/ + +var source = new ArrayBuffer(10, { maxByteLength: 12 }); +var view = new Uint8Array(source); +for (var i = 0; i < 10; i++) view[i] = i + 1; + +var start = { + valueOf() { + source.resize(11); + return -7; + } +}; +var end = { + valueOf() { + source.resize(12); + return -4; + } +}; +var dest = source.sliceToImmutable(start, end); +assert.compareArray(new Uint8Array(dest), [4, 5, 6]); +assert.sameValue(source.byteLength, 12); diff --git a/third_party/test262/test/built-ins/ArrayBuffer/prototype/sliceToImmutable/this-has-no-arraybufferdata-internal.js b/third_party/test262/test/built-ins/ArrayBuffer/prototype/sliceToImmutable/this-has-no-arraybufferdata-internal.js new file mode 100644 index 00000000000000..ef4a4fd252656c --- /dev/null +++ b/third_party/test262/test/built-ins/ArrayBuffer/prototype/sliceToImmutable/this-has-no-arraybufferdata-internal.js @@ -0,0 +1,66 @@ +// Copyright (C) 2025 Richard Gibson. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-arraybuffer.prototype.slicetoimmutable +description: > + Throws a TypeError exception when `this` does not have a [[ArrayBufferData]] + internal slot +info: | + ArrayBuffer.prototype.sliceToImmutable ( start, end ) + 1. Let O be the this value. + 2. Perform ? RequireInternalSlot(O, [[ArrayBufferData]]). +features: [DataView, Int8Array, ArrayBuffer, immutable-arraybuffer] +includes: [compareArray.js] +---*/ + +var fn = ArrayBuffer.prototype.sliceToImmutable; +assert.sameValue(typeof fn, "function", "Method must exist."); + +var calls = []; +var start = { + valueOf() { + calls.push("start.valueOf"); + return 0; + } +}; +var end = { + valueOf() { + calls.push("end.valueOf"); + return 1; + } +}; + +var badReceivers = [ + ["plain object", {}], + ["array", []], + ["function", function(){}], + ["ArrayBuffer.prototype", ArrayBuffer.prototype], + ["TypedArray", new Int8Array(8)], + ["DataView", new DataView(new ArrayBuffer(8), 0)] +]; + +for (var i = 0; i < badReceivers.length; i++) { + var label = badReceivers[i][0]; + var value = badReceivers[i][1]; + calls = []; + assert.throws(TypeError, function() { + fn.call(value, start, end); + }, label); + assert.compareArray(calls, [], + "[" + label + " receiver] Must verify internal slots before reading arguments."); +} + +calls = []; +assert.throws(TypeError, function() { + ArrayBuffer.prototype.sliceToImmutable(start, end); +}, "invoked as prototype method"); +assert.compareArray(calls, [], + "[invoked as prototype method] Must verify internal slots before reading arguments."); + +calls = []; +assert.throws(TypeError, function() { + fn(start, end); +}, "invoked as function"); +assert.compareArray(calls, [], + "[invoked as function] Must verify internal slots before reading arguments."); diff --git a/third_party/test262/test/built-ins/ArrayBuffer/prototype/sliceToImmutable/this-is-not-detached.js b/third_party/test262/test/built-ins/ArrayBuffer/prototype/sliceToImmutable/this-is-not-detached.js new file mode 100644 index 00000000000000..dc8435c1605228 --- /dev/null +++ b/third_party/test262/test/built-ins/ArrayBuffer/prototype/sliceToImmutable/this-is-not-detached.js @@ -0,0 +1,38 @@ +// Copyright (C) 2025 Richard Gibson. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-arraybuffer.prototype.slicetoimmutable +description: > + Throws a TypeError exception when `this` is already detached +info: | + ArrayBuffer.prototype.sliceToImmutable ( start, end ) + 1. Let O be the this value. + 2. Perform ? RequireInternalSlot(O, [[ArrayBufferData]]). + 3. If IsSharedArrayBuffer(O) is true, throw a TypeError exception. + 4. If IsDetachedBuffer(O) is true, throw a TypeError exception. +features: [immutable-arraybuffer] +includes: [compareArray.js, detachArrayBuffer.js] +---*/ + +var calls = []; +var start = { + valueOf() { + calls.push("start.valueOf"); + return 0; + } +}; +var end = { + valueOf() { + calls.push("end.valueOf"); + return 1; + } +}; + +var detached = new ArrayBuffer(8); +$DETACHBUFFER(detached); +assert.throws(TypeError, function() { + detached.sliceToImmutable(start, end); +}); +assert.compareArray(calls, [], + "Must verify non-detachment before reading arguments."); diff --git a/third_party/test262/test/built-ins/ArrayBuffer/prototype/sliceToImmutable/this-is-not-object.js b/third_party/test262/test/built-ins/ArrayBuffer/prototype/sliceToImmutable/this-is-not-object.js new file mode 100644 index 00000000000000..c1727076cca514 --- /dev/null +++ b/third_party/test262/test/built-ins/ArrayBuffer/prototype/sliceToImmutable/this-is-not-object.js @@ -0,0 +1,53 @@ +// Copyright (C) 2025 Richard Gibson. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-arraybuffer.prototype.slicetoimmutable +description: Throws a TypeError exception when `this` is not an object +info: | + ArrayBuffer.prototype.sliceToImmutable ( start, end ) + 1. Let O be the this value. + 2. Perform ? RequireInternalSlot(O, [[ArrayBufferData]]). +features: [ArrayBuffer, immutable-arraybuffer] +includes: [compareArray.js] +---*/ + +var fn = ArrayBuffer.prototype.sliceToImmutable; +assert.sameValue(typeof fn, "function", "Method must exist."); + +var calls = []; +var start = { + valueOf() { + calls.push("start.valueOf"); + return 0; + } +}; +var end = { + valueOf() { + calls.push("end.valueOf"); + return 1; + } +}; + +var badReceivers = [ + ["undefined", undefined], + ["null", null], + ["number", 42], + ["string", "1"], + ["true", true], + ["false", false], + typeof Symbol === "undefined" ? undefined : ["unique symbol", Symbol("1")], + typeof Symbol === "undefined" || !Symbol.for ? undefined : ["registered symbol", Symbol.for("1")], + typeof BigInt === "undefined" ? undefined : ["bigint", BigInt(1)] +]; + +for (var i = 0; i < badReceivers.length; i++) { + var label = badReceivers[i][0]; + var value = badReceivers[i][1]; + calls = []; + assert.throws(TypeError, function() { + fn.call(value, start, end); + }, label); + assert.compareArray(calls, [], + "[" + label + " receiver] Must verify internal slots before reading arguments."); +} diff --git a/third_party/test262/test/built-ins/ArrayBuffer/prototype/sliceToImmutable/this-is-sharedarraybuffer.js b/third_party/test262/test/built-ins/ArrayBuffer/prototype/sliceToImmutable/this-is-sharedarraybuffer.js new file mode 100644 index 00000000000000..13b1e3cdfb71ea --- /dev/null +++ b/third_party/test262/test/built-ins/ArrayBuffer/prototype/sliceToImmutable/this-is-sharedarraybuffer.js @@ -0,0 +1,38 @@ +// Copyright (C) 2025 Richard Gibson. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-arraybuffer.prototype.slicetoimmutable +description: Throws a TypeError exception when `this` is a SharedArrayBuffer +info: | + ArrayBuffer.prototype.sliceToImmutable ( start, end ) + 1. Let O be the this value. + 2. Perform ? RequireInternalSlot(O, [[ArrayBufferData]]). + 3. If IsSharedArrayBuffer(O) is true, throw a TypeError exception. +features: [SharedArrayBuffer, ArrayBuffer, immutable-arraybuffer] +includes: [compareArray.js] +---*/ + +var fn = ArrayBuffer.prototype.sliceToImmutable; +assert.sameValue(typeof fn, "function", "Method must exist."); + +var calls = []; +var start = { + valueOf() { + calls.push("start.valueOf"); + return 0; + } +}; +var end = { + valueOf() { + calls.push("end.valueOf"); + return 1; + } +}; + +var sab = new SharedArrayBuffer(4); +assert.throws(TypeError, function() { + fn.call(sab, start, end); +}); +assert.compareArray(calls, [], + "Must verify non-SharedArrayBuffer receiver before reading arguments."); diff --git a/third_party/test262/test/built-ins/ArrayBuffer/prototype/sliceToImmutable/this-shrinks.js b/third_party/test262/test/built-ins/ArrayBuffer/prototype/sliceToImmutable/this-shrinks.js new file mode 100644 index 00000000000000..98d7d4906bbfc3 --- /dev/null +++ b/third_party/test262/test/built-ins/ArrayBuffer/prototype/sliceToImmutable/this-shrinks.js @@ -0,0 +1,74 @@ +// Copyright (C) 2025 Richard Gibson. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-arraybuffer.prototype.slicetoimmutable +description: Calculates bounds from original length if receiver shrinks. +info: | + ArrayBuffer.prototype.sliceToImmutable ( start, end ) + ... + 5. Let len be O.[[ArrayBufferByteLength]]. + 6. Let bounds be ? ResolveBounds(len, start, end). + 7. Let first be bounds.[[From]]. + 8. Let final be bounds.[[To]]. + 9. Let newLen be max(final - first, 0). + ... + 12. Let fromBuf be O.[[ArrayBufferData]]. + 13. Let currentLen be O.[[ArrayBufferByteLength]]. + 14. If currentLen < final, throw a RangeError exception. + 15. Let newBuffer be ? AllocateImmutableArrayBuffer(%ArrayBuffer%, newLen, fromBuf, first, newLen). + 16. Return newBuffer. + + ResolveBounds ( len, start, end ) + 1. Let relativeStart be ? ToIntegerOrInfinity(start). + 2. If relativeStart = -โˆž, let from be 0. + 3. Else if relativeStart < 0, let from be max(len + relativeStart, 0). + 4. Else, let from be min(relativeStart, len). + 5. If end is undefined, let relativeEnd be len; else let relativeEnd be ? ToIntegerOrInfinity(end). + 6. If relativeEnd = -โˆž, let to be 0. + 7. Else if relativeEnd < 0, let to be max(len + relativeEnd, 0). + 8. Else, let to be min(relativeEnd, len). + 9. Return the Record { [[From]]: from, [[To]]: to }. +features: [resizable-arraybuffer, immutable-arraybuffer] +includes: [compareArray.js, detachArrayBuffer.js] +---*/ + +var source = new ArrayBuffer(10, { maxByteLength: 10 }); +var view = new Uint8Array(source); +for (var i = 0; i < 10; i++) view[i] = i + 1; + +var startResizeTo = 9; +var endResizeTo = 8; +var start = { + valueOf() { + source.resize(startResizeTo); + return -7; + } +}; +var end = { + valueOf() { + source.resize(endResizeTo); + return -4; + } +}; +var dest = source.sliceToImmutable(start, end); +assert.compareArray(new Uint8Array(dest), [4, 5, 6]); +assert.sameValue(source.byteLength, 8); + +source.resize(10); +endResizeTo = 5; +assert.throws(RangeError, function() { + source.sliceToImmutable(start, end); +}, "resize below resolved end"); + +source.resize(10); +end = { + valueOf() { + source.resize(5); + $DETACHBUFFER(source); + return 6; + } +}; +assert.throws(TypeError, function() { + source.sliceToImmutable(0, end); +}, "Must verify non-detachment before final bounds check"); diff --git a/third_party/test262/test/built-ins/ArrayBuffer/prototype/transferToImmutable/new-length-coercion.js b/third_party/test262/test/built-ins/ArrayBuffer/prototype/transferToImmutable/new-length-coercion.js new file mode 100644 index 00000000000000..51d4c035017c62 --- /dev/null +++ b/third_party/test262/test/built-ins/ArrayBuffer/prototype/transferToImmutable/new-length-coercion.js @@ -0,0 +1,254 @@ +// Copyright (C) 2025 Richard Gibson. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-arraybuffer.prototype.transfertoimmutable +description: Requested length is coerced to an integer and checked for validity +info: | + ArrayBuffer.prototype.transferToImmutable ( [ newLength ] ) + 1. Let O be the this value. + 2. Return ? ArrayBufferCopyAndDetach(O, newLength, ~immutable~). + + ArrayBufferCopyAndDetach ( arrayBuffer, newLength, preserveResizability ) + 1. Perform ? RequireInternalSlot(arrayBuffer, [[ArrayBufferData]]). + 2. If IsSharedArrayBuffer(arrayBuffer) is true, throw a TypeError exception. + 3. If newLength is undefined, then + a. Let newByteLength be arrayBuffer.[[ArrayBufferByteLength]]. + 4. Else, + a. Let newByteLength be ? ToIndex(newLength). + + ToIndex ( value ) + 1. Let integer be ? ToIntegerOrInfinity(value). + 2. If integer is not in the inclusive interval from 0 to 2**53 - 1, throw a RangeError exception. + 3. Return integer. + + ToIntegerOrInfinity ( argument ) + 1. Let number be ? ToNumber(argument). + 2. If number is one of NaN, +0๐”ฝ, or -0๐”ฝ, return 0. + 3. If number is +โˆž๐”ฝ, return +โˆž. + 4. If number is -โˆž๐”ฝ, return -โˆž. + 5. Return truncate(โ„(number)). +features: [immutable-arraybuffer] +includes: [compareArray.js] +---*/ + +var ab = new ArrayBuffer(8); +assert.sameValue(ab.transferToImmutable().byteLength, 8, + "Must default to receiver byteLength."); +ab = new ArrayBuffer(8); +assert.sameValue(ab.transferToImmutable(undefined).byteLength, 8, + "Must default undefined to receiver byteLength."); + +var goodLengths = [ + // Unmodified integral numbers + [0, 0], + [1, 1], + [10, 10], + // Truncated integral numbers + [0.9, 0], + [1.9, 1], + [-0.9, 0], + // Coerced to integral numbers + [-0, 0], + [null, 0], + [false, 0], + [true, 1], + ["", 0], + ["8", 8], + ["+9", 9], + ["10e0", 10], + ["+1.1E+1", 11], + ["+.12e2", 12], + ["130e-1", 13], + ["0b1110", 14], + ["0XF", 15], + ["0xf", 15], + ["0o20", 16], + // Coerced to NaN and mapped to 0 + [NaN, 0], + ["7up", 0], + ["1_0", 0], + ["0x00_ff", 0] +]; + +for (var i = 0; i < goodLengths.length; i++) { + var rawLength = goodLengths[i][0]; + var intLength = goodLengths[i][1]; + var ab = new ArrayBuffer(8); + assert.sameValue(ab.transferToImmutable(rawLength).byteLength, intLength, + "transferToImmutable(" + formatSimpleValue(rawLength) + ").byteLength"); +} + +var whitespace = "\t\v\f\uFEFF\u3000\n\r\u2028\u2029"; +for (var i = 0; i < goodLengths.length; i++) { + var rawLength = goodLengths[i][0]; + var intLength = goodLengths[i][1]; + if (typeof rawLength === "number") { + rawLength = isNegativeZero(rawLength) ? "-0" : String(rawLength); + } else if (typeof rawLength !== "string") { + continue; + } + var paddedLength = whitespace + rawLength + whitespace; + var ab = new ArrayBuffer(8); + assert.sameValue(ab.transferToImmutable(paddedLength).byteLength, intLength, + "transferToImmutable(" + formatSimpleValue(paddedLength) + ").byteLength"); +} + +for (var i = 0; i < goodLengths.length; i++) { + var rawLength = goodLengths[i][0]; + var intLength = goodLengths[i][1]; + var calls = []; + var badValueOf = false; + var badToString = false; + var objLength = { + valueOf() { + calls.push("valueOf"); + return badValueOf ? {} : rawLength; + }, + toString() { + calls.push("toString"); + return badToString ? {} : rawLength; + } + }; + + var ab = new ArrayBuffer(8); + assert.sameValue(ab.transferToImmutable(objLength).byteLength, intLength, + "transferToImmutable({ valueOf: () => " + formatSimpleValue(rawLength) + " }).byteLength"); + assert.compareArray(calls, ["valueOf"], + "transferToImmutable({ valueOf: () => " + formatSimpleValue(rawLength) + " }) calls"); + + badValueOf = true; + calls = []; + ab = new ArrayBuffer(8); + assert.sameValue(ab.transferToImmutable(objLength).byteLength, intLength, + "transferToImmutable({ toString: () => " + formatSimpleValue(rawLength) + " }).byteLength"); + assert.compareArray(calls, ["valueOf", "toString"], + "transferToImmutable({ toString: () => " + formatSimpleValue(rawLength) + " }) calls"); + + badToString = true; + if (typeof Symbol === undefined || !Symbol.toPrimitive) continue; + calls = []; + objLength[Symbol.toPrimitive] = function(hint) { + calls.push("Symbol.toPrimitive(" + hint + ")"); + return rawLength; + }; + ab = new ArrayBuffer(8); + assert.sameValue(ab.transferToImmutable(objLength).byteLength, intLength, + "transferToImmutable({ [Symbol.toPrimitive]: () => " + formatSimpleValue(rawLength) + " }).byteLength"); + assert.compareArray(calls, ["Symbol.toPrimitive(number)"], + "transferToImmutable({ [Symbol.toPrimitive]: () => " + formatSimpleValue(rawLength) + " }) calls"); +} + +var badLengths = [ + // Out of range numbers + [-1, RangeError], + [9007199254740992, RangeError], // Math.pow(2, 53) = 9007199254740992 + [Infinity, RangeError], + [-Infinity, RangeError], + // non-numbers + typeof Symbol === undefined ? undefined : [Symbol("1"), TypeError], + typeof Symbol === undefined || !Symbol.for ? undefined : [Symbol.for("1"), TypeError], + typeof BigInt === undefined ? undefined : [BigInt(1), TypeError], +]; + +for (var i = 0; i < badLengths.length; i++) { + if (!badLengths[i]) continue; + var rawLength = badLengths[i][0]; + var expectedErr = badLengths[i][1]; + var ab = new ArrayBuffer(8); + assert.throws(expectedErr, function() { + ab.transferToImmutable(rawLength); + }, "transferToImmutable(" + formatSimpleValue(rawLength) + ")"); +} + +for (var i = 0; i < badLengths.length; i++) { + if (!badLengths[i]) continue; + var rawLength = badLengths[i][0]; + var expectedErr = badLengths[i][1]; + if (typeof rawLength !== "number") continue; + var paddedLength = whitespace + rawLength + whitespace; + var ab = new ArrayBuffer(8); + assert.throws(expectedErr, function() { + ab.transferToImmutable(paddedLength); + }, "transferToImmutable(" + formatSimpleValue(paddedLength) + ")"); +} + +for (var i = 0; i < badLengths.length; i++) { + if (!badLengths[i]) continue; + var rawLength = badLengths[i][0]; + var expectedErr = badLengths[i][1]; + var calls = []; + var badValueOf = false; + var badToString = false; + var objLength = { + valueOf() { + calls.push("valueOf"); + return badValueOf ? {} : rawLength; + }, + toString() { + calls.push("toString"); + return badToString ? {} : rawLength; + } + }; + + var ab = new ArrayBuffer(8); + assert.throws(expectedErr, function() { + ab.transferToImmutable(objLength); + }, "transferToImmutable({ valueOf: () => " + formatSimpleValue(rawLength) + " })"); + assert.compareArray(calls, ["valueOf"], + "transferToImmutable({ valueOf: () => " + formatSimpleValue(rawLength) + " }) calls"); + + badValueOf = true; + calls = []; + ab = new ArrayBuffer(8); + assert.throws(expectedErr, function() { + ab.transferToImmutable(objLength); + }, "transferToImmutable({ toString: () => " + formatSimpleValue(rawLength) + " })"); + assert.compareArray(calls, ["valueOf", "toString"], + "transferToImmutable({ toString: () => " + formatSimpleValue(rawLength) + " }) calls"); + + badToString = true; + if (typeof Symbol === undefined || !Symbol.toPrimitive) continue; + calls = []; + objLength[Symbol.toPrimitive] = function(hint) { + calls.push("Symbol.toPrimitive(" + hint + ")"); + return rawLength; + }; + ab = new ArrayBuffer(8); + assert.throws(expectedErr, function() { + ab.transferToImmutable(objLength); + }, "transferToImmutable({ [Symbol.toPrimitive]: () => " + formatSimpleValue(rawLength) + " })"); + assert.compareArray(calls, ["Symbol.toPrimitive(number)"], + "transferToImmutable({ [Symbol.toPrimitive]: () => " + formatSimpleValue(rawLength) + " }) calls"); +} + +var calls = []; +var objLength = { + toString() { + calls.push("toString"); + return {}; + }, + valueOf() { + calls.push("valueOf"); + return {}; + } +}; +ab = new ArrayBuffer(8); +assert.throws(TypeError, function() { + ab.transferToImmutable(objLength); +}, "transferToImmutable(badOrdinaryToPrimitive)"); +assert.compareArray(calls, ["valueOf", "toString"], + "transferToImmutable(badOrdinaryToPrimitive) calls"); +if (typeof Symbol !== undefined && Symbol.toPrimitive) { + calls = []; + objLength[Symbol.toPrimitive] = function(hint) { + calls.push("Symbol.toPrimitive(" + hint + ")"); + return {}; + }; + ab = new ArrayBuffer(8); + assert.throws(TypeError, function() { + ab.transferToImmutable(objLength); + }, "transferToImmutable(badExoticToPrimitive)"); + assert.compareArray(calls, ["Symbol.toPrimitive(number)"], + "transferToImmutable(badExoticToPrimitive) calls"); +} diff --git a/third_party/test262/test/built-ins/ArrayBuffer/prototype/transferToImmutable/not-a-constructor.js b/third_party/test262/test/built-ins/ArrayBuffer/prototype/transferToImmutable/not-a-constructor.js new file mode 100644 index 00000000000000..db701b0049faf8 --- /dev/null +++ b/third_party/test262/test/built-ins/ArrayBuffer/prototype/transferToImmutable/not-a-constructor.js @@ -0,0 +1,23 @@ +// Copyright (C) 2025 Richard Gibson. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-arraybuffer.prototype.transfertoimmutable +description: ArrayBuffer.prototype.transferToImmutable is not a constructor function +info: | + ECMAScript Standard Built-in Objects + ... + Built-in function objects that are not identified as constructors do not + implement the [[Construct]] internal method unless otherwise specified in the + description of a particular function. +features: [Reflect.construct, immutable-arraybuffer] +includes: [isConstructor.js] +---*/ + +assert(!isConstructor(ArrayBuffer.prototype.transferToImmutable), + "ArrayBuffer.prototype.transferToImmutable is not a constructor"); + +var arrayBuffer = new ArrayBuffer(8); +assert.throws(TypeError, function() { + new arrayBuffer.transferToImmutable(); +}); diff --git a/third_party/test262/test/built-ins/ArrayBuffer/prototype/transferToImmutable/prop-desc.js b/third_party/test262/test/built-ins/ArrayBuffer/prototype/transferToImmutable/prop-desc.js new file mode 100644 index 00000000000000..76dcb3fe4cfa53 --- /dev/null +++ b/third_party/test262/test/built-ins/ArrayBuffer/prototype/transferToImmutable/prop-desc.js @@ -0,0 +1,27 @@ +// Copyright (C) 2025 Richard Gibson. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-arraybuffer.prototype.transfertoimmutable +description: Checks the "transferToImmutable" property of ArrayBuffer.prototype +info: | + ECMAScript Standard Built-in Objects + ... + Every built-in function object, including constructors, has a "length" + property whose value is a non-negative integral Number. Unless otherwise + specified, this value is the number of required parameters shown in the + subclause heading for the function description. Optional parameters and rest + parameters are not included in the parameter count. + ... + For functions that are specified as properties of objects, the name value is + the property name string used to access the function. +features: [immutable-arraybuffer] +includes: [propertyHelper.js] +---*/ + +verifyPrimordialCallableProperty( + ArrayBuffer.prototype, + "transferToImmutable", + "transferToImmutable", + 0 +); diff --git a/third_party/test262/test/built-ins/ArrayBuffer/prototype/transferToImmutable/this-has-no-arraybufferdata-internal.js b/third_party/test262/test/built-ins/ArrayBuffer/prototype/transferToImmutable/this-has-no-arraybufferdata-internal.js new file mode 100644 index 00000000000000..6d96c348a67808 --- /dev/null +++ b/third_party/test262/test/built-ins/ArrayBuffer/prototype/transferToImmutable/this-has-no-arraybufferdata-internal.js @@ -0,0 +1,63 @@ +// Copyright (C) 2025 Richard Gibson. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-arraybuffer.prototype.transfertoimmutable +description: > + Throws a TypeError exception when `this` does not have a [[ArrayBufferData]] + internal slot +info: | + ArrayBuffer.prototype.transferToImmutable ( [ newLength ] ) + 1. Let O be the this value. + 2. Return ? ArrayBufferCopyAndDetach(O, newLength, ~immutable~). + + ArrayBufferCopyAndDetach ( arrayBuffer, newLength, preserveResizability ) + 1. Perform ?ย RequireInternalSlot(arrayBuffer, [[ArrayBufferData]]). +features: [DataView, Int8Array, ArrayBuffer, immutable-arraybuffer] +includes: [compareArray.js] +---*/ + +var fn = ArrayBuffer.prototype.transferToImmutable; +assert.sameValue(typeof fn, "function", "Method must exist."); + +var calls = []; +var newLength = { + valueOf() { + calls.push("newLength.valueOf"); + return 1; + } +}; + +var badReceivers = [ + ["plain object", {}], + ["array", []], + ["function", function(){}], + ["ArrayBuffer.prototype", ArrayBuffer.prototype], + ["TypedArray", new Int8Array(8)], + ["DataView", new DataView(new ArrayBuffer(8), 0)] +]; + +for (var i = 0; i < badReceivers.length; i++) { + var label = badReceivers[i][0]; + var value = badReceivers[i][1]; + calls = []; + assert.throws(TypeError, function() { + fn.call(value, newLength); + }, label); + assert.compareArray(calls, [], + "[" + label + " receiver] Must verify internal slots before reading arguments."); +} + +calls = []; +assert.throws(TypeError, function() { + ArrayBuffer.prototype.transferToImmutable(newLength); +}, "invoked as prototype method"); +assert.compareArray(calls, [], + "[invoked as prototype method] Must verify internal slots before reading arguments."); + +calls = []; +assert.throws(TypeError, function() { + fn(newLength); +}, "invoked as function"); +assert.compareArray(calls, [], + "[invoked as function] Must verify internal slots before reading arguments."); diff --git a/third_party/test262/test/built-ins/ArrayBuffer/prototype/transferToImmutable/this-is-not-detachable.js b/third_party/test262/test/built-ins/ArrayBuffer/prototype/transferToImmutable/this-is-not-detachable.js new file mode 100644 index 00000000000000..2dd1eefa81f620 --- /dev/null +++ b/third_party/test262/test/built-ins/ArrayBuffer/prototype/transferToImmutable/this-is-not-detachable.js @@ -0,0 +1,66 @@ +// Copyright (C) 2025 Richard Gibson. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-arraybuffer.prototype.transfertoimmutable +description: > + Throws a TypeError exception when `this` is already detached or immutable +info: | + ArrayBuffer.prototype.transferToImmutable ( [ newLength ] ) + 1. Let O be the this value. + 2. Return ? ArrayBufferCopyAndDetach(O, newLength, ~immutable~). + + ArrayBufferCopyAndDetach ( arrayBuffer, newLength, preserveResizability ) + 1. Perform ? RequireInternalSlot(arrayBuffer, [[ArrayBufferData]]). + 2. If IsSharedArrayBuffer(arrayBuffer) is true, throw a TypeError exception. + 3. If newLength is undefined, then + a. Let newByteLength be arrayBuffer.[[ArrayBufferByteLength]]. + 4. Else, + a. Let newByteLength be ? ToIndex(newLength). + 5. If IsDetachedBuffer(arrayBuffer) is true, throw a TypeError exception. + 6. If IsImmutableBuffer(arrayBuffer) is true, throw a TypeError exception. +features: [immutable-arraybuffer] +includes: [compareArray.js, detachArrayBuffer.js] +---*/ + +var calls = []; +var newLength = { + valueOf() { + calls.push("newLength.valueOf"); + return 1; + } +}; + +var detached = new ArrayBuffer(8); +$DETACHBUFFER(detached); +var immutable = (new ArrayBuffer(8)).transferToImmutable(); + +var badReceivers = [ + ["detached ArrayBuffer", detached], + ["immutable ArrayBuffer", immutable] +]; + +for (var i = 0; i < badReceivers.length; i++) { + var label = badReceivers[i][0]; + var value = badReceivers[i][1]; + calls = []; + assert.throws(TypeError, function() { + value.transferToImmutable(newLength); + }, label); + assert.compareArray(calls, ["newLength.valueOf"], + "[" + label + "] Must read arguments before verifying detachability."); +} + +calls = []; +var becomesDetached = new ArrayBuffer(8); +assert.throws(TypeError, function() { + becomesDetached.transferToImmutable({ + valueOf() { + calls.push("newLength.valueOf"); + $DETACHBUFFER(becomesDetached); + return 1; + } + }); +}, "becomes detached"); +assert.compareArray(calls, ["newLength.valueOf"], + "[becomes detached] Must read arguments before verifying detachability."); diff --git a/third_party/test262/test/built-ins/ArrayBuffer/prototype/transferToImmutable/this-is-not-object.js b/third_party/test262/test/built-ins/ArrayBuffer/prototype/transferToImmutable/this-is-not-object.js new file mode 100644 index 00000000000000..3a686ae4a7c7f6 --- /dev/null +++ b/third_party/test262/test/built-ins/ArrayBuffer/prototype/transferToImmutable/this-is-not-object.js @@ -0,0 +1,50 @@ +// Copyright (C) 2025 Richard Gibson. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-arraybuffer.prototype.transfertoimmutable +description: Throws a TypeError exception when `this` is not an object +info: | + ArrayBuffer.prototype.transferToImmutable ( [ newLength ] ) + 1. Let O be the this value. + 2. Return ? ArrayBufferCopyAndDetach(O, newLength, ~immutable~). + + ArrayBufferCopyAndDetach ( arrayBuffer, newLength, preserveResizability ) + 1. Perform ?ย RequireInternalSlot(arrayBuffer, [[ArrayBufferData]]). +features: [ArrayBuffer, immutable-arraybuffer] +includes: [compareArray.js] +---*/ + +var fn = ArrayBuffer.prototype.transferToImmutable; +assert.sameValue(typeof fn, "function", "Method must exist."); + +var calls = []; +var newLength = { + valueOf() { + calls.push("newLength.valueOf"); + return 1; + } +}; + +var badReceivers = [ + ["undefined", undefined], + ["null", null], + ["number", 42], + ["string", "1"], + ["true", true], + ["false", false], + typeof Symbol === "undefined" ? undefined : ["unique symbol", Symbol("1")], + typeof Symbol === "undefined" || !Symbol.for ? undefined : ["registered symbol", Symbol.for("1")], + typeof BigInt === "undefined" ? undefined : ["bigint", BigInt(1)] +]; + +for (var i = 0; i < badReceivers.length; i++) { + var label = badReceivers[i][0]; + var value = badReceivers[i][1]; + calls = []; + assert.throws(TypeError, function() { + fn.call(value, newLength); + }, label); + assert.compareArray(calls, [], + "[" + label + " receiver] Must verify internal slots before reading arguments."); +} diff --git a/third_party/test262/test/built-ins/ArrayBuffer/prototype/transferToImmutable/this-is-sharedarraybuffer.js b/third_party/test262/test/built-ins/ArrayBuffer/prototype/transferToImmutable/this-is-sharedarraybuffer.js new file mode 100644 index 00000000000000..53ab24c4789f61 --- /dev/null +++ b/third_party/test262/test/built-ins/ArrayBuffer/prototype/transferToImmutable/this-is-sharedarraybuffer.js @@ -0,0 +1,34 @@ +// Copyright (C) 2025 Richard Gibson. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-arraybuffer.prototype.transfertoimmutable +description: Throws a TypeError exception when `this` is a SharedArrayBuffer +info: | + ArrayBuffer.prototype.transferToImmutable ( [ newLength ] ) + 1. Let O be the this value. + 2. Return ? ArrayBufferCopyAndDetach(O, newLength, ~immutable~). + + ArrayBufferCopyAndDetach ( arrayBuffer, newLength, preserveResizability ) + 1. Perform ?ย RequireInternalSlot(arrayBuffer, [[ArrayBufferData]]). + 2. If IsSharedArrayBuffer(arrayBuffer) is true, throw a TypeError exception. +features: [SharedArrayBuffer, ArrayBuffer, immutable-arraybuffer] +includes: [compareArray.js] +---*/ + +var fn = ArrayBuffer.prototype.transferToImmutable; +assert.sameValue(typeof fn, "function", "Method must exist."); + +var calls = []; + +var sab = new SharedArrayBuffer(4); +assert.throws(TypeError, function() { + fn.call(sab, { + valueOf() { + calls.push("newLength.valueOf"); + return 1; + } + }); +}); +assert.compareArray(calls, [], + "Must verify non-SharedArrayBuffer receiver before reading arguments."); diff --git a/third_party/test262/test/built-ins/ArrayBuffer/prototype/transferToImmutable/to-larger.js b/third_party/test262/test/built-ins/ArrayBuffer/prototype/transferToImmutable/to-larger.js new file mode 100644 index 00000000000000..a99cf7ca1b1454 --- /dev/null +++ b/third_party/test262/test/built-ins/ArrayBuffer/prototype/transferToImmutable/to-larger.js @@ -0,0 +1,79 @@ +// Copyright (C) 2025 Richard Gibson. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-arraybuffer.prototype.transfertoimmutable +description: > + `ab.transferToImmutable(largerByteLength)` detaches `ab` and returns an + immutable ArrayBuffer with contents equal to the concatenation of `ab` and + enough zeros to fill the specified length +info: | + ArrayBuffer.prototype.transferToImmutable ( [ newLength ] ) + 1. Let O be the this value. + 2. Return ? ArrayBufferCopyAndDetach(O, newLength, ~immutable~). + + ArrayBufferCopyAndDetach ( arrayBuffer, newLength, preserveResizability ) + 1. Perform ? RequireInternalSlot(arrayBuffer, [[ArrayBufferData]]). + 2. If IsSharedArrayBuffer(arrayBuffer) is true, throw a TypeError exception. + 3. If newLength is undefined, then + a. Let newByteLength be arrayBuffer.[[ArrayBufferByteLength]]. + 4. Else, + a. Let newByteLength be ? ToIndex(newLength). + 5. If IsDetachedBuffer(arrayBuffer) is true, throw a TypeError exception. + 6. If IsImmutableBuffer(arrayBuffer) is true, throw a TypeError exception. + 7. If arrayBuffer.[[ArrayBufferDetachKey]] is not undefined, throw a TypeError exception. + 8. Let copyLength be min(newByteLength, arrayBuffer.[[ArrayBufferByteLength]]). + 9. If preserveResizability is immutable, then + a. Let newBuffer be ? AllocateImmutableArrayBuffer(%ArrayBuffer%, newByteLength, arrayBuffer.[[ArrayBufferData]], 0, copyLength). + 10. Else, ... + 11. Perform !ย DetachArrayBuffer(arrayBuffer). +features: [Uint8Array, immutable-arraybuffer] +includes: [compareArray.js] +---*/ + +var byteLength = 4; +var newLengths = [5, 8, 9]; +var sourceMakers = [ + function fixed() { + return new ArrayBuffer(byteLength); + }, + ArrayBuffer.prototype.resize && function resizable() { + return new ArrayBuffer(byteLength, { maxByteLength: byteLength * 2 }); + }, + ArrayBuffer.prototype.resize && function shrunk() { + var ab = new ArrayBuffer(byteLength * 2, { maxByteLength: byteLength * 2 }); + ab.resize(byteLength); + return ab; + }, + ArrayBuffer.prototype.resize && function grown() { + var ab = new ArrayBuffer(byteLength / 2, { maxByteLength: byteLength }); + ab.resize(byteLength); + return ab; + } +]; + +for (var i = 0; i < sourceMakers.length; i++) { + if (!sourceMakers[i]) continue; + var name = sourceMakers[i].name; + for (var j = 0; j < newLengths.length; j++) { + var newLength = newLengths[j]; + var label = name + "(" + byteLength + ").transferToImmutable(" + newLength + ")"; + var source = sourceMakers[i](); + var sourceView = new Uint8Array(source); + var expectDestContents = new Array(newLength); + for (var k = 0; k < newLength; k++) { + if (k < byteLength) sourceView[k] = k + 1; + expectDestContents[k] = k < byteLength ? k + 1 : 0; + } + + var dest = source.transferToImmutable(newLength); + assert.sameValue(source.detached, true, label + " source detached"); + assert.sameValue(dest.immutable, true, label + " is immutable"); + assert.sameValue(dest.resizable, false, label + " is not resizable"); + assert.sameValue(dest.byteLength, newLength, label + " byteLength"); + assert.sameValue(dest.maxByteLength, newLength, label + " maxByteLength"); + + var destView = new Uint8Array(dest); + assert.compareArray(destView, expectDestContents, label + " contents"); + } +} diff --git a/third_party/test262/test/built-ins/ArrayBuffer/prototype/transferToImmutable/to-same-or-smaller.js b/third_party/test262/test/built-ins/ArrayBuffer/prototype/transferToImmutable/to-same-or-smaller.js new file mode 100644 index 00000000000000..b0c7e444080484 --- /dev/null +++ b/third_party/test262/test/built-ins/ArrayBuffer/prototype/transferToImmutable/to-same-or-smaller.js @@ -0,0 +1,76 @@ +// Copyright (C) 2025 Richard Gibson. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-arraybuffer.prototype.transfertoimmutable +description: > + `ab.transferToImmutable(sameOrSmallerByteLength)` detaches `ab` and returns an + immutable ArrayBuffer with contents equal to the specified-length prefix of + `ab` +info: | + ArrayBuffer.prototype.transferToImmutable ( [ newLength ] ) + 1. Let O be the this value. + 2. Return ? ArrayBufferCopyAndDetach(O, newLength, ~immutable~). + + ArrayBufferCopyAndDetach ( arrayBuffer, newLength, preserveResizability ) + 1. Perform ? RequireInternalSlot(arrayBuffer, [[ArrayBufferData]]). + 2. If IsSharedArrayBuffer(arrayBuffer) is true, throw a TypeError exception. + 3. If newLength is undefined, then + a. Let newByteLength be arrayBuffer.[[ArrayBufferByteLength]]. + 4. Else, + a. Let newByteLength be ? ToIndex(newLength). + 5. If IsDetachedBuffer(arrayBuffer) is true, throw a TypeError exception. + 6. If IsImmutableBuffer(arrayBuffer) is true, throw a TypeError exception. + 7. If arrayBuffer.[[ArrayBufferDetachKey]] is not undefined, throw a TypeError exception. + 8. Let copyLength be min(newByteLength, arrayBuffer.[[ArrayBufferByteLength]]). + 9. If preserveResizability is immutable, then + a. Let newBuffer be ? AllocateImmutableArrayBuffer(%ArrayBuffer%, newByteLength, arrayBuffer.[[ArrayBufferData]], 0, copyLength). + 10. Else, ... + 11. Perform !ย DetachArrayBuffer(arrayBuffer). +features: [Uint8Array, immutable-arraybuffer] +includes: [compareArray.js] +---*/ + +var byteLength = 4; +var sourceMakers = [ + function fixed() { + return new ArrayBuffer(byteLength); + }, + ArrayBuffer.prototype.resize && function resizable() { + return new ArrayBuffer(byteLength, { maxByteLength: byteLength * 2 }); + }, + ArrayBuffer.prototype.resize && function shrunk() { + var ab = new ArrayBuffer(byteLength * 2, { maxByteLength: byteLength * 2 }); + ab.resize(byteLength); + return ab; + }, + ArrayBuffer.prototype.resize && function grown() { + var ab = new ArrayBuffer(byteLength / 2, { maxByteLength: byteLength }); + ab.resize(byteLength); + return ab; + } +]; + +for (var i = 0; i < sourceMakers.length; i++) { + if (!sourceMakers[i]) continue; + var name = sourceMakers[i].name; + for (var j = -1; j <= byteLength; j++) { + var newLength = j < 0 ? undefined : j; + var label = name + "(" + byteLength + ").transferToImmutable(" + newLength + ")"; + var source = sourceMakers[i](); + var sourceView = new Uint8Array(source); + for (var k = 0; k < byteLength; k++) sourceView[k] = k + 1; + var expectDestContents = sourceView.slice(0, newLength); + + var dest = source.transferToImmutable(newLength); + assert.sameValue(source.detached, true, label + " source detached"); + assert.sameValue(dest.immutable, true, label + " is immutable"); + assert.sameValue(dest.resizable, false, label + " is not resizable"); + var resolvedNewLength = newLength === undefined ? byteLength : newLength; + assert.sameValue(dest.byteLength, resolvedNewLength, label + " byteLength"); + assert.sameValue(dest.maxByteLength, resolvedNewLength, label + " maxByteLength"); + + var destView = new Uint8Array(dest); + assert.compareArray(destView, expectDestContents, label + " contents"); + } +} diff --git a/third_party/test262/test/built-ins/ArrayIteratorPrototype/next/detach-typedarray-in-progress.js b/third_party/test262/test/built-ins/ArrayIteratorPrototype/next/detach-typedarray-in-progress.js index da00362a77eb52..f0abf09b6f17f9 100644 --- a/third_party/test262/test/built-ins/ArrayIteratorPrototype/next/detach-typedarray-in-progress.js +++ b/third_party/test262/test/built-ins/ArrayIteratorPrototype/next/detach-typedarray-in-progress.js @@ -13,8 +13,8 @@ includes: [testTypedArray.js, detachArrayBuffer.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(TA => { - var typedArray = new TA(5); +testWithAllTypedArrayConstructors((TA, makeCtorArg) => { + var typedArray = new TA(makeCtorArg(5)); var i = 0; assert.throws(TypeError, () => { for (let key of typedArray.keys()) { @@ -23,4 +23,4 @@ testWithTypedArrayConstructors(TA => { } }); assert.sameValue(i, 1); -}, null, ["passthrough"]); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/Atomics/add/bad-range.js b/third_party/test262/test/built-ins/Atomics/add/bad-range.js index e01d96c79147cf..76994f228d4cbe 100644 --- a/third_party/test262/test/built-ins/Atomics/add/bad-range.js +++ b/third_party/test262/test/built-ins/Atomics/add/bad-range.js @@ -19,4 +19,4 @@ testWithTypedArrayConstructors(function(TA) { Atomics.add(view, IdxGen(view), 10); }); }); -}, views); +}, views, ["passthrough"]); diff --git a/third_party/test262/test/built-ins/Atomics/add/bigint/non-shared-bufferdata.js b/third_party/test262/test/built-ins/Atomics/add/bigint/non-shared-bufferdata.js index 1f989deda7300c..c0ed426b7af992 100644 --- a/third_party/test262/test/built-ins/Atomics/add/bigint/non-shared-bufferdata.js +++ b/third_party/test262/test/built-ins/Atomics/add/bigint/non-shared-bufferdata.js @@ -7,9 +7,9 @@ description: > includes: [testTypedArray.js] features: [ArrayBuffer, Atomics, BigInt, TypedArray] ---*/ -testWithBigIntTypedArrayConstructors(TA => { - const buffer = new ArrayBuffer(TA.BYTES_PER_ELEMENT * 4); +testWithBigIntTypedArrayConstructors((TA, makeCtorArg) => { + const buffer = makeCtorArg(4); const view = new TA(buffer); assert.sameValue(Atomics.add(view, 0, 1n), 0n, 'Atomics.add(view, 0, 1n) returns 0n'); assert.sameValue(Atomics.load(view, 0), 1n, 'Atomics.load(view, 0) returns 1n'); -}, null, ["passthrough"]); +}, null, ["arraybuffer"], ["immutable"]); diff --git a/third_party/test262/test/built-ins/Atomics/add/good-views.js b/third_party/test262/test/built-ins/Atomics/add/good-views.js index 95f60854d90eaa..a4cec394f2a986 100644 --- a/third_party/test262/test/built-ins/Atomics/add/good-views.js +++ b/third_party/test262/test/built-ins/Atomics/add/good-views.js @@ -51,4 +51,4 @@ testWithTypedArrayConstructors(function(TA) { Atomics.store(view, Idx, 37); assert.sameValue(Atomics.add(view, Idx, 0), 37, 'Atomics.add(view, Idx, 0) returns 37'); }); -}, views); +}, views, ["passthrough"]); diff --git a/third_party/test262/test/built-ins/Atomics/add/immutable-buffer.js b/third_party/test262/test/built-ins/Atomics/add/immutable-buffer.js new file mode 100644 index 00000000000000..deac3af56bbeb7 --- /dev/null +++ b/third_party/test262/test/built-ins/Atomics/add/immutable-buffer.js @@ -0,0 +1,52 @@ +// Copyright (C) 2025 Richard Gibson. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-atomics.add +description: > + Throws a TypeError exception when the backing buffer is immutable +info: | + Atomics.add ( typedArray, index, value ) + 1. Let add be a new read-modify-write modification function... + 2. Return ? AtomicReadModifyWrite(typedArray, index, value, add). + + AtomicReadModifyWrite ( typedArray, index, value, op ) + 1. Let byteIndexInBuffer be ?ย ValidateAtomicAccessOnIntegerTypedArray(typedArray, index, false, ~write~). + + ValidateAtomicAccessOnIntegerTypedArray ( typedArray, requestIndex [ , waitable [ , accessMode ] ] ) + 1. If waitable is not present, set waitable to false. + 2. If accessMode is not present, set accessMode to ~read~. + 3. Let taRecord be ? ValidateIntegerTypedArray(typedArray, waitable, accessMode). + + ValidateIntegerTypedArray ( typedArray, waitable [ , accessMode ] ) + 1. If accessMode is not present, set accessMode to ~read~. + 2. Let taRecord be ? ValidateTypedArray(typedArray, unordered, accessMode). + + ValidateTypedArray ( O, order [ , accessMode ] ) + ... + 4. If accessMode is ~write~ and IsImmutableBuffer(O.[[ViewedArrayBuffer]]) is true, throw a TypeError exception. +features: [Atomics, immutable-arraybuffer] +includes: [compareArray.js, testTypedArray.js] +---*/ + +testWithAllTypedArrayConstructors(function(TA, makeCtorArg) { + var calls = []; + var index = { + valueOf() { + calls.push("index.valueOf"); + return 0; + } + }; + var value = { + valueOf() { + calls.push("value.valueOf"); + return 1; + } + }; + + var ta = new TA(makeCtorArg(8)); + assert.throws(TypeError, function() { + Atomics.add(ta, index, value); + }); + assert.compareArray(calls, []); +}, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/Atomics/add/non-shared-bufferdata.js b/third_party/test262/test/built-ins/Atomics/add/non-shared-bufferdata.js index a326fa5f04ff50..ca82b20116fb55 100644 --- a/third_party/test262/test/built-ins/Atomics/add/non-shared-bufferdata.js +++ b/third_party/test262/test/built-ins/Atomics/add/non-shared-bufferdata.js @@ -8,11 +8,9 @@ description: > includes: [testTypedArray.js] features: [ArrayBuffer, Atomics, TypedArray] ---*/ -testWithAtomicsFriendlyTypedArrayConstructors(TA => { - const view = new TA( - new ArrayBuffer(TA.BYTES_PER_ELEMENT * 4) - ); +testWithAtomicsFriendlyTypedArrayConstructors((TA, makeCtorArg) => { + const view = new TA(makeCtorArg(4)); assert.sameValue(Atomics.add(view, 0, 1), 0, 'Atomics.add(view, 0, 1) returns 0'); assert.sameValue(Atomics.load(view, 0), 1, 'Atomics.load(view, 0) returns 1'); -}, null, ["passthrough"]); +}, ["arraybuffer"], ["immutable"]); diff --git a/third_party/test262/test/built-ins/Atomics/add/non-shared-int-views-throws.js b/third_party/test262/test/built-ins/Atomics/add/non-shared-int-views-throws.js index 4b2958e70616f5..1a0e9a231b2aad 100644 --- a/third_party/test262/test/built-ins/Atomics/add/non-shared-int-views-throws.js +++ b/third_party/test262/test/built-ins/Atomics/add/non-shared-int-views-throws.js @@ -4,15 +4,15 @@ /*--- esid: sec-atomics.add description: > - Atomics.add throws when operating on non-sharable integer TypedArrays + Atomics.add throws when operating on incompatible TypedArrays includes: [testTypedArray.js] features: [ArrayBuffer, Atomics, TypedArray] ---*/ -testWithNonAtomicsFriendlyTypedArrayConstructors(TA => { - const buffer = new ArrayBuffer(TA.BYTES_PER_ELEMENT * 4); +testWithNonAtomicsFriendlyTypedArrayConstructors((TA, makeCtorArg) => { + const buffer = makeCtorArg(4); const view = new TA(buffer); assert.throws(TypeError, function() { Atomics.add(view, 0, 1); }, `Atomics.add(new ${TA.name}(buffer), 0, 1) throws TypeError`); -}, null, ["passthrough"]); +}, ["arraybuffer"]); diff --git a/third_party/test262/test/built-ins/Atomics/and/bad-range.js b/third_party/test262/test/built-ins/Atomics/and/bad-range.js index 811e3941727020..291272363efc16 100644 --- a/third_party/test262/test/built-ins/Atomics/and/bad-range.js +++ b/third_party/test262/test/built-ins/Atomics/and/bad-range.js @@ -19,4 +19,4 @@ testWithTypedArrayConstructors(function(TA) { Atomics.and(view, IdxGen(view), 10); }); }); -}, views); +}, views, ["passthrough"]); diff --git a/third_party/test262/test/built-ins/Atomics/and/bigint/non-shared-bufferdata.js b/third_party/test262/test/built-ins/Atomics/and/bigint/non-shared-bufferdata.js index df04c89602c619..c677e9cbcfa9d1 100644 --- a/third_party/test262/test/built-ins/Atomics/and/bigint/non-shared-bufferdata.js +++ b/third_party/test262/test/built-ins/Atomics/and/bigint/non-shared-bufferdata.js @@ -7,9 +7,9 @@ description: > includes: [testTypedArray.js] features: [ArrayBuffer, Atomics, BigInt, TypedArray] ---*/ -testWithBigIntTypedArrayConstructors(TA => { - const buffer = new ArrayBuffer(TA.BYTES_PER_ELEMENT * 4); +testWithBigIntTypedArrayConstructors((TA, makeCtorArg) => { + const buffer = makeCtorArg(4); const view = new TA(buffer); assert.sameValue(Atomics.and(view, 0, 1n), 0n, 'Atomics.and(view, 0, 1n) returns 0n'); assert.sameValue(Atomics.load(view, 0), 0n, 'Atomics.load(view, 0) returns 0n'); -}, null, ["passthrough"]); +}, null, ["arraybuffer"], ["immutable"]); diff --git a/third_party/test262/test/built-ins/Atomics/and/good-views.js b/third_party/test262/test/built-ins/Atomics/and/good-views.js index 59fbd736c4b45b..634e48b6a792c4 100644 --- a/third_party/test262/test/built-ins/Atomics/and/good-views.js +++ b/third_party/test262/test/built-ins/Atomics/and/good-views.js @@ -66,4 +66,4 @@ testWithTypedArrayConstructors(function(TA) { Atomics.store(view, Idx, 37); assert.sameValue(Atomics.and(view, Idx, 0), 37, 'Atomics.and(view, Idx, 0) returns 37'); }); -}, views); +}, views, ["passthrough"]); diff --git a/third_party/test262/test/built-ins/Atomics/and/immutable-buffer.js b/third_party/test262/test/built-ins/Atomics/and/immutable-buffer.js new file mode 100644 index 00000000000000..c674c0eaf38507 --- /dev/null +++ b/third_party/test262/test/built-ins/Atomics/and/immutable-buffer.js @@ -0,0 +1,52 @@ +// Copyright (C) 2025 Richard Gibson. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-atomics.and +description: > + Throws a TypeError exception when the backing buffer is immutable +info: | + Atomics.and ( typedArray, index, value ) + 1. Let and be a new read-modify-write modification function... + 2. Return ? AtomicReadModifyWrite(typedArray, index, value, and). + + AtomicReadModifyWrite ( typedArray, index, value, op ) + 1. Let byteIndexInBuffer be ?ย ValidateAtomicAccessOnIntegerTypedArray(typedArray, index, false, ~write~). + + ValidateAtomicAccessOnIntegerTypedArray ( typedArray, requestIndex [ , waitable [ , accessMode ] ] ) + 1. If waitable is not present, set waitable to false. + 2. If accessMode is not present, set accessMode to ~read~. + 3. Let taRecord be ? ValidateIntegerTypedArray(typedArray, waitable, accessMode). + + ValidateIntegerTypedArray ( typedArray, waitable [ , accessMode ] ) + 1. If accessMode is not present, set accessMode to ~read~. + 2. Let taRecord be ? ValidateTypedArray(typedArray, unordered, accessMode). + + ValidateTypedArray ( O, order [ , accessMode ] ) + ... + 4. If accessMode is ~write~ and IsImmutableBuffer(O.[[ViewedArrayBuffer]]) is true, throw a TypeError exception. +features: [Atomics, immutable-arraybuffer] +includes: [compareArray.js, testTypedArray.js] +---*/ + +testWithAllTypedArrayConstructors(function(TA, makeCtorArg) { + var calls = []; + var index = { + valueOf() { + calls.push("index.valueOf"); + return 0; + } + }; + var value = { + valueOf() { + calls.push("value.valueOf"); + return 1; + } + }; + + var ta = new TA(makeCtorArg(8)); + assert.throws(TypeError, function() { + Atomics.and(ta, index, value); + }); + assert.compareArray(calls, []); +}, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/Atomics/and/non-shared-bufferdata.js b/third_party/test262/test/built-ins/Atomics/and/non-shared-bufferdata.js index a734a08b393ecf..12fcd57a3dcd14 100644 --- a/third_party/test262/test/built-ins/Atomics/and/non-shared-bufferdata.js +++ b/third_party/test262/test/built-ins/Atomics/and/non-shared-bufferdata.js @@ -8,11 +8,9 @@ description: > includes: [testTypedArray.js] features: [ArrayBuffer, Atomics, TypedArray] ---*/ -testWithAtomicsFriendlyTypedArrayConstructors(TA => { - const view = new TA( - new ArrayBuffer(TA.BYTES_PER_ELEMENT * 4) - ); +testWithAtomicsFriendlyTypedArrayConstructors((TA, makeCtorArg) => { + const view = new TA(makeCtorArg(4)); assert.sameValue(Atomics.and(view, 0, 1), 0, 'Atomics.and(view, 0, 1) returns 0'); assert.sameValue(Atomics.load(view, 0), 0, 'Atomics.load(view, 0) returns 0'); -}, null, ["passthrough"]); +}, ["arraybuffer"], ["immutable"]); diff --git a/third_party/test262/test/built-ins/Atomics/and/non-shared-int-views-throws.js b/third_party/test262/test/built-ins/Atomics/and/non-shared-int-views-throws.js index eb655928afb315..74d7d21858c6d7 100644 --- a/third_party/test262/test/built-ins/Atomics/and/non-shared-int-views-throws.js +++ b/third_party/test262/test/built-ins/Atomics/and/non-shared-int-views-throws.js @@ -4,15 +4,15 @@ /*--- esid: sec-atomics.and description: > - Atomics.and throws when operating on non-sharable integer TypedArrays + Atomics.and throws when operating on incompatible TypedArrays includes: [testTypedArray.js] features: [ArrayBuffer, Atomics, TypedArray] ---*/ -testWithNonAtomicsFriendlyTypedArrayConstructors(TA => { - const buffer = new ArrayBuffer(TA.BYTES_PER_ELEMENT * 4); +testWithNonAtomicsFriendlyTypedArrayConstructors((TA, makeCtorArg) => { + const buffer = makeCtorArg(4); const view = new TA(buffer); assert.throws(TypeError, function() { Atomics.and(view, 0, 1); }, `Atomics.and(new ${TA.name}(buffer), 0, 1) throws TypeError`); -}, null, ["passthrough"]); +}, ["arraybuffer"]); diff --git a/third_party/test262/test/built-ins/Atomics/compareExchange/bad-range.js b/third_party/test262/test/built-ins/Atomics/compareExchange/bad-range.js index 7fbd13a384e4fe..b3d0819fc0cf57 100644 --- a/third_party/test262/test/built-ins/Atomics/compareExchange/bad-range.js +++ b/third_party/test262/test/built-ins/Atomics/compareExchange/bad-range.js @@ -19,4 +19,4 @@ testWithTypedArrayConstructors(function(TA) { Atomics.compareExchange(view, IdxGen(view), 10, 0); }); }); -}, views); +}, views, ["passthrough"]); diff --git a/third_party/test262/test/built-ins/Atomics/compareExchange/bigint/non-shared-bufferdata.js b/third_party/test262/test/built-ins/Atomics/compareExchange/bigint/non-shared-bufferdata.js index 93b060bfabf234..3322221da8c552 100644 --- a/third_party/test262/test/built-ins/Atomics/compareExchange/bigint/non-shared-bufferdata.js +++ b/third_party/test262/test/built-ins/Atomics/compareExchange/bigint/non-shared-bufferdata.js @@ -7,9 +7,9 @@ description: > includes: [testTypedArray.js] features: [ArrayBuffer, Atomics, BigInt, TypedArray] ---*/ -testWithBigIntTypedArrayConstructors(TA => { - const buffer = new ArrayBuffer(TA.BYTES_PER_ELEMENT * 4); +testWithBigIntTypedArrayConstructors((TA, makeCtorArg) => { + const buffer = makeCtorArg(4); const view = new TA(buffer); assert.sameValue(Atomics.compareExchange(view, 0, 0n, 1n), 0n, 'Atomics.compareExchange(view, 0, 0n, 1n) returns 0n'); assert.sameValue(Atomics.load(view, 0), 1n, 'Atomics.load(view, 0) returns 1n'); -}, null, ["passthrough"]); +}, null, ["arraybuffer"], ["immutable"]); diff --git a/third_party/test262/test/built-ins/Atomics/compareExchange/good-views.js b/third_party/test262/test/built-ins/Atomics/compareExchange/good-views.js index 99a55768041aee..03e7c0220e7f2c 100644 --- a/third_party/test262/test/built-ins/Atomics/compareExchange/good-views.js +++ b/third_party/test262/test/built-ins/Atomics/compareExchange/good-views.js @@ -71,4 +71,4 @@ testWithTypedArrayConstructors(function(TA) { 'Atomics.compareExchange(view, Idx, 37, 0) returns 37' ); }); -}, views); +}, views, ["passthrough"]); diff --git a/third_party/test262/test/built-ins/Atomics/compareExchange/immutable-buffer.js b/third_party/test262/test/built-ins/Atomics/compareExchange/immutable-buffer.js new file mode 100644 index 00000000000000..41bc1624d30ea8 --- /dev/null +++ b/third_party/test262/test/built-ins/Atomics/compareExchange/immutable-buffer.js @@ -0,0 +1,54 @@ +// Copyright (C) 2025 Richard Gibson. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-atomics.compareexchange +description: > + Throws a TypeError exception when the backing buffer is immutable +info: | + Atomics.compareExchange ( typedArray, index, expectedValue, replacementValue ) + 1. Let byteIndexInBuffer be ?ย ValidateAtomicAccessOnIntegerTypedArray(typedArray, index, false, ~write~). + + ValidateAtomicAccessOnIntegerTypedArray ( typedArray, requestIndex [ , waitable [ , accessMode ] ] ) + 1. If waitable is not present, set waitable to false. + 2. If accessMode is not present, set accessMode to ~read~. + 3. Let taRecord be ? ValidateIntegerTypedArray(typedArray, waitable, accessMode). + + ValidateIntegerTypedArray ( typedArray, waitable [ , accessMode ] ) + 1. If accessMode is not present, set accessMode to ~read~. + 2. Let taRecord be ? ValidateTypedArray(typedArray, unordered, accessMode). + + ValidateTypedArray ( O, order [ , accessMode ] ) + ... + 4. If accessMode is ~write~ and IsImmutableBuffer(O.[[ViewedArrayBuffer]]) is true, throw a TypeError exception. +features: [Atomics, immutable-arraybuffer] +includes: [compareArray.js, testTypedArray.js] +---*/ + +testWithAllTypedArrayConstructors(function(TA, makeCtorArg) { + var calls = []; + var index = { + valueOf() { + calls.push("index.valueOf"); + return 0; + } + }; + var expectedValue = { + valueOf() { + calls.push("expectedValue.valueOf"); + return 0; + } + }; + var replacementValue = { + valueOf() { + calls.push("replacementValue.valueOf"); + return 1; + } + }; + + var ta = new TA(makeCtorArg(8)); + assert.throws(TypeError, function() { + Atomics.compareExchange(ta, index, expectedValue, replacementValue); + }); + assert.compareArray(calls, []); +}, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/Atomics/compareExchange/non-shared-bufferdata.js b/third_party/test262/test/built-ins/Atomics/compareExchange/non-shared-bufferdata.js index 57d00a34598bb0..e808423814e096 100644 --- a/third_party/test262/test/built-ins/Atomics/compareExchange/non-shared-bufferdata.js +++ b/third_party/test262/test/built-ins/Atomics/compareExchange/non-shared-bufferdata.js @@ -8,11 +8,9 @@ description: > includes: [testTypedArray.js] features: [ArrayBuffer, Atomics, TypedArray] ---*/ -testWithAtomicsFriendlyTypedArrayConstructors(TA => { - const view = new TA( - new ArrayBuffer(TA.BYTES_PER_ELEMENT * 4) - ); +testWithAtomicsFriendlyTypedArrayConstructors((TA, makeCtorArg) => { + const view = new TA(makeCtorArg(4)); assert.sameValue(Atomics.compareExchange(view, 0, 0, 1), 0, 'Atomics.compareExchange(view, 0, 0, 1) returns 0'); assert.sameValue(Atomics.load(view, 0), 1, 'Atomics.load(view, 0) returns 1'); -}, null, ["passthrough"]); +}, ["arraybuffer"], ["immutable"]); diff --git a/third_party/test262/test/built-ins/Atomics/compareExchange/non-shared-int-views-throws.js b/third_party/test262/test/built-ins/Atomics/compareExchange/non-shared-int-views-throws.js index 3a4e907946dc9e..3ef0e4b61260ce 100644 --- a/third_party/test262/test/built-ins/Atomics/compareExchange/non-shared-int-views-throws.js +++ b/third_party/test262/test/built-ins/Atomics/compareExchange/non-shared-int-views-throws.js @@ -4,15 +4,15 @@ /*--- esid: sec-atomics.compareexchange description: > - Atomics.compareExchange throws when operating on non-sharable integer TypedArrays + Atomics.compareExchange throws when operating on incompatible TypedArrays includes: [testTypedArray.js] features: [ArrayBuffer, Atomics, TypedArray] ---*/ -testWithNonAtomicsFriendlyTypedArrayConstructors(TA => { - const buffer = new ArrayBuffer(TA.BYTES_PER_ELEMENT * 4); +testWithNonAtomicsFriendlyTypedArrayConstructors((TA, makeCtorArg) => { + const buffer = makeCtorArg(4); const view = new TA(buffer); assert.throws(TypeError, function() { Atomics.compareExchange(view, 0, 0, 0); }, `Atomics.compareExchange(new ${TA.name}(buffer), 0, 0, 0) throws TypeError`); -}, null, ["passthrough"]); +}, ["arraybuffer"]); diff --git a/third_party/test262/test/built-ins/Atomics/exchange/bad-range.js b/third_party/test262/test/built-ins/Atomics/exchange/bad-range.js index a7f47b0bf253d3..4f1e7b88539575 100644 --- a/third_party/test262/test/built-ins/Atomics/exchange/bad-range.js +++ b/third_party/test262/test/built-ins/Atomics/exchange/bad-range.js @@ -19,4 +19,4 @@ testWithTypedArrayConstructors(function(TA) { Atomics.exchange(view, IdxGen(view), 10, 0); }); }); -}, views); +}, views, ["passthrough"]); diff --git a/third_party/test262/test/built-ins/Atomics/exchange/bigint/non-shared-bufferdata.js b/third_party/test262/test/built-ins/Atomics/exchange/bigint/non-shared-bufferdata.js index be94a42a77d98e..1257b4e8828bf4 100644 --- a/third_party/test262/test/built-ins/Atomics/exchange/bigint/non-shared-bufferdata.js +++ b/third_party/test262/test/built-ins/Atomics/exchange/bigint/non-shared-bufferdata.js @@ -7,9 +7,9 @@ description: > includes: [testTypedArray.js] features: [ArrayBuffer, Atomics, BigInt, TypedArray] ---*/ -testWithBigIntTypedArrayConstructors(TA => { - const buffer = new ArrayBuffer(TA.BYTES_PER_ELEMENT * 4); +testWithBigIntTypedArrayConstructors((TA, makeCtorArg) => { + const buffer = makeCtorArg(4); const view = new TA(buffer); assert.sameValue(Atomics.exchange(view, 0, 1n), 0n, 'Atomics.exchange(view, 0, 1n) returns 0n'); assert.sameValue(Atomics.load(view, 0), 1n, 'Atomics.load(view, 0) returns 1n'); -}, null, ["passthrough"]); +}, null, ["arraybuffer"], ["immutable"]); diff --git a/third_party/test262/test/built-ins/Atomics/exchange/good-views.js b/third_party/test262/test/built-ins/Atomics/exchange/good-views.js index 90b635d893baee..9a3783b1adc195 100644 --- a/third_party/test262/test/built-ins/Atomics/exchange/good-views.js +++ b/third_party/test262/test/built-ins/Atomics/exchange/good-views.js @@ -52,4 +52,4 @@ testWithTypedArrayConstructors(function(TA) { Atomics.store(view, Idx, 37); assert.sameValue(Atomics.exchange(view, Idx, 0), 37, 'Atomics.exchange(view, Idx, 0) returns 37'); }); -}, views); +}, views, ["passthrough"]); diff --git a/third_party/test262/test/built-ins/Atomics/exchange/immutable-buffer.js b/third_party/test262/test/built-ins/Atomics/exchange/immutable-buffer.js new file mode 100644 index 00000000000000..77a6cd75fa6636 --- /dev/null +++ b/third_party/test262/test/built-ins/Atomics/exchange/immutable-buffer.js @@ -0,0 +1,52 @@ +// Copyright (C) 2025 Richard Gibson. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-atomics.exchange +description: > + Throws a TypeError exception when the backing buffer is immutable +info: | + Atomics.exchange ( typedArray, index, value ) + 1. Let second be a new read-modify-write modification function... + 2. Return ? AtomicReadModifyWrite(typedArray, index, value, second). + + AtomicReadModifyWrite ( typedArray, index, value, op ) + 1. Let byteIndexInBuffer be ?ย ValidateAtomicAccessOnIntegerTypedArray(typedArray, index, false, ~write~). + + ValidateAtomicAccessOnIntegerTypedArray ( typedArray, requestIndex [ , waitable [ , accessMode ] ] ) + 1. If waitable is not present, set waitable to false. + 2. If accessMode is not present, set accessMode to ~read~. + 3. Let taRecord be ? ValidateIntegerTypedArray(typedArray, waitable, accessMode). + + ValidateIntegerTypedArray ( typedArray, waitable [ , accessMode ] ) + 1. If accessMode is not present, set accessMode to ~read~. + 2. Let taRecord be ? ValidateTypedArray(typedArray, unordered, accessMode). + + ValidateTypedArray ( O, order [ , accessMode ] ) + ... + 4. If accessMode is ~write~ and IsImmutableBuffer(O.[[ViewedArrayBuffer]]) is true, throw a TypeError exception. +features: [Atomics, immutable-arraybuffer] +includes: [compareArray.js, testTypedArray.js] +---*/ + +testWithAllTypedArrayConstructors(function(TA, makeCtorArg) { + var calls = []; + var index = { + valueOf() { + calls.push("index.valueOf"); + return 0; + } + }; + var value = { + valueOf() { + calls.push("value.valueOf"); + return 1; + } + }; + + var ta = new TA(makeCtorArg(8)); + assert.throws(TypeError, function() { + Atomics.exchange(ta, index, value); + }); + assert.compareArray(calls, []); +}, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/Atomics/exchange/non-shared-bufferdata.js b/third_party/test262/test/built-ins/Atomics/exchange/non-shared-bufferdata.js index 6fdb39decfb2ee..de36d4fd17e57d 100644 --- a/third_party/test262/test/built-ins/Atomics/exchange/non-shared-bufferdata.js +++ b/third_party/test262/test/built-ins/Atomics/exchange/non-shared-bufferdata.js @@ -8,11 +8,9 @@ description: > includes: [testTypedArray.js] features: [ArrayBuffer, Atomics, TypedArray] ---*/ -testWithAtomicsFriendlyTypedArrayConstructors(TA => { - const view = new TA( - new ArrayBuffer(TA.BYTES_PER_ELEMENT * 4) - ); +testWithAtomicsFriendlyTypedArrayConstructors((TA, makeCtorArg) => { + const view = new TA(makeCtorArg(4)); assert.sameValue(Atomics.exchange(view, 0, 1), 0, 'Atomics.exchange(view, 0, 1) returns 0'); assert.sameValue(Atomics.load(view, 0), 1, 'Atomics.load(view, 0) returns 1'); -}, null, ["passthrough"]); +}, ["arraybuffer"], ["immutable"]); diff --git a/third_party/test262/test/built-ins/Atomics/exchange/non-shared-int-views-throws.js b/third_party/test262/test/built-ins/Atomics/exchange/non-shared-int-views-throws.js index c179d828abb9fd..5e4bc4447d979b 100644 --- a/third_party/test262/test/built-ins/Atomics/exchange/non-shared-int-views-throws.js +++ b/third_party/test262/test/built-ins/Atomics/exchange/non-shared-int-views-throws.js @@ -4,14 +4,14 @@ /*--- esid: sec-atomics.exchange description: > - Atomics.exchange throws when operating on non-sharable integer TypedArrays + Atomics.exchange throws when operating on incompatible TypedArrays includes: [testTypedArray.js] features: [ArrayBuffer, Atomics, TypedArray] ---*/ -testWithNonAtomicsFriendlyTypedArrayConstructors(TA => { - const buffer = new ArrayBuffer(TA.BYTES_PER_ELEMENT * 4); +testWithNonAtomicsFriendlyTypedArrayConstructors((TA, makeCtorArg) => { + const buffer = makeCtorArg(4); const view = new TA(buffer); assert.throws(TypeError, function() { Atomics.exchange(view, 0, 1); }, `Atomics.exchange(new ${TA.name}(buffer), 0, 1) throws TypeError`); -}, null, ["passthrough"]); +}, ["arraybuffer"]); diff --git a/third_party/test262/test/built-ins/Atomics/exchange/nonshared-int-views.js b/third_party/test262/test/built-ins/Atomics/exchange/nonshared-int-views.js deleted file mode 100644 index b57c7634cdeefb..00000000000000 --- a/third_party/test262/test/built-ins/Atomics/exchange/nonshared-int-views.js +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (C) 2017 Mozilla Corporation. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-atomics.exchange -description: > - Atomics.exchange throws when operating on non-sharable integer TypedArrays -includes: [testTypedArray.js] -features: [ArrayBuffer, Atomics, TypedArray] ----*/ - -testWithNonAtomicsFriendlyTypedArrayConstructors(TA => { - const buffer = new ArrayBuffer(TA.BYTES_PER_ELEMENT * 4); - const view = new TA(buffer); - - assert.throws(TypeError, function() { - Atomics.exchange(view, 0, 0); - }, `Atomics.exchange(new ${TA.name}(buffer), 0, 0) throws TypeError`); -}, null, ["passthrough"]); diff --git a/third_party/test262/test/built-ins/Atomics/isLockFree/bigint/expected-return-value.js b/third_party/test262/test/built-ins/Atomics/isLockFree/bigint/expected-return-value.js index 3388924cf10ae1..3a2f7cbc8d20da 100644 --- a/third_party/test262/test/built-ins/Atomics/isLockFree/bigint/expected-return-value.js +++ b/third_party/test262/test/built-ins/Atomics/isLockFree/bigint/expected-return-value.js @@ -31,5 +31,3 @@ testWithBigIntTypedArrayConstructors(function(TA) { 'Atomics.isLockFree(TA.BYTES_PER_ELEMENT) returns the value of `observed` (Atomics.isLockFree(TA.BYTES_PER_ELEMENT))' ); }, null, ["passthrough"]); - - diff --git a/third_party/test262/test/built-ins/Atomics/load/bad-range.js b/third_party/test262/test/built-ins/Atomics/load/bad-range.js index 3a3fecbf7a4627..5c2e37c8067a6f 100644 --- a/third_party/test262/test/built-ins/Atomics/load/bad-range.js +++ b/third_party/test262/test/built-ins/Atomics/load/bad-range.js @@ -19,4 +19,4 @@ testWithTypedArrayConstructors(function(TA) { Atomics.load(view, IdxGen(view)); }); }); -}, views); +}, views, ["passthrough"]); diff --git a/third_party/test262/test/built-ins/Atomics/load/bigint/non-shared-bufferdata.js b/third_party/test262/test/built-ins/Atomics/load/bigint/non-shared-bufferdata.js index d5df77554c5112..08d782a91380fb 100644 --- a/third_party/test262/test/built-ins/Atomics/load/bigint/non-shared-bufferdata.js +++ b/third_party/test262/test/built-ins/Atomics/load/bigint/non-shared-bufferdata.js @@ -7,8 +7,8 @@ description: > includes: [testTypedArray.js] features: [ArrayBuffer, Atomics, BigInt, TypedArray] ---*/ -testWithBigIntTypedArrayConstructors(TA => { - const buffer = new ArrayBuffer(TA.BYTES_PER_ELEMENT * 4); +testWithBigIntTypedArrayConstructors((TA, makeCtorArg) => { + const buffer = makeCtorArg(4); const view = new TA(buffer); assert.sameValue(Atomics.load(view, 0), 0n, 'Atomics.load(view, 0) returns 0n'); -}, null, ["passthrough"]); +}, null, ["arraybuffer"]); diff --git a/third_party/test262/test/built-ins/Atomics/load/good-views.js b/third_party/test262/test/built-ins/Atomics/load/good-views.js index 69b3d281300274..5615801dcff7ad 100644 --- a/third_party/test262/test/built-ins/Atomics/load/good-views.js +++ b/third_party/test262/test/built-ins/Atomics/load/good-views.js @@ -43,4 +43,4 @@ testWithTypedArrayConstructors(function(TA) { Atomics.store(view, Idx, 37); assert.sameValue(Atomics.load(view, Idx), 37, 'Atomics.load(view, Idx) returns 37'); }); -}, views); +}, views, ["passthrough"]); diff --git a/third_party/test262/test/built-ins/Atomics/load/non-shared-bufferdata.js b/third_party/test262/test/built-ins/Atomics/load/non-shared-bufferdata.js index 51f485ee221ef9..e15e6605785978 100644 --- a/third_party/test262/test/built-ins/Atomics/load/non-shared-bufferdata.js +++ b/third_party/test262/test/built-ins/Atomics/load/non-shared-bufferdata.js @@ -8,10 +8,8 @@ description: > includes: [testTypedArray.js] features: [ArrayBuffer, Atomics, TypedArray] ---*/ -testWithAtomicsFriendlyTypedArrayConstructors(TA => { - const view = new TA( - new ArrayBuffer(TA.BYTES_PER_ELEMENT * 4) - ); +testWithAtomicsFriendlyTypedArrayConstructors((TA, makeCtorArg) => { + const view = new TA(makeCtorArg(4)); assert.sameValue(Atomics.load(view, 0), 0, 'Atomics.load(view, 0) returns 0'); -}, null, ["passthrough"]); +}, null, ["arraybuffer"]); diff --git a/third_party/test262/test/built-ins/Atomics/load/non-shared-int-views-throws.js b/third_party/test262/test/built-ins/Atomics/load/non-shared-int-views-throws.js index 1277efb684f55c..02437f7ba5ca1d 100644 --- a/third_party/test262/test/built-ins/Atomics/load/non-shared-int-views-throws.js +++ b/third_party/test262/test/built-ins/Atomics/load/non-shared-int-views-throws.js @@ -4,14 +4,14 @@ /*--- esid: sec-atomics.load description: > - Atomics.load throws when operating on non-sharable integer TypedArrays + Atomics.load throws when operating on incompatible TypedArrays includes: [testTypedArray.js] features: [ArrayBuffer, Atomics, TypedArray] ---*/ -testWithNonAtomicsFriendlyTypedArrayConstructors(TA => { - const buffer = new ArrayBuffer(TA.BYTES_PER_ELEMENT * 4); +testWithNonAtomicsFriendlyTypedArrayConstructors((TA, makeCtorArg) => { + const buffer = makeCtorArg(4); const view = new TA(buffer); assert.throws(TypeError, function() { Atomics.load(view, 0); }, `Atomics.load(new ${TA.name}(buffer), 0) throws TypeError`); -}, null, ["passthrough"]); +}, ["arraybuffer"]); diff --git a/third_party/test262/test/built-ins/Atomics/notify/immutable-buffer-returns-0.js b/third_party/test262/test/built-ins/Atomics/notify/immutable-buffer-returns-0.js new file mode 100644 index 00000000000000..f07f0a47fe0475 --- /dev/null +++ b/third_party/test262/test/built-ins/Atomics/notify/immutable-buffer-returns-0.js @@ -0,0 +1,46 @@ +// Copyright (C) 2025 Richard Gibson. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-atomics.notify +description: Returns 0 when TA.buffer is immutable +info: | + Atomics.notify ( typedArray, index, count ) + 1. Let taRecord be ? ValidateIntegerTypedArray(typedArray, true). + 2. Let byteIndexInBuffer be ? ValidateAtomicAccess(taRecord, index). + 3. If count is undefined, then + a. Let c be +โˆž. + 4. Else, + a. Let intCount be ? ToIntegerOrInfinity(count). + b. Let c be max(intCount, 0). + 5. Let buffer be typedArray.[[ViewedArrayBuffer]]. + 6. Let block be buffer.[[ArrayBufferData]]. + 7. If IsSharedArrayBuffer(buffer) is false, return +0๐”ฝ. +features: [ArrayBuffer, Atomics, immutable-arraybuffer] +includes: [compareArray.js, testTypedArray.js] +---*/ + +var waitableTypedArrayConstructors = [Int32Array]; +if (typeof BigInt64Array !== "undefined") { + waitableTypedArrayConstructors.push(BigInt64Array); +} + +testWithAllTypedArrayConstructors(function(TA, makeCtorArg) { + var calls = []; + var index = { + valueOf() { + calls.push("index.valueOf"); + return 0; + } + }; + var count = { + valueOf() { + calls.push("count.valueOf"); + return 1; + } + }; + + var ta = new TA(makeCtorArg(8)); + assert.sameValue(Atomics.notify(ta, index, count), 0); + assert.compareArray(calls, ["index.valueOf", "count.valueOf"]); +}, waitableTypedArrayConstructors, ["immutable"]); diff --git a/third_party/test262/test/built-ins/Atomics/or/bad-range.js b/third_party/test262/test/built-ins/Atomics/or/bad-range.js index c221f203f17595..1910e157ba535f 100644 --- a/third_party/test262/test/built-ins/Atomics/or/bad-range.js +++ b/third_party/test262/test/built-ins/Atomics/or/bad-range.js @@ -19,4 +19,4 @@ testWithTypedArrayConstructors(function(TA) { Atomics.or(view, IdxGen(view), 10); }); }); -}, views); +}, views, ["passthrough"]); diff --git a/third_party/test262/test/built-ins/Atomics/or/bigint/non-shared-bufferdata.js b/third_party/test262/test/built-ins/Atomics/or/bigint/non-shared-bufferdata.js index 6413bbe94072e5..f5cd4acac7e2d9 100644 --- a/third_party/test262/test/built-ins/Atomics/or/bigint/non-shared-bufferdata.js +++ b/third_party/test262/test/built-ins/Atomics/or/bigint/non-shared-bufferdata.js @@ -7,9 +7,9 @@ description: > includes: [testTypedArray.js] features: [ArrayBuffer, Atomics, BigInt, TypedArray] ---*/ -testWithBigIntTypedArrayConstructors(TA => { - const buffer = new ArrayBuffer(TA.BYTES_PER_ELEMENT * 4); +testWithBigIntTypedArrayConstructors((TA, makeCtorArg) => { + const buffer = makeCtorArg(4); const view = new TA(buffer); assert.sameValue(Atomics.or(view, 0, 1n), 0n, 'Atomics.or(view, 0, 1n) returns 0n'); assert.sameValue(Atomics.load(view, 0), 1n, 'Atomics.load(view, 0) returns 1n'); -}, null, ["passthrough"]); +}, null, ["arraybuffer"], ["immutable"]); diff --git a/third_party/test262/test/built-ins/Atomics/or/good-views.js b/third_party/test262/test/built-ins/Atomics/or/good-views.js index bea292a310f059..0f2cb4038e0d04 100644 --- a/third_party/test262/test/built-ins/Atomics/or/good-views.js +++ b/third_party/test262/test/built-ins/Atomics/or/good-views.js @@ -78,4 +78,4 @@ testWithTypedArrayConstructors(function(TA) { Atomics.store(view, Idx, 37); assert.sameValue(Atomics.or(view, Idx, 0), 37, 'Atomics.or(view, Idx, 0) returns 37'); }); -}, views); +}, views, ["passthrough"]); diff --git a/third_party/test262/test/built-ins/Atomics/or/immutable-buffer.js b/third_party/test262/test/built-ins/Atomics/or/immutable-buffer.js new file mode 100644 index 00000000000000..244ed23fa379ff --- /dev/null +++ b/third_party/test262/test/built-ins/Atomics/or/immutable-buffer.js @@ -0,0 +1,52 @@ +// Copyright (C) 2025 Richard Gibson. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-atomics.or +description: > + Throws a TypeError exception when the backing buffer is immutable +info: | + Atomics.or ( typedArray, index, value ) + 1. Let or be a new read-modify-write modification function... + 2. Return ? AtomicReadModifyWrite(typedArray, index, value, or). + + AtomicReadModifyWrite ( typedArray, index, value, op ) + 1. Let byteIndexInBuffer be ?ย ValidateAtomicAccessOnIntegerTypedArray(typedArray, index, false, ~write~). + + ValidateAtomicAccessOnIntegerTypedArray ( typedArray, requestIndex [ , waitable [ , accessMode ] ] ) + 1. If waitable is not present, set waitable to false. + 2. If accessMode is not present, set accessMode to ~read~. + 3. Let taRecord be ? ValidateIntegerTypedArray(typedArray, waitable, accessMode). + + ValidateIntegerTypedArray ( typedArray, waitable [ , accessMode ] ) + 1. If accessMode is not present, set accessMode to ~read~. + 2. Let taRecord be ? ValidateTypedArray(typedArray, unordered, accessMode). + + ValidateTypedArray ( O, order [ , accessMode ] ) + ... + 4. If accessMode is ~write~ and IsImmutableBuffer(O.[[ViewedArrayBuffer]]) is true, throw a TypeError exception. +features: [Atomics, immutable-arraybuffer] +includes: [compareArray.js, testTypedArray.js] +---*/ + +testWithAllTypedArrayConstructors(function(TA, makeCtorArg) { + var calls = []; + var index = { + valueOf() { + calls.push("index.valueOf"); + return 0; + } + }; + var value = { + valueOf() { + calls.push("value.valueOf"); + return 1; + } + }; + + var ta = new TA(makeCtorArg(8)); + assert.throws(TypeError, function() { + Atomics.or(ta, index, value); + }); + assert.compareArray(calls, []); +}, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/Atomics/or/non-shared-bufferdata.js b/third_party/test262/test/built-ins/Atomics/or/non-shared-bufferdata.js index bdd1060102a9e9..8bfc4a13f7ae88 100644 --- a/third_party/test262/test/built-ins/Atomics/or/non-shared-bufferdata.js +++ b/third_party/test262/test/built-ins/Atomics/or/non-shared-bufferdata.js @@ -8,11 +8,9 @@ description: > includes: [testTypedArray.js] features: [ArrayBuffer, Atomics, TypedArray] ---*/ -testWithAtomicsFriendlyTypedArrayConstructors(TA => { - const view = new TA( - new ArrayBuffer(TA.BYTES_PER_ELEMENT * 4) - ); +testWithAtomicsFriendlyTypedArrayConstructors((TA, makeCtorArg) => { + const view = new TA(makeCtorArg(4)); assert.sameValue(Atomics.or(view, 0, 1), 0, 'Atomics.or(view, 0, 1) returns 0'); assert.sameValue(Atomics.load(view, 0), 1, 'Atomics.load(view, 0) returns 1'); -}, null, ["passthrough"]); +}, ["arraybuffer"], ["immutable"]); diff --git a/third_party/test262/test/built-ins/Atomics/or/non-shared-int-views-throws.js b/third_party/test262/test/built-ins/Atomics/or/non-shared-int-views-throws.js index aa25ae3882d538..dfbbeedfbac41f 100644 --- a/third_party/test262/test/built-ins/Atomics/or/non-shared-int-views-throws.js +++ b/third_party/test262/test/built-ins/Atomics/or/non-shared-int-views-throws.js @@ -4,15 +4,15 @@ /*--- esid: sec-atomics.or description: > - Atomics.or throws when operating on non-sharable integer TypedArrays + Atomics.or throws when operating on incompatible TypedArrays includes: [testTypedArray.js] features: [ArrayBuffer, Atomics, TypedArray] ---*/ -testWithNonAtomicsFriendlyTypedArrayConstructors(TA => { - const buffer = new ArrayBuffer(TA.BYTES_PER_ELEMENT * 4); +testWithNonAtomicsFriendlyTypedArrayConstructors((TA, makeCtorArg) => { + const buffer = makeCtorArg(4); const view = new TA(buffer); assert.throws(TypeError, function() { Atomics.or(view, 0, 1); }, `Atomics.or(new ${TA.name}(buffer), 0, 1) throws TypeError`); -}, null, ["passthrough"]); +}, ["arraybuffer"]); diff --git a/third_party/test262/test/built-ins/Atomics/store/bad-range.js b/third_party/test262/test/built-ins/Atomics/store/bad-range.js index 4449f85dcd3e33..29f6167cca8787 100644 --- a/third_party/test262/test/built-ins/Atomics/store/bad-range.js +++ b/third_party/test262/test/built-ins/Atomics/store/bad-range.js @@ -19,4 +19,4 @@ testWithTypedArrayConstructors(function(TA) { Atomics.store(view, IdxGen(view), 10); }); }); -}, views); +}, views, ["passthrough"]); diff --git a/third_party/test262/test/built-ins/Atomics/store/bigint/non-shared-bufferdata.js b/third_party/test262/test/built-ins/Atomics/store/bigint/non-shared-bufferdata.js index 7ee3f779d12269..03a68db18e0d5b 100644 --- a/third_party/test262/test/built-ins/Atomics/store/bigint/non-shared-bufferdata.js +++ b/third_party/test262/test/built-ins/Atomics/store/bigint/non-shared-bufferdata.js @@ -7,9 +7,9 @@ description: > includes: [testTypedArray.js] features: [ArrayBuffer, Atomics, BigInt, TypedArray] ---*/ -testWithBigIntTypedArrayConstructors(TA => { - const buffer = new ArrayBuffer(TA.BYTES_PER_ELEMENT * 4); +testWithBigIntTypedArrayConstructors((TA, makeCtorArg) => { + const buffer = makeCtorArg(4); const view = new TA(buffer); assert.sameValue(Atomics.store(view, 0, 1n), 1n, 'Atomics.store(view, 0, 1n) returns 1n'); assert.sameValue(Atomics.load(view, 0), 1n, 'Atomics.load(view, 0) returns 1n'); -}, null, ["passthrough"]); +}, null, ["arraybuffer"], ["immutable"]); diff --git a/third_party/test262/test/built-ins/Atomics/store/good-views.js b/third_party/test262/test/built-ins/Atomics/store/good-views.js index f84c83ce7ed6fb..2b2b341d61aede 100644 --- a/third_party/test262/test/built-ins/Atomics/store/good-views.js +++ b/third_party/test262/test/built-ins/Atomics/store/good-views.js @@ -51,7 +51,7 @@ testWithTypedArrayConstructors(function(TA) { Atomics.store(view, Idx, 37); assert.sameValue(Atomics.load(view, Idx), 37, 'Atomics.load(view, Idx) returns 37'); }); -}, views); +}, views, ["passthrough"]); function ToInteger(v) { v = +v; diff --git a/third_party/test262/test/built-ins/Atomics/store/immutable-buffer.js b/third_party/test262/test/built-ins/Atomics/store/immutable-buffer.js new file mode 100644 index 00000000000000..32cab0ac9f453f --- /dev/null +++ b/third_party/test262/test/built-ins/Atomics/store/immutable-buffer.js @@ -0,0 +1,48 @@ +// Copyright (C) 2025 Richard Gibson. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-atomics.store +description: > + Throws a TypeError exception when the backing buffer is immutable +info: | + Atomics.store ( typedArray, index, value ) + 1. Let byteIndexInBuffer be ?ย ValidateAtomicAccessOnIntegerTypedArray(typedArray, index, false, ~write~). + + ValidateAtomicAccessOnIntegerTypedArray ( typedArray, requestIndex [ , waitable [ , accessMode ] ] ) + 1. If waitable is not present, set waitable to false. + 2. If accessMode is not present, set accessMode to ~read~. + 3. Let taRecord be ? ValidateIntegerTypedArray(typedArray, waitable, accessMode). + + ValidateIntegerTypedArray ( typedArray, waitable [ , accessMode ] ) + 1. If accessMode is not present, set accessMode to ~read~. + 2. Let taRecord be ? ValidateTypedArray(typedArray, unordered, accessMode). + + ValidateTypedArray ( O, order [ , accessMode ] ) + ... + 4. If accessMode is ~write~ and IsImmutableBuffer(O.[[ViewedArrayBuffer]]) is true, throw a TypeError exception. +features: [Atomics, immutable-arraybuffer] +includes: [compareArray.js, testTypedArray.js] +---*/ + +testWithAllTypedArrayConstructors(function(TA, makeCtorArg) { + var calls = []; + var index = { + valueOf() { + calls.push("index.valueOf"); + return 0; + } + }; + var value = { + valueOf() { + calls.push("value.valueOf"); + return 1; + } + }; + + var ta = new TA(makeCtorArg(8)); + assert.throws(TypeError, function() { + Atomics.store(ta, index, value); + }); + assert.compareArray(calls, []); +}, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/Atomics/store/non-shared-bufferdata.js b/third_party/test262/test/built-ins/Atomics/store/non-shared-bufferdata.js index 19cd477bef3c0d..680e3fc41c12da 100644 --- a/third_party/test262/test/built-ins/Atomics/store/non-shared-bufferdata.js +++ b/third_party/test262/test/built-ins/Atomics/store/non-shared-bufferdata.js @@ -8,11 +8,9 @@ description: > includes: [testTypedArray.js] features: [ArrayBuffer, Atomics, TypedArray] ---*/ -testWithAtomicsFriendlyTypedArrayConstructors(TA => { - const view = new TA( - new ArrayBuffer(TA.BYTES_PER_ELEMENT * 4) - ); +testWithAtomicsFriendlyTypedArrayConstructors((TA, makeCtorArg) => { + const view = new TA(makeCtorArg(4)); assert.sameValue(Atomics.store(view, 0, 1), 1, 'Atomics.store(view, 0, 1) returns 1'); assert.sameValue(Atomics.load(view, 0), 1, 'Atomics.load(view, 0) returns 1'); -}, null, ["passthrough"]); +}, ["arraybuffer"], ["immutable"]); diff --git a/third_party/test262/test/built-ins/Atomics/store/non-shared-int-views-throws.js b/third_party/test262/test/built-ins/Atomics/store/non-shared-int-views-throws.js index 57f0943c6d32c2..a38b97af59289a 100644 --- a/third_party/test262/test/built-ins/Atomics/store/non-shared-int-views-throws.js +++ b/third_party/test262/test/built-ins/Atomics/store/non-shared-int-views-throws.js @@ -4,15 +4,15 @@ /*--- esid: sec-atomics.store description: > - Atomics.store throws when operating on non-sharable integer TypedArrays + Atomics.store throws when operating on incompatible TypedArrays includes: [testTypedArray.js] features: [ArrayBuffer, Atomics, TypedArray] ---*/ -testWithNonAtomicsFriendlyTypedArrayConstructors(TA => { - const buffer = new ArrayBuffer(TA.BYTES_PER_ELEMENT * 4); +testWithNonAtomicsFriendlyTypedArrayConstructors((TA, makeCtorArg) => { + const buffer = makeCtorArg(4); const view = new TA(buffer); assert.throws(TypeError, function() { Atomics.store(view, 0, 1); }, `Atomics.store(new ${TA.name}(buffer), 0, 1) throws TypeError`); -}, null, ["passthrough"]); +}, ["arraybuffer"]); diff --git a/third_party/test262/test/built-ins/Atomics/sub/bad-range.js b/third_party/test262/test/built-ins/Atomics/sub/bad-range.js index 15eabc048a1f3b..a3e6e17f9e80d8 100644 --- a/third_party/test262/test/built-ins/Atomics/sub/bad-range.js +++ b/third_party/test262/test/built-ins/Atomics/sub/bad-range.js @@ -19,4 +19,4 @@ testWithTypedArrayConstructors(function(TA) { Atomics.sub(view, IdxGen(view), 10); }); }); -}, views); +}, views, ["passthrough"]); diff --git a/third_party/test262/test/built-ins/Atomics/sub/bigint/non-shared-bufferdata.js b/third_party/test262/test/built-ins/Atomics/sub/bigint/non-shared-bufferdata.js index b07b6931dba1c0..7fffa5fd179180 100644 --- a/third_party/test262/test/built-ins/Atomics/sub/bigint/non-shared-bufferdata.js +++ b/third_party/test262/test/built-ins/Atomics/sub/bigint/non-shared-bufferdata.js @@ -7,10 +7,10 @@ description: > includes: [testTypedArray.js] features: [ArrayBuffer, Atomics, BigInt, TypedArray] ---*/ -testWithBigIntTypedArrayConstructors(TA => { - const buffer = new ArrayBuffer(TA.BYTES_PER_ELEMENT * 4); +testWithBigIntTypedArrayConstructors((TA, makeCtorArg) => { + const buffer = makeCtorArg(4); const view = new TA(buffer); assert.sameValue(Atomics.store(view, 0, 1n), 1n, 'Atomics.store(view, 0, 1n) returns 1n'); assert.sameValue(Atomics.sub(view, 0, 1n), 1n, 'Atomics.sub(view, 0, 1n) returns 1n'); assert.sameValue(Atomics.load(view, 0), 0n, 'Atomics.load(view, 0) returns 0n'); -}, null, ["passthrough"]); +}, null, ["arraybuffer"], ["immutable"]); diff --git a/third_party/test262/test/built-ins/Atomics/sub/good-views.js b/third_party/test262/test/built-ins/Atomics/sub/good-views.js index a13b7d15e8e4e3..5a5b03baad8b83 100644 --- a/third_party/test262/test/built-ins/Atomics/sub/good-views.js +++ b/third_party/test262/test/built-ins/Atomics/sub/good-views.js @@ -51,4 +51,4 @@ testWithTypedArrayConstructors(function(TA) { Atomics.store(view, Idx, 37); assert.sameValue(Atomics.sub(view, Idx, 0), 37, 'Atomics.sub(view, Idx, 0) returns 37'); }); -}, views); +}, views, ["passthrough"]); diff --git a/third_party/test262/test/built-ins/Atomics/sub/immutable-buffer.js b/third_party/test262/test/built-ins/Atomics/sub/immutable-buffer.js new file mode 100644 index 00000000000000..f3c7d83e33e08c --- /dev/null +++ b/third_party/test262/test/built-ins/Atomics/sub/immutable-buffer.js @@ -0,0 +1,52 @@ +// Copyright (C) 2025 Richard Gibson. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-atomics.sub +description: > + Throws a TypeError exception when the backing buffer is immutable +info: | + Atomics.sub ( typedArray, index, value ) + 1. Let subtract be a new read-modify-write modification function... + 2. Return ? AtomicReadModifyWrite(typedArray, index, value, subtract). + + AtomicReadModifyWrite ( typedArray, index, value, op ) + 1. Let byteIndexInBuffer be ?ย ValidateAtomicAccessOnIntegerTypedArray(typedArray, index, false, ~write~). + + ValidateAtomicAccessOnIntegerTypedArray ( typedArray, requestIndex [ , waitable [ , accessMode ] ] ) + 1. If waitable is not present, set waitable to false. + 2. If accessMode is not present, set accessMode to ~read~. + 3. Let taRecord be ? ValidateIntegerTypedArray(typedArray, waitable, accessMode). + + ValidateIntegerTypedArray ( typedArray, waitable [ , accessMode ] ) + 1. If accessMode is not present, set accessMode to ~read~. + 2. Let taRecord be ? ValidateTypedArray(typedArray, unordered, accessMode). + + ValidateTypedArray ( O, order [ , accessMode ] ) + ... + 4. If accessMode is ~write~ and IsImmutableBuffer(O.[[ViewedArrayBuffer]]) is true, throw a TypeError exception. +features: [Atomics, immutable-arraybuffer] +includes: [compareArray.js, testTypedArray.js] +---*/ + +testWithAllTypedArrayConstructors(function(TA, makeCtorArg) { + var calls = []; + var index = { + valueOf() { + calls.push("index.valueOf"); + return 0; + } + }; + var value = { + valueOf() { + calls.push("value.valueOf"); + return 1; + } + }; + + var ta = new TA(makeCtorArg(8)); + assert.throws(TypeError, function() { + Atomics.sub(ta, index, value); + }); + assert.compareArray(calls, []); +}, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/Atomics/sub/non-shared-bufferdata.js b/third_party/test262/test/built-ins/Atomics/sub/non-shared-bufferdata.js index db536ccddceb44..40c91a2cd70e25 100644 --- a/third_party/test262/test/built-ins/Atomics/sub/non-shared-bufferdata.js +++ b/third_party/test262/test/built-ins/Atomics/sub/non-shared-bufferdata.js @@ -8,12 +8,10 @@ description: > includes: [testTypedArray.js] features: [ArrayBuffer, Atomics, TypedArray] ---*/ -testWithAtomicsFriendlyTypedArrayConstructors(TA => { - const view = new TA( - new ArrayBuffer(TA.BYTES_PER_ELEMENT * 4) - ); +testWithAtomicsFriendlyTypedArrayConstructors((TA, makeCtorArg) => { + const view = new TA(makeCtorArg(4)); assert.sameValue(Atomics.store(view, 0, 1), 1, 'Atomics.store(view, 0, 1) returns 1'); assert.sameValue(Atomics.sub(view, 0, 1), 1, 'Atomics.sub(view, 0, 1) returns 1'); assert.sameValue(Atomics.load(view, 0), 0, 'Atomics.load(view, 0) returns 0'); -}, null, ["passthrough"]); +}, ["arraybuffer"], ["immutable"]); diff --git a/third_party/test262/test/built-ins/Atomics/sub/non-shared-int-views-throws.js b/third_party/test262/test/built-ins/Atomics/sub/non-shared-int-views-throws.js index 091b2ef9f3b84b..b055bf714acf79 100644 --- a/third_party/test262/test/built-ins/Atomics/sub/non-shared-int-views-throws.js +++ b/third_party/test262/test/built-ins/Atomics/sub/non-shared-int-views-throws.js @@ -4,15 +4,15 @@ /*--- esid: sec-atomics.sub description: > - Atomics.sub throws when operating on non-sharable integer TypedArrays + Atomics.sub throws when operating on incompatible TypedArrays includes: [testTypedArray.js] features: [ArrayBuffer, Atomics, TypedArray] ---*/ -testWithNonAtomicsFriendlyTypedArrayConstructors(TA => { - const buffer = new ArrayBuffer(16); +testWithNonAtomicsFriendlyTypedArrayConstructors((TA, makeCtorArg) => { + const buffer = makeCtorArg(4); const view = new TA(buffer); assert.throws(TypeError, function() { Atomics.sub(view, 0, 1); }, `Atomics.sub(new ${TA.name}(buffer), 0, 1) throws TypeError`); -}, null, ["passthrough"]); +}, ["arraybuffer"]); diff --git a/third_party/test262/test/built-ins/Atomics/xor/bad-range.js b/third_party/test262/test/built-ins/Atomics/xor/bad-range.js index 0de01cbd9cd860..d1e7aa5e9b79cb 100644 --- a/third_party/test262/test/built-ins/Atomics/xor/bad-range.js +++ b/third_party/test262/test/built-ins/Atomics/xor/bad-range.js @@ -19,4 +19,4 @@ testWithTypedArrayConstructors(function(TA) { Atomics.xor(view, IdxGen(view), 0); }); }); -}, views); +}, views, ["passthrough"]); diff --git a/third_party/test262/test/built-ins/Atomics/xor/bigint/non-shared-bufferdata.js b/third_party/test262/test/built-ins/Atomics/xor/bigint/non-shared-bufferdata.js index d68d56cac6ac6a..74b768bc9b8843 100644 --- a/third_party/test262/test/built-ins/Atomics/xor/bigint/non-shared-bufferdata.js +++ b/third_party/test262/test/built-ins/Atomics/xor/bigint/non-shared-bufferdata.js @@ -7,9 +7,9 @@ description: > includes: [testTypedArray.js] features: [ArrayBuffer, Atomics, BigInt, TypedArray] ---*/ -testWithBigIntTypedArrayConstructors(TA => { - const buffer = new ArrayBuffer(TA.BYTES_PER_ELEMENT * 4); +testWithBigIntTypedArrayConstructors((TA, makeCtorArg) => { + const buffer = makeCtorArg(4); const view = new TA(buffer); assert.sameValue(Atomics.xor(view, 0, 1n), 0n, 'Atomics.xor(view, 0, 1n) returns 0n'); assert.sameValue(Atomics.load(view, 0), 1n, 'Atomics.load(view, 0) returns 1n'); -}, null, ["passthrough"]); +}, null, ["arraybuffer"], ["immutable"]); diff --git a/third_party/test262/test/built-ins/Atomics/xor/good-views.js b/third_party/test262/test/built-ins/Atomics/xor/good-views.js index 74198415fe5f1f..459c64e0086b7b 100644 --- a/third_party/test262/test/built-ins/Atomics/xor/good-views.js +++ b/third_party/test262/test/built-ins/Atomics/xor/good-views.js @@ -79,4 +79,4 @@ testWithTypedArrayConstructors(function(TA) { Atomics.store(view, Idx, 37); assert.sameValue(Atomics.xor(view, Idx, 0), 37, 'Atomics.xor(view, Idx, 0) returns 37'); }); -}, views); +}, views, ["passthrough"]); diff --git a/third_party/test262/test/built-ins/Atomics/xor/immutable-buffer.js b/third_party/test262/test/built-ins/Atomics/xor/immutable-buffer.js new file mode 100644 index 00000000000000..e40e51d2a7a3ab --- /dev/null +++ b/third_party/test262/test/built-ins/Atomics/xor/immutable-buffer.js @@ -0,0 +1,52 @@ +// Copyright (C) 2025 Richard Gibson. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-atomics.xor +description: > + Throws a TypeError exception when the backing buffer is immutable +info: | + Atomics.xor ( typedArray, index, value ) + 1. Let xor be a new read-modify-write modification function... + 2. Return ? AtomicReadModifyWrite(typedArray, index, value, xor). + + AtomicReadModifyWrite ( typedArray, index, value, op ) + 1. Let byteIndexInBuffer be ?ย ValidateAtomicAccessOnIntegerTypedArray(typedArray, index, false, ~write~). + + ValidateAtomicAccessOnIntegerTypedArray ( typedArray, requestIndex [ , waitable [ , accessMode ] ] ) + 1. If waitable is not present, set waitable to false. + 2. If accessMode is not present, set accessMode to ~read~. + 3. Let taRecord be ? ValidateIntegerTypedArray(typedArray, waitable, accessMode). + + ValidateIntegerTypedArray ( typedArray, waitable [ , accessMode ] ) + 1. If accessMode is not present, set accessMode to ~read~. + 2. Let taRecord be ? ValidateTypedArray(typedArray, unordered, accessMode). + + ValidateTypedArray ( O, order [ , accessMode ] ) + ... + 4. If accessMode is ~write~ and IsImmutableBuffer(O.[[ViewedArrayBuffer]]) is true, throw a TypeError exception. +features: [Atomics, immutable-arraybuffer] +includes: [compareArray.js, testTypedArray.js] +---*/ + +testWithAllTypedArrayConstructors(function(TA, makeCtorArg) { + var calls = []; + var index = { + valueOf() { + calls.push("index.valueOf"); + return 0; + } + }; + var value = { + valueOf() { + calls.push("value.valueOf"); + return 1; + } + }; + + var ta = new TA(makeCtorArg(8)); + assert.throws(TypeError, function() { + Atomics.xor(ta, index, value); + }); + assert.compareArray(calls, []); +}, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/Atomics/xor/non-shared-bufferdata.js b/third_party/test262/test/built-ins/Atomics/xor/non-shared-bufferdata.js index 7f2fe1ae2646d7..ca5e3bb73156fe 100644 --- a/third_party/test262/test/built-ins/Atomics/xor/non-shared-bufferdata.js +++ b/third_party/test262/test/built-ins/Atomics/xor/non-shared-bufferdata.js @@ -8,11 +8,9 @@ description: > includes: [testTypedArray.js] features: [ArrayBuffer, Atomics, TypedArray] ---*/ -testWithAtomicsFriendlyTypedArrayConstructors(TA => { - const view = new TA( - new ArrayBuffer(TA.BYTES_PER_ELEMENT * 4) - ); +testWithAtomicsFriendlyTypedArrayConstructors((TA, makeCtorArg) => { + const view = new TA(makeCtorArg(4)); assert.sameValue(Atomics.xor(view, 0, 1), 0, 'Atomics.xor(view, 0, 1) returns 0'); assert.sameValue(Atomics.load(view, 0), 1, 'Atomics.load(view, 0) returns 1'); -}, null, ["passthrough"]); +}, ["arraybuffer"], ["immutable"]); diff --git a/third_party/test262/test/built-ins/Atomics/xor/non-shared-int-views-throws.js b/third_party/test262/test/built-ins/Atomics/xor/non-shared-int-views-throws.js index 84dab376692b8a..6014382047dc2c 100644 --- a/third_party/test262/test/built-ins/Atomics/xor/non-shared-int-views-throws.js +++ b/third_party/test262/test/built-ins/Atomics/xor/non-shared-int-views-throws.js @@ -4,15 +4,15 @@ /*--- esid: sec-atomics.xor description: > - Atomics.xor throws when operating on non-sharable integer TypedArrays + Atomics.xor throws when operating on incompatible TypedArrays includes: [testTypedArray.js] features: [ArrayBuffer, Atomics, TypedArray] ---*/ -testWithNonAtomicsFriendlyTypedArrayConstructors(TA => { - const buffer = new ArrayBuffer(TA.BYTES_PER_ELEMENT * 4); +testWithNonAtomicsFriendlyTypedArrayConstructors((TA, makeCtorArg) => { + const buffer = makeCtorArg(4); const view = new TA(buffer); assert.throws(TypeError, function() { Atomics.xor(view, 0, 1); }, `Atomics.xor(new ${TA.name}(buffer), 0, 1) throws TypeError`); -}, null, ["passthrough"]); +}, ["arraybuffer"]); diff --git a/third_party/test262/test/built-ins/Number/MAX_VALUE/value.js b/third_party/test262/test/built-ins/Number/MAX_VALUE/value.js new file mode 100644 index 00000000000000..82f46335d7bea0 --- /dev/null +++ b/third_party/test262/test/built-ins/Number/MAX_VALUE/value.js @@ -0,0 +1,19 @@ +// Copyright (C) 2026 Luna Pfeiffer. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-number.max_value +description: > + Number.MAX_VALUE is approximately 1.7976931348623157 ร— 10ยณโฐโธ + +---*/ + + +assert.sameValue(typeof Number.MAX_VALUE, "number", "Number.MAX_VALUE should be a number"); +assert(Number.MAX_VALUE > 0, "Number.MAX_VALUE must be positive"); + +assert(Number.MAX_VALUE > Number.MAX_SAFE_INTEGER, "Number.MAX_VALUE should be larger than Number.MAX_SAFE_INTEGER"); +assert(Number.MAX_VALUE < Infinity, "Number.MAX_VALUE should be less than Infinity"); + +assert.sameValue(Number.MAX_VALUE * 2, Infinity, "Number.MAX_VALUE multiplied by 2 should be Infinity"); +assert.sameValue(Number.MAX_VALUE, 1.7976931348623157e+308, "Number.MAX_VALUE should be approximately 1.7976931348623157e+308"); diff --git a/third_party/test262/test/built-ins/Number/MIN_VALUE/value.js b/third_party/test262/test/built-ins/Number/MIN_VALUE/value.js new file mode 100644 index 00000000000000..33b0baae4a0142 --- /dev/null +++ b/third_party/test262/test/built-ins/Number/MIN_VALUE/value.js @@ -0,0 +1,20 @@ +// Copyright (C) 2026 Luna Pfeiffer. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-number.min_value +description: > + Number.MIN_VALUE is approximately 5e-324. We can't directly compare it as the spec states: + + In the IEEE 754-2019 double precision binary representation, the smallest possible value is a denormalized number. + If an implementation does not support denormalized values, the value of Number.MIN_VALUE must be the smallest + non-zero positive value that can actually be represented by the implementation. +---*/ + + +assert.sameValue(typeof Number.MIN_VALUE, "number", "Number.MIN_VALUE should be a number"); +assert(Number.MIN_VALUE > 0, "Number.MIN_VALUE must be positive"); + +assert(Number.MIN_VALUE < Number.EPSILON, "Number.MIN_VALUE should be smaller than Number.EPSILON") + +assert.sameValue(Number.MIN_VALUE / 2, 0, "Number.MIN_VALUE divided by 2 should underflow to 0"); diff --git a/third_party/test262/test/built-ins/Temporal/Duration/prototype/round/relativeto-plaindate-large-time-component-out-of-range.js b/third_party/test262/test/built-ins/Temporal/Duration/prototype/round/relativeto-plaindate-large-time-component-out-of-range.js new file mode 100644 index 00000000000000..8c73d1d67b4ed3 --- /dev/null +++ b/third_party/test262/test/built-ins/Temporal/Duration/prototype/round/relativeto-plaindate-large-time-component-out-of-range.js @@ -0,0 +1,22 @@ +// Copyright (C) 2026 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.duration.prototype.round +description: > + Duration with an overly large time component rounded to a calendar unit + relative to a PlainDate +info: | + 28.d. Let _dateDuration_ be ? AdjustDateDurationRecord( + _internalDuration_.[[Date]], _targetTime_.[[Days]]). +features: [Temporal] +---*/ + +const relativeTo = new Temporal.PlainDate(2020, 1, 1); + +[Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER].forEach((seconds) => { + const d = new Temporal.Duration(0, 0, 0, 0, 0, 0, seconds); + assert.throws(RangeError, () => d.round({ smallestUnit: "year", relativeTo })); + assert.throws(RangeError, () => d.round({ smallestUnit: "month", relativeTo })); + assert.throws(RangeError, () => d.round({ smallestUnit: "week", relativeTo })); +}); diff --git a/third_party/test262/test/built-ins/Temporal/Duration/prototype/round/relativeto-zoneddatetime-large-time-component-out-of-range.js b/third_party/test262/test/built-ins/Temporal/Duration/prototype/round/relativeto-zoneddatetime-large-time-component-out-of-range.js new file mode 100644 index 00000000000000..52fee7c3456f7e --- /dev/null +++ b/third_party/test262/test/built-ins/Temporal/Duration/prototype/round/relativeto-zoneddatetime-large-time-component-out-of-range.js @@ -0,0 +1,22 @@ +// Copyright (C) 2026 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.duration.prototype.round +description: > + Duration with an overly large time component rounded to a calendar unit + relative to a ZonedDateTime +info: | + 27.e. Let _targetEpochNs_ be ? AddZonedDateTime(_relativeEpochNs_, _timeZone_, + _calendar_, _internalDuration_, ~constrain~). +features: [Temporal] +---*/ + +const relativeTo = new Temporal.ZonedDateTime(0n, "UTC"); + +[Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER].forEach((seconds) => { + const d = new Temporal.Duration(0, 0, 0, 0, 0, 0, seconds); + assert.throws(RangeError, () => d.round({ smallestUnit: "year", relativeTo })); + assert.throws(RangeError, () => d.round({ smallestUnit: "month", relativeTo })); + assert.throws(RangeError, () => d.round({ smallestUnit: "week", relativeTo })); +}); diff --git a/third_party/test262/test/built-ins/Temporal/Duration/prototype/round/rounding-increment-relativeto.js b/third_party/test262/test/built-ins/Temporal/Duration/prototype/round/rounding-increment-relativeto.js index 762be1f1d5bba1..1e66b492d05f40 100644 --- a/third_party/test262/test/built-ins/Temporal/Duration/prototype/round/rounding-increment-relativeto.js +++ b/third_party/test262/test/built-ins/Temporal/Duration/prototype/round/rounding-increment-relativeto.js @@ -39,8 +39,3 @@ TemporalHelpers.assertDuration(new Temporal.Duration(0, 1, 0, 30).round({ roundingIncrement: 2, relativeTo: new Temporal.PlainDate(1970, 7, 31) }), 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, `1m30d to 2m with relativeTo 1970-07-31`); -TemporalHelpers.assertDuration(new Temporal.Duration(0, 1, 0, 30).round({ - smallestUnit: "months", - roundingIncrement: 2, - relativeTo: Temporal.ZonedDateTime.from('2025-03-09T03:00:00-07:00[America/Vancouver]') -}), 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, `1m30d to 2m with relativeTo 2025-03-09T03:00:00-07:00[America/Vancouver]`); diff --git a/third_party/test262/test/built-ins/Temporal/Duration/prototype/total/relativeto-plaindate-large-time-component-out-of-range.js b/third_party/test262/test/built-ins/Temporal/Duration/prototype/total/relativeto-plaindate-large-time-component-out-of-range.js new file mode 100644 index 00000000000000..220eec68218f8c --- /dev/null +++ b/third_party/test262/test/built-ins/Temporal/Duration/prototype/total/relativeto-plaindate-large-time-component-out-of-range.js @@ -0,0 +1,22 @@ +// Copyright (C) 2026 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.duration.prototype.total +description: > + Duration with an overly large time component total of a calendar unit relative + to a PlainDate +info: | + 13.d. Let _dateDuration_ be ? AdjustDateDurationRecord( + _internalDuration_.[[Date]], _targetTime_.[[Days]]). +features: [Temporal] +---*/ + +const relativeTo = new Temporal.PlainDate(2020, 1, 1); + +[Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER].forEach((seconds) => { + const d = new Temporal.Duration(0, 0, 0, 0, 0, 0, seconds); + assert.throws(RangeError, () => d.total({ unit: "year", relativeTo })); + assert.throws(RangeError, () => d.total({ unit: "month", relativeTo })); + assert.throws(RangeError, () => d.total({ unit: "week", relativeTo })); +}); diff --git a/third_party/test262/test/built-ins/Temporal/Duration/prototype/total/relativeto-zoneddatetime-large-time-component-out-of-range.js b/third_party/test262/test/built-ins/Temporal/Duration/prototype/total/relativeto-zoneddatetime-large-time-component-out-of-range.js new file mode 100644 index 00000000000000..0457eaf86b8838 --- /dev/null +++ b/third_party/test262/test/built-ins/Temporal/Duration/prototype/total/relativeto-zoneddatetime-large-time-component-out-of-range.js @@ -0,0 +1,22 @@ +// Copyright (C) 2026 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.duration.prototype.total +description: > + Duration with an overly large time component total of a calendar unit relative + to a ZonedDateTime +info: | + 12.e. Let _targetEpochNs_ be ? AddZonedDateTime(_relativeEpochNs_, _timeZone_, + _calendar_, _internalDuration_, ~constrain~). +features: [Temporal] +---*/ + +const relativeTo = new Temporal.ZonedDateTime(0n, "UTC"); + +[Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER].forEach((seconds) => { + const d = new Temporal.Duration(0, 0, 0, 0, 0, 0, seconds); + assert.throws(RangeError, () => d.total({ unit: "year", relativeTo })); + assert.throws(RangeError, () => d.total({ unit: "month", relativeTo })); + assert.throws(RangeError, () => d.total({ unit: "week", relativeTo })); +}); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/BigInt/coerced-values-end.js b/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/BigInt/coerced-values-end.js index 98b60e2bbaf3a0..50ff90fc4b3d97 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/BigInt/coerced-values-end.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/BigInt/coerced-values-end.js @@ -74,4 +74,4 @@ testWithBigIntTypedArrayConstructors(function(TA, makeCtorArg) { ), 'float -2.5 value coerced to integer -2' ); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/BigInt/coerced-values-start.js b/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/BigInt/coerced-values-start.js index 82ca98590c7bd1..4a7c6cbcba6b57 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/BigInt/coerced-values-start.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/BigInt/coerced-values-start.js @@ -89,4 +89,4 @@ testWithBigIntTypedArrayConstructors(function(TA, makeCtorArg) { ), '1.5 float value coerced to integer 1' ); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/BigInt/coerced-values-target.js b/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/BigInt/coerced-values-target.js index 39fe0dd7c979f3..4551963f7f9f6f 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/BigInt/coerced-values-target.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/BigInt/coerced-values-target.js @@ -89,4 +89,4 @@ testWithBigIntTypedArrayConstructors(function(TA, makeCtorArg) { ), '1.5 float value coerced to integer 1' ); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-end.js b/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-end.js index b14d4bdac37294..a00b5a4c1bd9ce 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-end.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-end.js @@ -92,4 +92,4 @@ testWithBigIntTypedArrayConstructors(function(TA, makeCtorArg) { ), '[0, 1, 2, 3, 4].copyWithin(-5, -2, -1) -> [3, 1, 2, 3, 4]' ); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-out-of-bounds-end.js b/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-out-of-bounds-end.js index 92eb58d0a9036b..4877a16671f254 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-out-of-bounds-end.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-out-of-bounds-end.js @@ -108,4 +108,4 @@ testWithBigIntTypedArrayConstructors(function(TA, makeCtorArg) { ), '[1, 2, 3, 4, 5].copyWithin(-7, -8, -Infinity) -> [1, 2, 3, 4, 5]' ); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-out-of-bounds-start.js b/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-out-of-bounds-start.js index 71927d17ab44c7..cbfc985e94a3ec 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-out-of-bounds-start.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-out-of-bounds-start.js @@ -90,4 +90,4 @@ testWithBigIntTypedArrayConstructors(function(TA, makeCtorArg) { ), '[1, 2, 3, 4, 5].copyWithin(-9, -Infinity) -> [1, 2, 3, 4, 5]' ); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-out-of-bounds-target.js b/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-out-of-bounds-target.js index 3b0a18701b47b6..2f1ca8b608a55f 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-out-of-bounds-target.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-out-of-bounds-target.js @@ -58,4 +58,4 @@ testWithBigIntTypedArrayConstructors(function(TA, makeCtorArg) { ), '[1, 2, 3, 4, 5].copyWithin(-Infinity, 2) -> [3, 4, 5, 4, 5]' ); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-start.js b/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-start.js index b55690204f12e6..8ceb36225dcb70 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-start.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-start.js @@ -74,4 +74,4 @@ testWithBigIntTypedArrayConstructors(function(TA, makeCtorArg) { ), '[0, 1, 2, 3, 4].copyWithin(-5, -2) -> [3, 4, 2, 3, 4]' ); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-target.js b/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-target.js index 8f73e7150e9e5d..defdb9f9c22850 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-target.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-target.js @@ -50,4 +50,4 @@ testWithBigIntTypedArrayConstructors(function(TA, makeCtorArg) { ), '[0, 1, 2, 3].copyWithin(-1, 2) -> [0, 1, 2, 2]' ); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-out-of-bounds-end.js b/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-out-of-bounds-end.js index cb2123459ef710..5de4974df747f6 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-out-of-bounds-end.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-out-of-bounds-end.js @@ -51,4 +51,4 @@ testWithBigIntTypedArrayConstructors(function(TA, makeCtorArg) { ), '[1, 2, 3, 4, 5].copyWithin(1, 3, Infinity) -> [1, 4, 5, 4, 5]' ); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-out-of-bounds-target-and-start.js b/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-out-of-bounds-target-and-start.js index 8be6d08fc4e1b7..32a7d4b2b4a5d5 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-out-of-bounds-target-and-start.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-out-of-bounds-target-and-start.js @@ -71,4 +71,4 @@ testWithBigIntTypedArrayConstructors(function(TA, makeCtorArg) { ), '[1, 2, 3, 4, 5].copyWithin(Infinity, Infinity) -> [1, 2, 3, 4, 5]' ); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-target-and-start.js b/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-target-and-start.js index 6adbdf917b6067..3b36bb3e42df29 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-target-and-start.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-target-and-start.js @@ -47,4 +47,4 @@ testWithBigIntTypedArrayConstructors(function(TA, makeCtorArg) { [0n, 4n, 5n, 3n, 4n, 5n] ) ); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-target-start-and-end.js b/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-target-start-and-end.js index 0e6295b36ddc41..9605fee5a0509e 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-target-start-and-end.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-target-start-and-end.js @@ -70,4 +70,4 @@ testWithBigIntTypedArrayConstructors(function(TA, makeCtorArg) { ), '[0, 1, 2, 3, 4, 5].copyWithin(1, 3, 5) -> [0, 3, 4, 3, 4, 5]' ); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-this.js b/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-this.js index 27f15a3d6f6cf7..5a3155113c38d2 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-this.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-this.js @@ -33,4 +33,4 @@ testWithBigIntTypedArrayConstructors(function(TA, makeCtorArg) { var result2 = sample2.copyWithin(1, 0); assert.sameValue(result2, sample2); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/BigInt/undefined-end.js b/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/BigInt/undefined-end.js index f1b67f7a474f99..ed9199a9503525 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/BigInt/undefined-end.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/BigInt/undefined-end.js @@ -42,4 +42,4 @@ testWithBigIntTypedArrayConstructors(function(TA, makeCtorArg) { ), '[0, 1, 2, 3].copyWithin(0, 1) -> [1, 2, 3, 3]' ); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/byteoffset.js b/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/byteoffset.js index 01555b72c9bd11..8bb96b6fc30681 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/byteoffset.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/byteoffset.js @@ -30,4 +30,4 @@ testWithTypedArrayConstructors(function(TA, makeCtorArg) { [0, 1, 2, 1], 'underlying arraybuffer should have been updated' ); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/coerced-values-end.js b/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/coerced-values-end.js index a542be2bb70319..a8c2157f50e248 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/coerced-values-end.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/coerced-values-end.js @@ -74,4 +74,4 @@ testWithTypedArrayConstructors(function(TA, makeCtorArg) { ), 'float -2.5 value coerced to integer -2' ); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/coerced-values-start.js b/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/coerced-values-start.js index 72e5bc406a1cd6..92aa33c9cd155f 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/coerced-values-start.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/coerced-values-start.js @@ -89,4 +89,4 @@ testWithTypedArrayConstructors(function(TA, makeCtorArg) { ), '1.5 float value coerced to integer 1' ); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/coerced-values-target.js b/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/coerced-values-target.js index 9adfd9cd10625e..8e3239903f9576 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/coerced-values-target.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/coerced-values-target.js @@ -97,4 +97,4 @@ testWithTypedArrayConstructors(function(TA, makeCtorArg) { ), 'object value coerced to integer 0' ); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/negative-end.js b/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/negative-end.js index 1f8c6d083f88fe..3d18750139ed27 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/negative-end.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/negative-end.js @@ -92,4 +92,4 @@ testWithTypedArrayConstructors(function(TA, makeCtorArg) { ), '[0, 1, 2, 3, 4].copyWithin(-5, -2, -1) -> [3, 1, 2, 3, 4]' ); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/negative-out-of-bounds-end.js b/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/negative-out-of-bounds-end.js index c8687b85d4c37e..24e6955e39dc94 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/negative-out-of-bounds-end.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/negative-out-of-bounds-end.js @@ -108,4 +108,4 @@ testWithTypedArrayConstructors(function(TA, makeCtorArg) { ), '[1, 2, 3, 4, 5].copyWithin(-7, -8, -Infinity) -> [1, 2, 3, 4, 5]' ); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/negative-out-of-bounds-start.js b/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/negative-out-of-bounds-start.js index 3826ed37a2da2d..5ef955bd0a902b 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/negative-out-of-bounds-start.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/negative-out-of-bounds-start.js @@ -90,4 +90,4 @@ testWithTypedArrayConstructors(function(TA, makeCtorArg) { ), '[1, 2, 3, 4, 5].copyWithin(-9, -Infinity) -> [1, 2, 3, 4, 5]' ); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/negative-out-of-bounds-target.js b/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/negative-out-of-bounds-target.js index 56e28367f83ccc..34690c59db03e3 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/negative-out-of-bounds-target.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/negative-out-of-bounds-target.js @@ -58,4 +58,4 @@ testWithTypedArrayConstructors(function(TA, makeCtorArg) { ), '[1, 2, 3, 4, 5].copyWithin(-Infinity, 2) -> [3, 4, 5, 4, 5]' ); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/negative-start.js b/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/negative-start.js index 70b305349e11e0..eacbcd9687b7fc 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/negative-start.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/negative-start.js @@ -74,4 +74,4 @@ testWithTypedArrayConstructors(function(TA, makeCtorArg) { ), '[0, 1, 2, 3, 4].copyWithin(-5, -2) -> [3, 4, 2, 3, 4]' ); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/negative-target.js b/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/negative-target.js index f5a90997958666..a3e12b60a3bffd 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/negative-target.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/negative-target.js @@ -50,4 +50,4 @@ testWithTypedArrayConstructors(function(TA, makeCtorArg) { ), '[0, 1, 2, 3].copyWithin(-1, 2) -> [0, 1, 2, 2]' ); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/non-negative-out-of-bounds-end.js b/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/non-negative-out-of-bounds-end.js index 23df3ef812a055..0cd078665efe1b 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/non-negative-out-of-bounds-end.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/non-negative-out-of-bounds-end.js @@ -51,4 +51,4 @@ testWithTypedArrayConstructors(function(TA, makeCtorArg) { ), '[1, 2, 3, 4, 5].copyWithin(1, 3, Infinity) -> [1, 4, 5, 4, 5]' ); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/non-negative-out-of-bounds-target-and-start.js b/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/non-negative-out-of-bounds-target-and-start.js index 6956d288b47ab5..1ef8740a1ac618 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/non-negative-out-of-bounds-target-and-start.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/non-negative-out-of-bounds-target-and-start.js @@ -71,4 +71,4 @@ testWithTypedArrayConstructors(function(TA, makeCtorArg) { ), '[1, 2, 3, 4, 5].copyWithin(Infinity, Infinity) -> [1, 2, 3, 4, 5]' ); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/non-negative-target-and-start.js b/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/non-negative-target-and-start.js index 72c6badc2aa59f..db6cc87defbc4b 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/non-negative-target-and-start.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/non-negative-target-and-start.js @@ -47,4 +47,4 @@ testWithTypedArrayConstructors(function(TA, makeCtorArg) { [0, 4, 5, 3, 4, 5] ) ); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/non-negative-target-start-and-end.js b/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/non-negative-target-start-and-end.js index 9e37ecba37df10..c81708208e7776 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/non-negative-target-start-and-end.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/non-negative-target-start-and-end.js @@ -70,4 +70,4 @@ testWithTypedArrayConstructors(function(TA, makeCtorArg) { ), '[0, 1, 2, 3, 4, 5].copyWithin(1, 3, 5) -> [0, 3, 4, 3, 4, 5]' ); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/return-this.js b/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/return-this.js index 68bd240e212720..42eb83172a561c 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/return-this.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/return-this.js @@ -33,4 +33,4 @@ testWithTypedArrayConstructors(function(TA, makeCtorArg) { var result2 = sample2.copyWithin(1, 0); assert.sameValue(result2, sample2); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/undefined-end.js b/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/undefined-end.js index add95fbbaa729c..0c491bf2c6544d 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/undefined-end.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/copyWithin/undefined-end.js @@ -42,4 +42,4 @@ testWithTypedArrayConstructors(function(TA, makeCtorArg) { ), '[0, 1, 2, 3].copyWithin(0, 1) -> [1, 2, 3, 3]' ); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-set-value-during-interaction.js b/third_party/test262/test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-set-value-during-interaction.js index d9b3ba0e914bcd..86e6ca013d5de7 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-set-value-during-interaction.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-set-value-during-interaction.js @@ -55,4 +55,4 @@ testWithBigIntTypedArrayConstructors(function(TA, makeCtorArg) { assert.sameValue(sample[0], 7n, "changed values after iteration [0] == 7"); assert.sameValue(sample[1], 1n, "changed values after iteration [1] == 1"); assert.sameValue(sample[2], 2n, "changed values after iteration [2] == 2"); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/every/BigInt/values-are-not-cached.js b/third_party/test262/test/built-ins/TypedArray/prototype/every/BigInt/values-are-not-cached.js index a397c4708765a7..0431e4febd04a3 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/every/BigInt/values-are-not-cached.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/every/BigInt/values-are-not-cached.js @@ -39,4 +39,4 @@ testWithBigIntTypedArrayConstructors(function(TA, makeCtorArg) { ); return true; }); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/every/callbackfn-set-value-during-interaction.js b/third_party/test262/test/built-ins/TypedArray/prototype/every/callbackfn-set-value-during-interaction.js index 235f03353ed185..5d3e01448e5072 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/every/callbackfn-set-value-during-interaction.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/every/callbackfn-set-value-during-interaction.js @@ -55,4 +55,4 @@ testWithTypedArrayConstructors(function(TA, makeCtorArg) { assert.sameValue(sample[0], 7, "changed values after iteration [0] == 7"); assert.sameValue(sample[1], 1, "changed values after iteration [1] == 1"); assert.sameValue(sample[2], 2, "changed values after iteration [2] == 2"); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/every/values-are-not-cached.js b/third_party/test262/test/built-ins/TypedArray/prototype/every/values-are-not-cached.js index f9f9e06901707d..f61fc01acf5e06 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/every/values-are-not-cached.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/every/values-are-not-cached.js @@ -39,4 +39,4 @@ testWithTypedArrayConstructors(function(TA, makeCtorArg) { ); return true; }); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/fill/BigInt/coerced-indexes.js b/third_party/test262/test/built-ins/TypedArray/prototype/fill/BigInt/coerced-indexes.js index 4f3cded462108c..e6e797f4808126 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/fill/BigInt/coerced-indexes.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/fill/BigInt/coerced-indexes.js @@ -101,4 +101,4 @@ testWithBigIntTypedArrayConstructors(function(TA, makeCtorArg) { compareArray(new TA(makeCtorArg([0n, 0n])).fill(1n, 0, 1.5), [1n, 0n]), 'end as a float number coerced' ); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-conversion-once.js b/third_party/test262/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-conversion-once.js index ce5853f52d8efb..4f3647f9a6b204 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-conversion-once.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-conversion-once.js @@ -24,5 +24,5 @@ testWithBigIntTypedArrayConstructors(function(TA, makeCtorArg) { assert.sameValue(n, 2n, "additional unexpected ToBigInt() calls"); assert.sameValue(sample[0], 1n, "incorrect ToNumber result in index 0"); assert.sameValue(sample[1], 1n, "incorrect ToNumber result in index 1"); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-custom-start-and-end.js b/third_party/test262/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-custom-start-and-end.js index 4d82b802be1082..78cbcf8e3bcdef 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-custom-start-and-end.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-custom-start-and-end.js @@ -39,4 +39,4 @@ testWithBigIntTypedArrayConstructors(function(TA, makeCtorArg) { assert(compareArray(new TA(makeCtorArg([0n, 0n, 0n, 0n, 0n])).fill(8n, -2, -1), [0n, 0n, 0n, 8n, 0n])); assert(compareArray(new TA(makeCtorArg([0n, 0n, 0n, 0n, 0n])).fill(8n, -1, -3), [0n, 0n, 0n, 0n, 0n])); assert(compareArray(new TA(makeCtorArg([0n, 0n, 0n, 0n, 0n])).fill(8n, 1, 3), [0n, 8n, 8n, 0n, 0n])); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-non-numeric-throw.js b/third_party/test262/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-non-numeric-throw.js index 34b86e4019c1a9..298117a683b8d1 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-non-numeric-throw.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-non-numeric-throw.js @@ -64,4 +64,4 @@ testWithBigIntTypedArrayConstructors(function(TA, makeCtorArg) { sample.fill("nonsense"); }, "abrupt completion from string"); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-non-numeric.js b/third_party/test262/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-non-numeric.js index 7f2be13728b973..6b7cb72ae1a9b7 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-non-numeric.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-non-numeric.js @@ -80,4 +80,4 @@ testWithBigIntTypedArrayConstructors(function(TA, makeCtorArg) { }); assert.sameValue(sample[0], 7n, "object toString when valueOf is absent"); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-relative-end.js b/third_party/test262/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-relative-end.js index 1740920d61f980..52eaf2dc7a5866 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-relative-end.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-relative-end.js @@ -50,4 +50,4 @@ testWithBigIntTypedArrayConstructors(function(TA, makeCtorArg) { compareArray(new TA(makeCtorArg([0n, 0n, 0n])).fill(8n, 0, -4), [0n, 0n, 0n]), "end position is 0 when (len + relativeEnd) < 0" ); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-relative-start.js b/third_party/test262/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-relative-start.js index 5c6101368817c0..f645d9c0caa10f 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-relative-start.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-relative-start.js @@ -48,4 +48,4 @@ testWithBigIntTypedArrayConstructors(function(TA, makeCtorArg) { compareArray(new TA(makeCtorArg([0n, 0n, 0n])).fill(8n, -5), [8n, 8n, 8n]), "start position is 0 when (len + relativeStart) < 0" ); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-symbol-throws.js b/third_party/test262/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-symbol-throws.js index 24b7bc17d1f693..988601ba2a7c38 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-symbol-throws.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-symbol-throws.js @@ -55,4 +55,4 @@ testWithBigIntTypedArrayConstructors(function(TA, makeCtorArg) { assert.throws(TypeError, function() { sample.fill(s); }); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values.js b/third_party/test262/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values.js index 4bd08ca21d585c..773a407b3113ec 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values.js @@ -41,4 +41,4 @@ testWithBigIntTypedArrayConstructors(function(TA, makeCtorArg) { compareArray(new TA(makeCtorArg([0n, 0n, 0n])).fill(8n), [8n, 8n, 8n]), "Default start and end indexes are 0 and this.length" ); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/fill/BigInt/return-abrupt-from-set-value.js b/third_party/test262/test/built-ins/TypedArray/prototype/fill/BigInt/return-abrupt-from-set-value.js index a3fc6ea35c4bdd..f3a6af18dcf699 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/fill/BigInt/return-abrupt-from-set-value.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/fill/BigInt/return-abrupt-from-set-value.js @@ -58,4 +58,4 @@ testWithBigIntTypedArrayConstructors(function(TA, makeCtorArg) { assert.throws(Test262Error, function() { sample.fill(obj); }); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/fill/BigInt/return-this.js b/third_party/test262/test/built-ins/TypedArray/prototype/fill/BigInt/return-this.js index c21609020079c2..c7225384d3164b 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/fill/BigInt/return-this.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/fill/BigInt/return-this.js @@ -17,4 +17,4 @@ testWithBigIntTypedArrayConstructors(function(TA, makeCtorArg) { var sample2 = new TA(makeCtorArg(42)); var result2 = sample2.fill(7n); assert.sameValue(result2, sample2); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/fill/coerced-indexes.js b/third_party/test262/test/built-ins/TypedArray/prototype/fill/coerced-indexes.js index 58a2b16e0112bc..c6834011dd0fdf 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/fill/coerced-indexes.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/fill/coerced-indexes.js @@ -101,4 +101,4 @@ testWithTypedArrayConstructors(function(TA, makeCtorArg) { compareArray(new TA(makeCtorArg([0, 0])).fill(1, 0, 1.5), [1, 0]), 'end as a float number coerced' ); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/fill/fill-values-conversion-once.js b/third_party/test262/test/built-ins/TypedArray/prototype/fill/fill-values-conversion-once.js index 8a3531936ee9a8..8617c5811b9a63 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/fill/fill-values-conversion-once.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/fill/fill-values-conversion-once.js @@ -23,5 +23,5 @@ testWithTypedArrayConstructors(function(TA, makeCtorArg) { assert.sameValue(n, 2, "additional unexpected ToNumber() calls"); assert.sameValue(sample[0], 1, "incorrect ToNumber result in index 0"); assert.sameValue(sample[1], 1, "incorrect ToNumber result in index 1"); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/fill/fill-values-conversion-operations-consistent-nan.js b/third_party/test262/test/built-ins/TypedArray/prototype/fill/fill-values-conversion-operations-consistent-nan.js index aeaac53e670860..2558a013da0a24 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/fill/fill-values-conversion-operations-consistent-nan.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/fill/fill-values-conversion-operations-consistent-nan.js @@ -98,4 +98,4 @@ testWithTypedArrayConstructors(function(FA, makeCtorArg) { ); } } -}, floatArrayConstructors); +}, floatArrayConstructors, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/fill/fill-values-custom-start-and-end.js b/third_party/test262/test/built-ins/TypedArray/prototype/fill/fill-values-custom-start-and-end.js index 7ee112c0d9a76c..9371e6f13f803a 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/fill/fill-values-custom-start-and-end.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/fill/fill-values-custom-start-and-end.js @@ -39,4 +39,4 @@ testWithTypedArrayConstructors(function(TA, makeCtorArg) { assert(compareArray(new TA(makeCtorArg([0, 0, 0, 0, 0])).fill(8, -2, -1), [0, 0, 0, 8, 0])); assert(compareArray(new TA(makeCtorArg([0, 0, 0, 0, 0])).fill(8, -1, -3), [0, 0, 0, 0, 0])); assert(compareArray(new TA(makeCtorArg([0, 0, 0, 0, 0])).fill(8, 1, 3), [0, 8, 8, 0, 0])); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/fill/fill-values-non-numeric.js b/third_party/test262/test/built-ins/TypedArray/prototype/fill/fill-values-non-numeric.js index cb05403e576dd5..e544c9469447a6 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/fill/fill-values-non-numeric.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/fill/fill-values-non-numeric.js @@ -84,4 +84,4 @@ testWithTypedArrayConstructors(function(TA, makeCtorArg) { } }); assert.sameValue(sample[0], 7, "object toString when valueOf is absent"); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/fill/fill-values-relative-end.js b/third_party/test262/test/built-ins/TypedArray/prototype/fill/fill-values-relative-end.js index 598715aefd73f4..f5a2e63147d1d1 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/fill/fill-values-relative-end.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/fill/fill-values-relative-end.js @@ -50,4 +50,4 @@ testWithTypedArrayConstructors(function(TA, makeCtorArg) { compareArray(new TA(makeCtorArg([0, 0, 0])).fill(8, 0, -4), [0, 0, 0]), "end position is 0 when (len + relativeEnd) < 0" ); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/fill/fill-values-relative-start.js b/third_party/test262/test/built-ins/TypedArray/prototype/fill/fill-values-relative-start.js index 0261a22d1b372b..3af094a5750808 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/fill/fill-values-relative-start.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/fill/fill-values-relative-start.js @@ -48,4 +48,4 @@ testWithTypedArrayConstructors(function(TA, makeCtorArg) { compareArray(new TA(makeCtorArg([0, 0, 0])).fill(8, -5), [8, 8, 8]), "start position is 0 when (len + relativeStart) < 0" ); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/fill/fill-values-symbol-throws.js b/third_party/test262/test/built-ins/TypedArray/prototype/fill/fill-values-symbol-throws.js index 36d041b36ba08f..a42844db792dd6 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/fill/fill-values-symbol-throws.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/fill/fill-values-symbol-throws.js @@ -55,4 +55,4 @@ testWithTypedArrayConstructors(function(TA, makeCtorArg) { assert.throws(TypeError, function() { sample.fill(s); }); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/fill/fill-values.js b/third_party/test262/test/built-ins/TypedArray/prototype/fill/fill-values.js index 63207f87c58fc8..30cedcccb28585 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/fill/fill-values.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/fill/fill-values.js @@ -41,4 +41,4 @@ testWithTypedArrayConstructors(function(TA, makeCtorArg) { compareArray(new TA(makeCtorArg([0, 0, 0])).fill(8), [8, 8, 8]), "Default start and end indexes are 0 and this.length" ); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/fill/return-abrupt-from-set-value.js b/third_party/test262/test/built-ins/TypedArray/prototype/fill/return-abrupt-from-set-value.js index 0c52c3675be74a..ca68ae49c0f527 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/fill/return-abrupt-from-set-value.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/fill/return-abrupt-from-set-value.js @@ -58,4 +58,4 @@ testWithTypedArrayConstructors(function(TA, makeCtorArg) { assert.throws(Test262Error, function() { sample.fill(obj); }); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/fill/return-this.js b/third_party/test262/test/built-ins/TypedArray/prototype/fill/return-this.js index 84859f01859b89..5f1b1603ee0f45 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/fill/return-this.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/fill/return-this.js @@ -17,4 +17,4 @@ testWithTypedArrayConstructors(function(TA, makeCtorArg) { var sample2 = new TA(makeCtorArg(42)); var result2 = sample2.fill(7); assert.sameValue(result2, sample2); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-return-does-not-change-instance.js b/third_party/test262/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-return-does-not-change-instance.js index 78ebdd956d2d2b..c4beeb4eed727d 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-return-does-not-change-instance.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-return-does-not-change-instance.js @@ -9,9 +9,7 @@ features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA, makeCtorArg) { - var sample1 = new TA(makeCtorArg(3)); - - sample1[1] = 1n; + var sample1 = new TA(makeCtorArg(["0", "1", "0"])); sample1.filter(function() { return 42; diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-set-value-during-iteration.js b/third_party/test262/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-set-value-during-iteration.js index 959ad02f270c34..84a490a6eceb72 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-set-value-during-iteration.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-set-value-during-iteration.js @@ -44,4 +44,4 @@ testWithBigIntTypedArrayConstructors(function(TA, makeCtorArg) { assert.sameValue(sample[0], 7n, "changed values after interaction [0] == 7"); assert.sameValue(sample[1], 1n, "changed values after interaction [1] == 1"); assert.sameValue(sample[2], 2n, "changed values after interaction [2] == 2"); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/filter/BigInt/values-are-not-cached.js b/third_party/test262/test/built-ins/TypedArray/prototype/filter/BigInt/values-are-not-cached.js index fe17657080bd05..5ba4cb58b281c7 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/filter/BigInt/values-are-not-cached.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/filter/BigInt/values-are-not-cached.js @@ -28,4 +28,4 @@ testWithBigIntTypedArrayConstructors(function(TA, makeCtorArg) { v, 42n, "method does not cache values before callbackfn calls" ); }); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/filter/callbackfn-return-does-not-change-instance.js b/third_party/test262/test/built-ins/TypedArray/prototype/filter/callbackfn-return-does-not-change-instance.js index 3c5d96ceee7016..3d09210fd25df7 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/filter/callbackfn-return-does-not-change-instance.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/filter/callbackfn-return-does-not-change-instance.js @@ -9,9 +9,7 @@ features: [TypedArray] ---*/ testWithTypedArrayConstructors(function(TA, makeCtorArg) { - var sample1 = new TA(makeCtorArg(3)); - - sample1[1] = 1; + var sample1 = new TA(makeCtorArg(["0", "1", "0"])); sample1.filter(function() { return 42; diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/filter/callbackfn-set-value-during-iteration.js b/third_party/test262/test/built-ins/TypedArray/prototype/filter/callbackfn-set-value-during-iteration.js index 29b3fc0e6b750a..e5188e0cc5e481 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/filter/callbackfn-set-value-during-iteration.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/filter/callbackfn-set-value-during-iteration.js @@ -44,4 +44,4 @@ testWithTypedArrayConstructors(function(TA, makeCtorArg) { assert.sameValue(sample[0], 7, "changed values after interaction [0] == 7"); assert.sameValue(sample[1], 1, "changed values after interaction [1] == 1"); assert.sameValue(sample[2], 2, "changed values after interaction [2] == 2"); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/filter/values-are-not-cached.js b/third_party/test262/test/built-ins/TypedArray/prototype/filter/values-are-not-cached.js index 448c33f4d14140..e27bf951f0a6b5 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/filter/values-are-not-cached.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/filter/values-are-not-cached.js @@ -28,4 +28,4 @@ testWithTypedArrayConstructors(function(TA, makeCtorArg) { v, 42, "method does not cache values before callbackfn calls" ); }); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/find/BigInt/predicate-call-changes-value.js b/third_party/test262/test/built-ins/TypedArray/prototype/find/BigInt/predicate-call-changes-value.js index e7aa737815888d..867eed774e30c2 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/find/BigInt/predicate-call-changes-value.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/find/BigInt/predicate-call-changes-value.js @@ -75,4 +75,4 @@ testWithBigIntTypedArrayConstructors(function(TA, makeCtorArg) { return true; }); assert.sameValue(result, 1n, "find() returns previous found value"); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/find/predicate-call-changes-value.js b/third_party/test262/test/built-ins/TypedArray/prototype/find/predicate-call-changes-value.js index ce2cafed376a99..1e717cac11e6fd 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/find/predicate-call-changes-value.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/find/predicate-call-changes-value.js @@ -75,4 +75,4 @@ testWithTypedArrayConstructors(function(TA, makeCtorArg) { return true; }); assert.sameValue(result, 1, "find() returns previous found value"); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-call-changes-value.js b/third_party/test262/test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-call-changes-value.js index e6ee1d4b025dca..636cdd225dbec6 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-call-changes-value.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-call-changes-value.js @@ -64,4 +64,4 @@ testWithBigIntTypedArrayConstructors(function(TA, makeCtorArg) { return val === 7n; }); assert.sameValue(result, -1, "value not found - changed after call"); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/findIndex/predicate-call-changes-value.js b/third_party/test262/test/built-ins/TypedArray/prototype/findIndex/predicate-call-changes-value.js index e47a006c5e134d..2a7fc69297a972 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/findIndex/predicate-call-changes-value.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/findIndex/predicate-call-changes-value.js @@ -64,4 +64,4 @@ testWithTypedArrayConstructors(function(TA, makeCtorArg) { return val === 7; }); assert.sameValue(result, -1, "value not found - changed after call"); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/findLast/BigInt/predicate-call-changes-value.js b/third_party/test262/test/built-ins/TypedArray/prototype/findLast/BigInt/predicate-call-changes-value.js index f05e04712dfffb..dbacb1c19d1506 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/findLast/BigInt/predicate-call-changes-value.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/findLast/BigInt/predicate-call-changes-value.js @@ -63,4 +63,4 @@ testWithBigIntTypedArrayConstructors(function(TA, makeCtorArg) { return true; }); assert.sameValue(result, 3n, "findLast() returns previous found value"); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/findLast/predicate-call-changes-value.js b/third_party/test262/test/built-ins/TypedArray/prototype/findLast/predicate-call-changes-value.js index c86ce12a5736a8..20c188a5fc532f 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/findLast/predicate-call-changes-value.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/findLast/predicate-call-changes-value.js @@ -63,4 +63,4 @@ testWithTypedArrayConstructors(function(TA, makeCtorArg) { return true; }); assert.sameValue(result, 3, "findLast() returns previous found value"); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/findLastIndex/BigInt/predicate-call-changes-value.js b/third_party/test262/test/built-ins/TypedArray/prototype/findLastIndex/BigInt/predicate-call-changes-value.js index cf0043d99d1486..e42b60edf5f0d0 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/findLastIndex/BigInt/predicate-call-changes-value.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/findLastIndex/BigInt/predicate-call-changes-value.js @@ -55,4 +55,4 @@ testWithBigIntTypedArrayConstructors(function(TA, makeCtorArg) { return val === 7n; }); assert.sameValue(result, -1, "value not found - changed after call"); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/findLastIndex/predicate-call-changes-value.js b/third_party/test262/test/built-ins/TypedArray/prototype/findLastIndex/predicate-call-changes-value.js index eb4f30385d379f..93e98e4e010a5e 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/findLastIndex/predicate-call-changes-value.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/findLastIndex/predicate-call-changes-value.js @@ -55,4 +55,4 @@ testWithTypedArrayConstructors(function(TA, makeCtorArg) { return val === 7; }); assert.sameValue(result, -1, "value not found - changed after call"); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-return-does-not-change-instance.js b/third_party/test262/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-return-does-not-change-instance.js index ea6cbd54867005..40c068dbfe03fc 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-return-does-not-change-instance.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-return-does-not-change-instance.js @@ -16,9 +16,7 @@ features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA, makeCtorArg) { - var sample1 = new TA(makeCtorArg(3)); - - sample1[1] = 1n; + var sample1 = new TA(makeCtorArg(["0", "1", "0"])); sample1.forEach(function() { return 42; diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-set-value-during-interaction.js b/third_party/test262/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-set-value-during-interaction.js index 5a9b6f7bbe3631..68c2937d56ad66 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-set-value-during-interaction.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-set-value-during-interaction.js @@ -44,4 +44,4 @@ testWithBigIntTypedArrayConstructors(function(TA, makeCtorArg) { assert.sameValue(sample[0], 7n, "changed values after iteration [0] == 7"); assert.sameValue(sample[1], 1n, "changed values after iteration [1] == 1"); assert.sameValue(sample[2], 2n, "changed values after iteration [2] == 2"); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/forEach/BigInt/values-are-not-cached.js b/third_party/test262/test/built-ins/TypedArray/prototype/forEach/BigInt/values-are-not-cached.js index e8b8eda98ec715..81208159c8ca2e 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/forEach/BigInt/values-are-not-cached.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/forEach/BigInt/values-are-not-cached.js @@ -28,4 +28,4 @@ testWithBigIntTypedArrayConstructors(function(TA, makeCtorArg) { v, 42n, "method does not cache values before callbackfn calls" ); }); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/forEach/callbackfn-return-does-not-change-instance.js b/third_party/test262/test/built-ins/TypedArray/prototype/forEach/callbackfn-return-does-not-change-instance.js index b047cce3d40ee6..b0c0e5d7f7f8bc 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/forEach/callbackfn-return-does-not-change-instance.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/forEach/callbackfn-return-does-not-change-instance.js @@ -16,9 +16,7 @@ features: [TypedArray] ---*/ testWithTypedArrayConstructors(function(TA, makeCtorArg) { - var sample1 = new TA(makeCtorArg(3)); - - sample1[1] = 1; + var sample1 = new TA(makeCtorArg(["0", "1", "0"])); sample1.forEach(function() { return 42; diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/forEach/callbackfn-set-value-during-interaction.js b/third_party/test262/test/built-ins/TypedArray/prototype/forEach/callbackfn-set-value-during-interaction.js index 70ab374a215b0a..a218c7e9345ae1 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/forEach/callbackfn-set-value-during-interaction.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/forEach/callbackfn-set-value-during-interaction.js @@ -44,4 +44,4 @@ testWithTypedArrayConstructors(function(TA, makeCtorArg) { assert.sameValue(sample[0], 7, "changed values after iteration [0] == 7"); assert.sameValue(sample[1], 1, "changed values after iteration [1] == 1"); assert.sameValue(sample[2], 2, "changed values after iteration [2] == 2"); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/forEach/values-are-not-cached.js b/third_party/test262/test/built-ins/TypedArray/prototype/forEach/values-are-not-cached.js index 73647d4520e67e..4d69907917b2fc 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/forEach/values-are-not-cached.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/forEach/values-are-not-cached.js @@ -28,4 +28,4 @@ testWithTypedArrayConstructors(function(TA, makeCtorArg) { v, 42, "method does not cache values before callbackfn calls" ); }); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/includes/searchelement-not-integer.js b/third_party/test262/test/built-ins/TypedArray/prototype/includes/searchelement-not-integer.js index f01191e20902c2..08a4672b4c885e 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/includes/searchelement-not-integer.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/includes/searchelement-not-integer.js @@ -20,10 +20,5 @@ features: [TypedArray] testWithTypedArrayConstructors(function(TA, makeCtorArg) { var sample = new TA(makeCtorArg(10)); - function throwFunc(){ - throw Test262Error() - return 0; - } - - assert.sameValue(sample.includes({valueOf : throwFunc}), false); + assert.sameValue(sample.includes({ valueOf: Test262Error.thrower }), false); }); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-return-does-not-change-instance.js b/third_party/test262/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-return-does-not-change-instance.js index 4d3cd8b5f4aece..04a907c72a6426 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-return-does-not-change-instance.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-return-does-not-change-instance.js @@ -11,9 +11,7 @@ features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA, makeCtorArg) { - var sample1 = new TA(makeCtorArg(3)); - - sample1[1] = 1n; + var sample1 = new TA(makeCtorArg(["0", "1", "0"])); sample1.map(function() { return 42n; diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-set-value-during-interaction.js b/third_party/test262/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-set-value-during-interaction.js index dd275585d23453..835888f7faa693 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-set-value-during-interaction.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-set-value-during-interaction.js @@ -40,4 +40,4 @@ testWithBigIntTypedArrayConstructors(function(TA, makeCtorArg) { assert.sameValue(sample[0], 7n, "changed values after iteration [0] == 7"); assert.sameValue(sample[1], 1n, "changed values after iteration [1] == 1"); assert.sameValue(sample[2], 2n, "changed values after iteration [2] == 2"); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/map/BigInt/values-are-not-cached.js b/third_party/test262/test/built-ins/TypedArray/prototype/map/BigInt/values-are-not-cached.js index 864817dca64073..2b8bc35716d2c1 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/map/BigInt/values-are-not-cached.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/map/BigInt/values-are-not-cached.js @@ -25,4 +25,4 @@ testWithBigIntTypedArrayConstructors(function(TA, makeCtorArg) { return 0n; }); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/map/callbackfn-return-does-not-change-instance.js b/third_party/test262/test/built-ins/TypedArray/prototype/map/callbackfn-return-does-not-change-instance.js index b881bee0b17509..a16f3d04e55968 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/map/callbackfn-return-does-not-change-instance.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/map/callbackfn-return-does-not-change-instance.js @@ -11,9 +11,7 @@ features: [TypedArray] ---*/ testWithTypedArrayConstructors(function(TA, makeCtorArg) { - var sample1 = new TA(makeCtorArg(3)); - - sample1[1] = 1; + var sample1 = new TA(makeCtorArg(["0", "1", "0"])); sample1.map(function() { return 42; diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/map/callbackfn-set-value-during-interaction.js b/third_party/test262/test/built-ins/TypedArray/prototype/map/callbackfn-set-value-during-interaction.js index 97efe48f1eb3a3..111b353e17f4fb 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/map/callbackfn-set-value-during-interaction.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/map/callbackfn-set-value-during-interaction.js @@ -40,4 +40,4 @@ testWithTypedArrayConstructors(function(TA, makeCtorArg) { assert.sameValue(sample[0], 7, "changed values after iteration [0] == 7"); assert.sameValue(sample[1], 1, "changed values after iteration [1] == 1"); assert.sameValue(sample[2], 2, "changed values after iteration [2] == 2"); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/map/values-are-not-cached.js b/third_party/test262/test/built-ins/TypedArray/prototype/map/values-are-not-cached.js index 91aee73a2789c8..ff674c26d68acf 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/map/values-are-not-cached.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/map/values-are-not-cached.js @@ -25,4 +25,4 @@ testWithTypedArrayConstructors(function(TA, makeCtorArg) { return 0; }); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-set-value-during-iteration.js b/third_party/test262/test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-set-value-during-iteration.js index d34c2b8c91f258..b3d0cebb39ae37 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-set-value-during-iteration.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-set-value-during-iteration.js @@ -46,4 +46,4 @@ testWithBigIntTypedArrayConstructors(function(TA, makeCtorArg) { assert.sameValue(sample[0], 7n, "changed values after iteration [0] == 7"); assert.sameValue(sample[1], 1n, "changed values after iteration [1] == 1"); assert.sameValue(sample[2], 2n, "changed values after iteration [2] == 2"); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/reduce/BigInt/values-are-not-cached.js b/third_party/test262/test/built-ins/TypedArray/prototype/reduce/BigInt/values-are-not-cached.js index b7a6061745f2da..9f866b86f49105 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/reduce/BigInt/values-are-not-cached.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/reduce/BigInt/values-are-not-cached.js @@ -38,4 +38,4 @@ testWithBigIntTypedArrayConstructors(function(TA, makeCtorArg) { v, 42n, "method does not cache values before callbackfn calls" ); }, 0); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/reduce/callbackfn-set-value-during-iteration.js b/third_party/test262/test/built-ins/TypedArray/prototype/reduce/callbackfn-set-value-during-iteration.js index a041518247d1c2..a8ab14d9fc6694 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/reduce/callbackfn-set-value-during-iteration.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/reduce/callbackfn-set-value-during-iteration.js @@ -46,4 +46,4 @@ testWithTypedArrayConstructors(function(TA, makeCtorArg) { assert.sameValue(sample[0], 7, "changed values after iteration [0] == 7"); assert.sameValue(sample[1], 1, "changed values after iteration [1] == 1"); assert.sameValue(sample[2], 2, "changed values after iteration [2] == 2"); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/reduce/values-are-not-cached.js b/third_party/test262/test/built-ins/TypedArray/prototype/reduce/values-are-not-cached.js index c3a82924fe99a6..031983b8290a31 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/reduce/values-are-not-cached.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/reduce/values-are-not-cached.js @@ -38,4 +38,4 @@ testWithTypedArrayConstructors(function(TA, makeCtorArg) { v, 42, "method does not cache values before callbackfn calls" ); }, 0); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-set-value-during-iteration.js b/third_party/test262/test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-set-value-during-iteration.js index 9963bec62125ab..e7ff0179b09a0e 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-set-value-during-iteration.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-set-value-during-iteration.js @@ -46,4 +46,4 @@ testWithBigIntTypedArrayConstructors(function(TA, makeCtorArg) { assert.sameValue(sample[0], 2n, "changed values after iteration [0] == 2"); assert.sameValue(sample[1], 1n, "changed values after iteration [1] == 1"); assert.sameValue(sample[2], 7n, "changed values after iteration [2] == 7"); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/reduceRight/BigInt/values-are-not-cached.js b/third_party/test262/test/built-ins/TypedArray/prototype/reduceRight/BigInt/values-are-not-cached.js index 0d39a9984c31be..421feff4dfa3f9 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/reduceRight/BigInt/values-are-not-cached.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/reduceRight/BigInt/values-are-not-cached.js @@ -39,4 +39,4 @@ testWithBigIntTypedArrayConstructors(function(TA, makeCtorArg) { v, 42n, "method does not cache values before callbackfn calls" ); }, 0); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/reduceRight/callbackfn-set-value-during-iteration.js b/third_party/test262/test/built-ins/TypedArray/prototype/reduceRight/callbackfn-set-value-during-iteration.js index d7279b5db34e54..105a8150bdd81f 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/reduceRight/callbackfn-set-value-during-iteration.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/reduceRight/callbackfn-set-value-during-iteration.js @@ -46,4 +46,4 @@ testWithTypedArrayConstructors(function(TA, makeCtorArg) { assert.sameValue(sample[0], 2, "changed values after iteration [0] == 2"); assert.sameValue(sample[1], 1, "changed values after iteration [1] == 1"); assert.sameValue(sample[2], 7, "changed values after iteration [2] == 7"); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/reduceRight/values-are-not-cached.js b/third_party/test262/test/built-ins/TypedArray/prototype/reduceRight/values-are-not-cached.js index 3d0a5519a42ec9..be5eb0808694f2 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/reduceRight/values-are-not-cached.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/reduceRight/values-are-not-cached.js @@ -39,4 +39,4 @@ testWithTypedArrayConstructors(function(TA, makeCtorArg) { v, 42, "method does not cache values before callbackfn calls" ); }, 0); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/reverse/BigInt/preserves-non-numeric-properties.js b/third_party/test262/test/built-ins/TypedArray/prototype/reverse/BigInt/preserves-non-numeric-properties.js index 2a663668ee2d7e..70402a3b3a9a7b 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/reverse/BigInt/preserves-non-numeric-properties.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/reverse/BigInt/preserves-non-numeric-properties.js @@ -32,4 +32,4 @@ testWithBigIntTypedArrayConstructors(function(TA, makeCtorArg) { assert.sameValue(result.foo, 42, "sample.foo === 42"); assert.sameValue(result.bar, "bar", "sample.bar === 'bar'"); assert.sameValue(result[s], 1, "sample[s] === 1"); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/reverse/preserves-non-numeric-properties.js b/third_party/test262/test/built-ins/TypedArray/prototype/reverse/preserves-non-numeric-properties.js index 0632ed701f34c7..00efdaaceb9b6a 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/reverse/preserves-non-numeric-properties.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/reverse/preserves-non-numeric-properties.js @@ -32,4 +32,4 @@ testWithTypedArrayConstructors(function(TA, makeCtorArg) { assert.sameValue(result.foo, 42, "sample.foo === 42"); assert.sameValue(result.bar, "bar", "sample.bar === 'bar'"); assert.sameValue(result[s], 1, "sample[s] === 1"); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-negative-integer-offset-throws.js b/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-negative-integer-offset-throws.js index 59f835b1ecc972..2d562409d4e536 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-negative-integer-offset-throws.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-negative-integer-offset-throws.js @@ -32,4 +32,4 @@ testWithBigIntTypedArrayConstructors(function(TA, makeCtorArg) { assert.throws(RangeError, function() { sample.set([1n], -Infinity); }, "-Infinity"); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-offset-tointeger.js b/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-offset-tointeger.js index 7881ec2f5f929d..763b727f3b05df 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-offset-tointeger.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-offset-tointeger.js @@ -92,4 +92,4 @@ testWithBigIntTypedArrayConstructors(function(TA, makeCtorArg) { sample = new TA(makeCtorArg([1n, 2n])); sample.set([42n], { toString: function() {return 1;} }); assert(compareArray(sample, [1n, 42n]), "toString"); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-primitive-toobject.js b/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-primitive-toobject.js index ef43f7c6ab5c3f..4dcae955b02822 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-primitive-toobject.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-primitive-toobject.js @@ -46,4 +46,4 @@ testWithBigIntTypedArrayConstructors(function(TA, makeCtorArg) { var ta5 = new TA(makeCtorArg([1n, 2n])); ta5.set(4n, 1); assert.compareArray(ta5, [1n, 2n], "bigint"); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-src-length-symbol.js b/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-src-length-symbol.js index 7ec8091334e703..4e9607d121e030 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-src-length-symbol.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-src-length-symbol.js @@ -27,4 +27,4 @@ testWithBigIntTypedArrayConstructors(function(TA, makeCtorArg) { assert.throws(TypeError, function() { sample.set(obj); }); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-src-length.js b/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-src-length.js index 2ae67acf475155..2351f646dd0e5f 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-src-length.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-src-length.js @@ -43,4 +43,4 @@ testWithBigIntTypedArrayConstructors(function(TA, makeCtorArg) { assert.throws(Test262Error, function() { sample.set(obj2); }, "toString"); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-src-tonumber-value-symbol.js b/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-src-tonumber-value-symbol.js index c0bff8ccc680b8..6003013e876473 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-src-tonumber-value-symbol.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-src-tonumber-value-symbol.js @@ -41,4 +41,4 @@ testWithBigIntTypedArrayConstructors(function(TA, makeCtorArg) { compareArray(sample, [42n, 43n, 3n, 4n]), "values are set until exception" ); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-src-tonumber-value.js b/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-src-tonumber-value.js index a2f07e27de214f..92d4f232e3c3d6 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-src-tonumber-value.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-src-tonumber-value.js @@ -45,4 +45,4 @@ testWithBigIntTypedArrayConstructors(function(TA, makeCtorArg) { compareArray(sample, [42n, 43n, 3n, 4n]), "values are set until exception" ); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-tointeger-offset-symbol.js b/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-tointeger-offset-symbol.js index 3eebeace70cb65..d7294c6b02696f 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-tointeger-offset-symbol.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-tointeger-offset-symbol.js @@ -24,4 +24,4 @@ testWithBigIntTypedArrayConstructors(function(TA, makeCtorArg) { assert.throws(TypeError, function() { sample.set([1n], s); }); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-toobject-offset.js b/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-toobject-offset.js index 9c3215c13a836a..bed306ceb09ed0 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-toobject-offset.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-toobject-offset.js @@ -27,4 +27,4 @@ testWithBigIntTypedArrayConstructors(function(TA, makeCtorArg) { assert.throws(TypeError, function() { sample.set(null); }, "null"); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-set-values.js b/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-set-values.js index 5386252f0e8b47..898af13bd6b521 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-set-values.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-set-values.js @@ -60,4 +60,4 @@ testWithBigIntTypedArrayConstructors(function(TA, makeCtorArg) { result = sample.set(srcObj, 2); assert(compareArray(sample, [1n, 2n, 7n, 17n]), "offset: 2, result: " + sample); assert.sameValue(result, undefined, "returns undefined"); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-src-tonumber-value-type-conversions.js b/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-src-tonumber-value-type-conversions.js index 2a4daedc18a640..aabe13fbea2616 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-src-tonumber-value-type-conversions.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-src-tonumber-value-type-conversions.js @@ -46,4 +46,4 @@ testWithBigIntTypedArrayConstructors(function(TA, makeCtorArg) { compareArray(sample, expected), "sample: [" + sample + "], expected: [" + expected + "]" ); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/boolean-tobigint.js b/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/boolean-tobigint.js index 145acd501a52d5..171c667be38492 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/boolean-tobigint.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/boolean-tobigint.js @@ -43,4 +43,4 @@ testWithBigIntTypedArrayConstructors(function(TA, makeCtorArg) { assert.sameValue(typedArray[0], 0n, "False converts to BigInt"); assert.sameValue(typedArray[1], 1n, "True converts to BigInt"); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/null-tobigint.js b/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/null-tobigint.js index 2607350f88998e..7285917ae47a8f 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/null-tobigint.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/null-tobigint.js @@ -44,4 +44,4 @@ testWithBigIntTypedArrayConstructors(function(TA, makeCtorArg) { typedArray.set([null]); }, "abrupt completion from Null"); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/number-tobigint.js b/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/number-tobigint.js index c232e62a955c86..c0985c79b68eb9 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/number-tobigint.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/number-tobigint.js @@ -69,4 +69,4 @@ testWithBigIntTypedArrayConstructors(function(TA, makeCtorArg) { typedArray.set([NaN]); }, "abrupt completion from Number: NaN"); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/src-typedarray-big.js b/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/src-typedarray-big.js index ffa2014fc3b4ed..60285073158918 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/src-typedarray-big.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/src-typedarray-big.js @@ -34,5 +34,5 @@ testWithBigIntTypedArrayConstructors(function(BTA1, makeCtorArg) { assert.sameValue(targetTypedArray[0], testValue, "Setting BigInt TypedArray with BigInt TypedArray should succeed.") }); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/src-typedarray-not-big-throws.js b/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/src-typedarray-not-big-throws.js index 94a148d6084600..824e9df2825cda 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/src-typedarray-not-big-throws.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/src-typedarray-not-big-throws.js @@ -34,4 +34,4 @@ testWithTypedArrayConstructors(function(TA, makeCtorArg) { }); }); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/string-nan-tobigint.js b/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/string-nan-tobigint.js index 1eb65b55272d10..c26fb44a24b419 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/string-nan-tobigint.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/string-nan-tobigint.js @@ -47,4 +47,4 @@ testWithBigIntTypedArrayConstructors(function(TA, makeCtorArg) { typedArray.set(["definately not a number"]); }, "StringToBigInt(prim) == NaN"); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/string-tobigint.js b/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/string-tobigint.js index c1ade89f3a0baa..c31a7a37b5cd38 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/string-tobigint.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/string-tobigint.js @@ -63,4 +63,4 @@ testWithBigIntTypedArrayConstructors(function(TA, makeCtorArg) { typedArray.set(["1e7"]); }, "Replace the StrUnsignedDecimalLiteral production with DecimalDigits to not allow... exponents..."); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/symbol-tobigint.js b/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/symbol-tobigint.js index ea11e3f658f4aa..dafea15a6d2f98 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/symbol-tobigint.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/symbol-tobigint.js @@ -47,4 +47,4 @@ testWithBigIntTypedArrayConstructors(function(TA, makeCtorArg) { typedArray.set([s]); }, "abrupt completion from Symbol"); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-offset-tointeger.js b/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-offset-tointeger.js index 57c0f8400e6f8d..3341e2c208af6a 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-offset-tointeger.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-offset-tointeger.js @@ -90,4 +90,4 @@ testWithBigIntTypedArrayConstructors(function(TA, makeCtorArg) { sample = new TA(makeCtorArg([1n, 2n])); sample.set(src, { toString: function() {return 1;} }); assert(compareArray(sample, [1n, 42n]), "toString"); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-diff-buffer-other-type-sab.js b/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-diff-buffer-other-type-sab.js index 658bd816ea3691..4256ed9da3a5a3 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-diff-buffer-other-type-sab.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-diff-buffer-other-type-sab.js @@ -101,4 +101,4 @@ testWithBigIntTypedArrayConstructors(function(TA, makeCtorArg) { result = sample.set(src, 2); assert(compareArray(sample, [1n, 2n, 42n, 43n]), "src and sample are SAB-backed, offset: 2, result: " + sample); assert.sameValue(result, undefined, "returns undefined"); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-diff-buffer-other-type.js b/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-diff-buffer-other-type.js index b827fae6cbc05f..c2b3fa9e4dc47b 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-diff-buffer-other-type.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-diff-buffer-other-type.js @@ -45,4 +45,4 @@ testWithBigIntTypedArrayConstructors(function(TA, makeCtorArg) { result = sample.set(src, 2); assert(compareArray(sample, [1n, 2n, 42n, 43n]), "offset: 2, result: " + sample); assert.sameValue(result, undefined, "returns undefined"); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-diff-buffer-same-type-sab.js b/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-diff-buffer-same-type-sab.js index 359c874d7beb0d..ab1da824e553da 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-diff-buffer-same-type-sab.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-diff-buffer-same-type-sab.js @@ -101,4 +101,4 @@ testWithBigIntTypedArrayConstructors(function(TA, makeCtorArg) { result = sample.set(src, 2); assert(compareArray(sample, [1n, 2n, 42n, 43n]), "src and sample are SAB-backed, offset: 2, result: " + sample); assert.sameValue(result, undefined, "returns undefined"); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-diff-buffer-same-type.js b/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-diff-buffer-same-type.js index e769cb25669dfb..b0f26dc3876832 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-diff-buffer-same-type.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-diff-buffer-same-type.js @@ -47,4 +47,4 @@ testWithBigIntTypedArrayConstructors(function(TA, makeCtorArg) { result = sample.set(src, 2); assert(compareArray(sample, [1n, 2n, 42n, 43n]), "offset: 2, result: " + sample); assert.sameValue(result, undefined, "returns undefined"); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-same-buffer-same-type.js b/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-same-buffer-same-type.js index 277cbc4625251b..d1ae10702f7350 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-same-buffer-same-type.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-same-buffer-same-type.js @@ -50,4 +50,4 @@ testWithBigIntTypedArrayConstructors(function(TA, makeCtorArg) { result = sample.set(src, 2); assert(compareArray(sample, [1n, 2n, 1n, 2n]), "offset: 2, result: " + sample); assert.sameValue(result, undefined, "returns undefined"); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-src-range-greather-than-target-throws-rangeerror.js b/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-src-range-greather-than-target-throws-rangeerror.js index 9a6edd04bc94c1..12ccbc10181de8 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-src-range-greather-than-target-throws-rangeerror.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-src-range-greather-than-target-throws-rangeerror.js @@ -48,4 +48,4 @@ testWithBigIntTypedArrayConstructors(function(TA, makeCtorArg) { assert.throws(RangeError, function() { sample.set(src, Infinity); }, "2 + Infinity > 2"); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/undefined-tobigint.js b/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/undefined-tobigint.js index 40baab50cbab75..f11e3fbd3fb56c 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/undefined-tobigint.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/set/BigInt/undefined-tobigint.js @@ -44,4 +44,4 @@ testWithBigIntTypedArrayConstructors(function(TA, makeCtorArg) { typedArray.set([undefined]); }, "abrupt completion from undefined"); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/set/array-arg-negative-integer-offset-throws.js b/third_party/test262/test/built-ins/TypedArray/prototype/set/array-arg-negative-integer-offset-throws.js index 90530ac7dfdf02..a8e02416740454 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/set/array-arg-negative-integer-offset-throws.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/set/array-arg-negative-integer-offset-throws.js @@ -32,4 +32,4 @@ testWithTypedArrayConstructors(function(TA, makeCtorArg) { assert.throws(RangeError, function() { sample.set([1], -Infinity); }, "-Infinity"); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/set/array-arg-offset-tointeger.js b/third_party/test262/test/built-ins/TypedArray/prototype/set/array-arg-offset-tointeger.js index fcbb913775d9d1..2e4913dc1ed0b1 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/set/array-arg-offset-tointeger.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/set/array-arg-offset-tointeger.js @@ -92,4 +92,4 @@ testWithTypedArrayConstructors(function(TA, makeCtorArg) { sample = new TA(makeCtorArg([1, 2])); sample.set([42], { toString: function() {return 1;} }); assert(compareArray(sample, [1, 42]), "toString"); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/set/array-arg-primitive-toobject.js b/third_party/test262/test/built-ins/TypedArray/prototype/set/array-arg-primitive-toobject.js index e397b8d7b9bd18..e3abbd85ee81d7 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/set/array-arg-primitive-toobject.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/set/array-arg-primitive-toobject.js @@ -43,4 +43,4 @@ testWithTypedArrayConstructors(function(TA, makeCtorArg) { var ta4 = new TA(makeCtorArg([1])); ta4.set(Symbol()); assert.compareArray(ta4, [1], "symbol"); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-src-length-symbol.js b/third_party/test262/test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-src-length-symbol.js index c2136b4c1188ef..d1ed8e8ab3c383 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-src-length-symbol.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-src-length-symbol.js @@ -27,4 +27,4 @@ testWithTypedArrayConstructors(function(TA, makeCtorArg) { assert.throws(TypeError, function() { sample.set(obj); }); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-src-length.js b/third_party/test262/test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-src-length.js index 6797a63e388cbd..d87acdb00622bc 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-src-length.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-src-length.js @@ -43,4 +43,4 @@ testWithTypedArrayConstructors(function(TA, makeCtorArg) { assert.throws(Test262Error, function() { sample.set(obj2); }, "toString"); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-src-tonumber-value-symbol.js b/third_party/test262/test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-src-tonumber-value-symbol.js index 3b7b921da33710..1a6ed01e39ccb6 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-src-tonumber-value-symbol.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-src-tonumber-value-symbol.js @@ -41,4 +41,4 @@ testWithTypedArrayConstructors(function(TA, makeCtorArg) { compareArray(sample, [42, 43, 3, 4]), "values are set until exception" ); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-src-tonumber-value.js b/third_party/test262/test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-src-tonumber-value.js index 2f7572c5d5f18a..0f0215ff929dca 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-src-tonumber-value.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-src-tonumber-value.js @@ -45,4 +45,4 @@ testWithTypedArrayConstructors(function(TA, makeCtorArg) { compareArray(sample, [42, 43, 3, 4]), "values are set until exception" ); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-tointeger-offset-symbol.js b/third_party/test262/test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-tointeger-offset-symbol.js index c3bb22083ba04f..134526a67dcae3 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-tointeger-offset-symbol.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-tointeger-offset-symbol.js @@ -24,4 +24,4 @@ testWithTypedArrayConstructors(function(TA, makeCtorArg) { assert.throws(TypeError, function() { sample.set([1], s); }); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-toobject-offset.js b/third_party/test262/test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-toobject-offset.js index 75f063a67620f8..3da0ffd36b1c96 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-toobject-offset.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-toobject-offset.js @@ -27,4 +27,4 @@ testWithTypedArrayConstructors(function(TA, makeCtorArg) { assert.throws(TypeError, function() { sample.set(null); }, "null"); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/set/array-arg-set-values.js b/third_party/test262/test/built-ins/TypedArray/prototype/set/array-arg-set-values.js index cd9308e5b130d9..b0e0ba19d041c9 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/set/array-arg-set-values.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/set/array-arg-set-values.js @@ -60,4 +60,4 @@ testWithTypedArrayConstructors(function(TA, makeCtorArg) { result = sample.set(srcObj, 2); assert(compareArray(sample, [1, 2, 7, 17]), "offset: 2, result: " + sample); assert.sameValue(result, undefined, "returns undefined"); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/set/array-arg-src-tonumber-value-type-conversions.js b/third_party/test262/test/built-ins/TypedArray/prototype/set/array-arg-src-tonumber-value-type-conversions.js index 9013cdf89e963a..ffc3cafede8c30 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/set/array-arg-src-tonumber-value-type-conversions.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/set/array-arg-src-tonumber-value-type-conversions.js @@ -46,4 +46,4 @@ testWithTypedArrayConstructors(function(TA, makeCtorArg) { compareArray(sample, expected), "sample: [" + sample + "], expected: [" + expected + "]" ); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/set/src-typedarray-big-throws.js b/third_party/test262/test/built-ins/TypedArray/prototype/set/src-typedarray-big-throws.js index 096204e90c3db6..1241ae22342d81 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/set/src-typedarray-big-throws.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/set/src-typedarray-big-throws.js @@ -34,4 +34,4 @@ testWithBigIntTypedArrayConstructors(function(BTA, makeCtorArg) { }); }); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/set/typedarray-arg-offset-tointeger.js b/third_party/test262/test/built-ins/TypedArray/prototype/set/typedarray-arg-offset-tointeger.js index 31c6b0e48e9bc6..75fc5dd2b9bd7a 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/set/typedarray-arg-offset-tointeger.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/set/typedarray-arg-offset-tointeger.js @@ -90,4 +90,4 @@ testWithTypedArrayConstructors(function(TA, makeCtorArg) { sample = new TA(makeCtorArg([1, 2])); sample.set(src, { toString: function() {return 1;} }); assert(compareArray(sample, [1, 42]), "toString"); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/set/typedarray-arg-set-values-diff-buffer-other-type-sab.js b/third_party/test262/test/built-ins/TypedArray/prototype/set/typedarray-arg-set-values-diff-buffer-other-type-sab.js index 00a8e90ebdc3de..f1be34eff243fc 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/set/typedarray-arg-set-values-diff-buffer-other-type-sab.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/set/typedarray-arg-set-values-diff-buffer-other-type-sab.js @@ -104,4 +104,4 @@ testWithTypedArrayConstructors(function(TA, makeCtorArg) { result = sample.set(src, 2); assert(compareArray(sample, [1, 2, 42, 43]), "src and sample are SAB-backed, offset: 2, result: " + sample); assert.sameValue(result, undefined, "returns undefined"); -}, int_views); +}, int_views, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/set/typedarray-arg-set-values-diff-buffer-other-type.js b/third_party/test262/test/built-ins/TypedArray/prototype/set/typedarray-arg-set-values-diff-buffer-other-type.js index 9a10d8a29bc384..3f39010c172147 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/set/typedarray-arg-set-values-diff-buffer-other-type.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/set/typedarray-arg-set-values-diff-buffer-other-type.js @@ -45,4 +45,4 @@ testWithTypedArrayConstructors(function(TA, makeCtorArg) { result = sample.set(src, 2); assert(compareArray(sample, [1, 2, 42, 43]), "offset: 2, result: " + sample); assert.sameValue(result, undefined, "returns undefined"); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/set/typedarray-arg-set-values-diff-buffer-same-type-sab.js b/third_party/test262/test/built-ins/TypedArray/prototype/set/typedarray-arg-set-values-diff-buffer-same-type-sab.js index 1158f7652effa2..fd01d5f5de727c 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/set/typedarray-arg-set-values-diff-buffer-same-type-sab.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/set/typedarray-arg-set-values-diff-buffer-same-type-sab.js @@ -104,4 +104,4 @@ testWithTypedArrayConstructors(function(TA, makeCtorArg) { result = sample.set(src, 2); assert(compareArray(sample, [1, 2, 42, 43]), "src and sample are SAB-backed, offset: 2, result: " + sample); assert.sameValue(result, undefined, "returns undefined"); -}, int_views); +}, int_views, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/set/typedarray-arg-set-values-diff-buffer-same-type.js b/third_party/test262/test/built-ins/TypedArray/prototype/set/typedarray-arg-set-values-diff-buffer-same-type.js index f82d316f0d69fd..1ff070cc1ce1f3 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/set/typedarray-arg-set-values-diff-buffer-same-type.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/set/typedarray-arg-set-values-diff-buffer-same-type.js @@ -47,4 +47,4 @@ testWithTypedArrayConstructors(function(TA, makeCtorArg) { result = sample.set(src, 2); assert(compareArray(sample, [1, 2, 42, 43]), "offset: 2, result: " + sample); assert.sameValue(result, undefined, "returns undefined"); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/set/typedarray-arg-set-values-same-buffer-other-type.js b/third_party/test262/test/built-ins/TypedArray/prototype/set/typedarray-arg-set-values-same-buffer-other-type.js index 864da2c22e2340..f625ebced7f2d2 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/set/typedarray-arg-set-values-same-buffer-other-type.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/set/typedarray-arg-set-values-same-buffer-other-type.js @@ -57,4 +57,4 @@ testWithTypedArrayConstructors(function(TA, makeCtorArg) { assert(compareArray(sample, expected[TA.name]), sample); assert.sameValue(result, undefined, "returns undefined"); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/set/typedarray-arg-set-values-same-buffer-same-type.js b/third_party/test262/test/built-ins/TypedArray/prototype/set/typedarray-arg-set-values-same-buffer-same-type.js index bf15d65cece469..e5706a4148ab15 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/set/typedarray-arg-set-values-same-buffer-same-type.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/set/typedarray-arg-set-values-same-buffer-same-type.js @@ -50,4 +50,4 @@ testWithTypedArrayConstructors(function(TA, makeCtorArg) { result = sample.set(src, 2); assert(compareArray(sample, [1, 2, 1, 2]), "offset: 2, result: " + sample); assert.sameValue(result, undefined, "returns undefined"); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/set/typedarray-arg-src-range-greather-than-target-throws-rangeerror.js b/third_party/test262/test/built-ins/TypedArray/prototype/set/typedarray-arg-src-range-greather-than-target-throws-rangeerror.js index a592458dd11bd9..2c09495e535658 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/set/typedarray-arg-src-range-greather-than-target-throws-rangeerror.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/set/typedarray-arg-src-range-greather-than-target-throws-rangeerror.js @@ -48,4 +48,4 @@ testWithTypedArrayConstructors(function(TA, makeCtorArg) { assert.throws(RangeError, function() { sample.set(src, Infinity); }, "2 + Infinity > 2"); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-set-value-during-interaction.js b/third_party/test262/test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-set-value-during-interaction.js index 0ad4f3f96fbcb2..7b369155c38ad0 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-set-value-during-interaction.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-set-value-during-interaction.js @@ -53,4 +53,4 @@ testWithBigIntTypedArrayConstructors(function(TA, makeCtorArg) { assert.sameValue(sample[0], 7n, "changed values after iteration [0] == 7"); assert.sameValue(sample[1], 1n, "changed values after iteration [1] == 1"); assert.sameValue(sample[2], 2n, "changed values after iteration [2] == 2"); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/some/BigInt/values-are-not-cached.js b/third_party/test262/test/built-ins/TypedArray/prototype/some/BigInt/values-are-not-cached.js index 82d119629b6ac6..cab518f2556e17 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/some/BigInt/values-are-not-cached.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/some/BigInt/values-are-not-cached.js @@ -37,4 +37,4 @@ testWithBigIntTypedArrayConstructors(function(TA, makeCtorArg) { v, 42n, "method does not cache values before callbackfn calls" ); }); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/some/callbackfn-set-value-during-interaction.js b/third_party/test262/test/built-ins/TypedArray/prototype/some/callbackfn-set-value-during-interaction.js index 736fb7cdfcc9aa..dd673ff5064e78 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/some/callbackfn-set-value-during-interaction.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/some/callbackfn-set-value-during-interaction.js @@ -53,4 +53,4 @@ testWithTypedArrayConstructors(function(TA, makeCtorArg) { assert.sameValue(sample[0], 7, "changed values after iteration [0] == 7"); assert.sameValue(sample[1], 1, "changed values after iteration [1] == 1"); assert.sameValue(sample[2], 2, "changed values after iteration [2] == 2"); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/some/values-are-not-cached.js b/third_party/test262/test/built-ins/TypedArray/prototype/some/values-are-not-cached.js index 6af2bf960b49be..14aeefee7ebfff 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/some/values-are-not-cached.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/some/values-are-not-cached.js @@ -37,4 +37,4 @@ testWithTypedArrayConstructors(function(TA, makeCtorArg) { v, 42, "method does not cache values before callbackfn calls" ); }); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/sort/BigInt/comparefn-call-throws.js b/third_party/test262/test/built-ins/TypedArray/prototype/sort/BigInt/comparefn-call-throws.js index 3d8e8d3ba06e3f..30e0ba147a6e7f 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/sort/BigInt/comparefn-call-throws.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/sort/BigInt/comparefn-call-throws.js @@ -39,4 +39,4 @@ testWithBigIntTypedArrayConstructors(function(TA, makeCtorArg) { }); assert.sameValue(calls, 1, "immediately returned"); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/sort/BigInt/comparefn-calls.js b/third_party/test262/test/built-ins/TypedArray/prototype/sort/BigInt/comparefn-calls.js index c9d10aa2b4b38e..218f2d6a90db8a 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/sort/BigInt/comparefn-calls.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/sort/BigInt/comparefn-calls.js @@ -39,4 +39,4 @@ testWithBigIntTypedArrayConstructors(function(TA, makeCtorArg) { assert.sameValue(args[1][0], 42n, "x is a listed value"); assert.sameValue(args[1][0], 42n, "y is a listed value"); }); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/sort/BigInt/comparefn-is-undefined.js b/third_party/test262/test/built-ins/TypedArray/prototype/sort/BigInt/comparefn-is-undefined.js index 065ffe91b299cf..52749b5d221f23 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/sort/BigInt/comparefn-is-undefined.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/sort/BigInt/comparefn-is-undefined.js @@ -20,4 +20,4 @@ testWithBigIntTypedArrayConstructors(function(TA, makeCtorArg) { assert.compareArray(explicit, [42n, 43n, 44n, 45n, 46n], 'The value of `explicit` is [42n, 43n, 44n, 45n, 46n]'); assert.compareArray(implicit, [42n, 43n, 44n, 45n, 46n], 'The value of `implicit` is [42n, 43n, 44n, 45n, 46n]'); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/sort/BigInt/comparefn-nonfunction-call-throws.js b/third_party/test262/test/built-ins/TypedArray/prototype/sort/BigInt/comparefn-nonfunction-call-throws.js index 30889e1ebe8e0d..0f48fb2f3e5a0c 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/sort/BigInt/comparefn-nonfunction-call-throws.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/sort/BigInt/comparefn-nonfunction-call-throws.js @@ -52,4 +52,4 @@ testWithBigIntTypedArrayConstructors(function(TA, makeCtorArg) { assert.throws(TypeError, function() { sample.sort({}); }); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/sort/BigInt/return-same-instance.js b/third_party/test262/test/built-ins/TypedArray/prototype/sort/BigInt/return-same-instance.js index 0a22834ed507ed..f71063557b9f52 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/sort/BigInt/return-same-instance.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/sort/BigInt/return-same-instance.js @@ -22,4 +22,4 @@ testWithBigIntTypedArrayConstructors(function(TA, makeCtorArg) { result = sample.sort(function() { return 0; }); assert.sameValue(sample, result, "with comparefn"); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/sort/BigInt/sortcompare-with-no-tostring.js b/third_party/test262/test/built-ins/TypedArray/prototype/sort/BigInt/sortcompare-with-no-tostring.js index bdee5328838057..3bb7ca0f44dd41 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/sort/BigInt/sortcompare-with-no-tostring.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/sort/BigInt/sortcompare-with-no-tostring.js @@ -28,4 +28,4 @@ testWithBigIntTypedArrayConstructors(function(TA, makeCtorArg) { var result = sample.sort(); assert.sameValue(toStringCalled, false, "BigInt.prototype.toString will not be called"); assert(compareArray(result, [3n, 20n, 100n])); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/sort/BigInt/sorted-values.js b/third_party/test262/test/built-ins/TypedArray/prototype/sort/BigInt/sorted-values.js index 9cfbab7ba3090d..e25ee6249fca6b 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/sort/BigInt/sorted-values.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/sort/BigInt/sorted-values.js @@ -25,7 +25,7 @@ testWithBigIntTypedArrayConstructors(function(TA, makeCtorArg) { sample = new TA(makeCtorArg([3n, 4n, 3n, 1n, 0n, 1n, 2n])).sort(); assert(compareArray(sample, [0n, 1n, 1n, 2n, 3n, 3n, 4n]), "repeating numbers"); -}); +}, null, null, ["immutable"]); var sample = new BigInt64Array([-4n, 3n, 4n, -3n, 2n, -2n, 1n, 0n]).sort(); assert(compareArray(sample, [-4n, -3n, -2n, 0n, 1n, 2n, 3n, 4n]), "negative values"); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/sort/comparefn-call-throws.js b/third_party/test262/test/built-ins/TypedArray/prototype/sort/comparefn-call-throws.js index 78a522de84c321..028038ae758b96 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/sort/comparefn-call-throws.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/sort/comparefn-call-throws.js @@ -39,4 +39,4 @@ testWithTypedArrayConstructors(function(TA, makeCtorArg) { }); assert.sameValue(calls, 1, "immediately returned"); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/sort/comparefn-calls.js b/third_party/test262/test/built-ins/TypedArray/prototype/sort/comparefn-calls.js index 6d572a429843e2..c1e773bcc4d571 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/sort/comparefn-calls.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/sort/comparefn-calls.js @@ -39,4 +39,4 @@ testWithTypedArrayConstructors(function(TA, makeCtorArg) { assert.sameValue(args[1][0], 42, "x is a listed value"); assert.sameValue(args[1][0], 42, "y is a listed value"); }); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/sort/comparefn-is-undefined.js b/third_party/test262/test/built-ins/TypedArray/prototype/sort/comparefn-is-undefined.js index 860e6b30d3e998..267f2fbbede0c7 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/sort/comparefn-is-undefined.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/sort/comparefn-is-undefined.js @@ -20,4 +20,4 @@ testWithTypedArrayConstructors(function(TA, makeCtorArg) { assert.compareArray(explicit, [42, 43, 44, 45, 46], 'The value of `explicit` is [42, 43, 44, 45, 46]'); assert.compareArray(implicit, [42, 43, 44, 45, 46], 'The value of `implicit` is [42, 43, 44, 45, 46]'); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/sort/comparefn-nonfunction-call-throws.js b/third_party/test262/test/built-ins/TypedArray/prototype/sort/comparefn-nonfunction-call-throws.js index eed735b03d31c6..8809b550e46062 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/sort/comparefn-nonfunction-call-throws.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/sort/comparefn-nonfunction-call-throws.js @@ -52,4 +52,4 @@ testWithTypedArrayConstructors(function(TA, makeCtorArg) { assert.throws(TypeError, function() { sample.sort({}); }); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/sort/return-same-instance.js b/third_party/test262/test/built-ins/TypedArray/prototype/sort/return-same-instance.js index b363e964f639e2..bb9c2de4fa537d 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/sort/return-same-instance.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/sort/return-same-instance.js @@ -22,4 +22,4 @@ testWithTypedArrayConstructors(function(TA, makeCtorArg) { result = sample.sort(function() { return 0; }); assert.sameValue(sample, result, "with comparefn"); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/sort/sortcompare-with-no-tostring.js b/third_party/test262/test/built-ins/TypedArray/prototype/sort/sortcompare-with-no-tostring.js index 57203938e0a8db..c5e347334b74fb 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/sort/sortcompare-with-no-tostring.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/sort/sortcompare-with-no-tostring.js @@ -28,4 +28,4 @@ testWithTypedArrayConstructors(function(TA, makeCtorArg) { var result = sample.sort(); assert.sameValue(toStringCalled, false, "Number.prototype.toString will not be called"); assert(compareArray(result, [3, 20, 100]), "Default sorting by value"); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/sort/sorted-values-nan.js b/third_party/test262/test/built-ins/TypedArray/prototype/sort/sorted-values-nan.js index d688ded37f2628..af77b845cb6eba 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/sort/sorted-values-nan.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/sort/sorted-values-nan.js @@ -35,4 +35,4 @@ testWithTypedArrayConstructors(function(TA, makeCtorArg) { assert.sameValue(sample[4], Infinity, "#2 [4]"); assert.sameValue(sample[5], NaN, "#2 [5]"); assert.sameValue(sample[6], NaN, "#2 [6]"); -}, floatArrayConstructors); +}, floatArrayConstructors, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/sort/sorted-values.js b/third_party/test262/test/built-ins/TypedArray/prototype/sort/sorted-values.js index 99c0d717eee324..667ef22310a0e6 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/sort/sorted-values.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/sort/sorted-values.js @@ -25,22 +25,27 @@ testWithTypedArrayConstructors(function(TA, makeCtorArg) { sample = new TA(makeCtorArg([3, 4, 3, 1, 0, 1, 2])).sort(); assert(compareArray(sample, [0, 1, 1, 2, 3, 3, 4]), "repeating numbers"); -}); +}, null, null, ["immutable"]); testWithTypedArrayConstructors(function(TA, makeCtorArg) { var sample = new TA(makeCtorArg([1, 0, -0, 2])).sort(); assert(compareArray(sample, [-0, 0, 1, 2]), "0s"); -}, floatArrayConstructors); +}, floatArrayConstructors, null, ["immutable"]); testWithTypedArrayConstructors(function(TA, makeCtorArg) { var sample = new TA(makeCtorArg([1, 0, -0, 2])).sort(); assert(compareArray(sample, [0, 0, 1, 2]), "0s"); -}, intArrayConstructors); - -testWithTypedArrayConstructors(function(TA, makeCtorArg) { - var sample = new TA(makeCtorArg([-4, 3, 4, -3, 2, -2, 1, 0])).sort(); - assert(compareArray(sample, [-4, -3, -2, 0, 1, 2, 3, 4]), "negative values"); -}, floatArrayConstructors.concat([Int8Array, Int16Array, Int32Array])); +}, intArrayConstructors, null, ["immutable"]); + +testWithTypedArrayConstructors( + function(TA, makeCtorArg) { + var sample = new TA(makeCtorArg([-4, 3, 4, -3, 2, -2, 1, 0])).sort(); + assert(compareArray(sample, [-4, -3, -2, 0, 1, 2, 3, 4]), "negative values"); + }, + floatArrayConstructors.concat([Int8Array, Int16Array, Int32Array]), + null, + ["immutable"] +); testWithTypedArrayConstructors(function(TA, makeCtorArg) { var sample; @@ -54,4 +59,4 @@ testWithTypedArrayConstructors(function(TA, makeCtorArg) { sample = new TA(makeCtorArg([3, 4, Infinity, -Infinity, 1, 2])).sort(); assert(compareArray(sample, [-Infinity, 1, 2, 3, 4, Infinity]), "infinities"); -}, floatArrayConstructors); +}, floatArrayConstructors, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/subarray/BigInt/result-is-new-instance-with-shared-buffer.js b/third_party/test262/test/built-ins/TypedArray/prototype/subarray/BigInt/result-is-new-instance-with-shared-buffer.js index ee707f522b3ba0..83f95a08a15fa8 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/subarray/BigInt/result-is-new-instance-with-shared-buffer.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/subarray/BigInt/result-is-new-instance-with-shared-buffer.js @@ -32,4 +32,4 @@ testWithBigIntTypedArrayConstructors(function(TA, makeCtorArg) { compareArray(sample, [40n, 100n, 111n, 43n]), "changes on the new instance values affect the original sample" ); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/subarray/result-is-new-instance-with-shared-buffer.js b/third_party/test262/test/built-ins/TypedArray/prototype/subarray/result-is-new-instance-with-shared-buffer.js index d250c89ca88748..e9a110669bee20 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/subarray/result-is-new-instance-with-shared-buffer.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/subarray/result-is-new-instance-with-shared-buffer.js @@ -32,4 +32,4 @@ testWithTypedArrayConstructors(function(TA, makeCtorArg) { compareArray(sample, [40, 100, 111, 43]), "changes on the new instance values affect the original sample" ); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/with/BigInt/early-type-coercion-bigint.js b/third_party/test262/test/built-ins/TypedArray/prototype/with/BigInt/early-type-coercion-bigint.js index 3228caf9b17ef1..9c479854f48e06 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/with/BigInt/early-type-coercion-bigint.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/with/BigInt/early-type-coercion-bigint.js @@ -28,4 +28,4 @@ testWithBigIntTypedArrayConstructors(function(TA, makeCtorArg) { assert.compareArray(arr.with(1, value), [3n, 4n, 2n]); assert.compareArray(arr, [3n, 1n, 2n]); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArray/prototype/with/early-type-coercion.js b/third_party/test262/test/built-ins/TypedArray/prototype/with/early-type-coercion.js index f2217818279b02..3dacee28b5a2c9 100644 --- a/third_party/test262/test/built-ins/TypedArray/prototype/with/early-type-coercion.js +++ b/third_party/test262/test/built-ins/TypedArray/prototype/with/early-type-coercion.js @@ -28,4 +28,4 @@ testWithTypedArrayConstructors((TA, makeCtorArg) => { assert.compareArray(arr.with(1, value), [3, 4, 2]); assert.compareArray(arr, [3, 1, 2]); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArrayConstructors/from/BigInt/custom-ctor-returns-other-instance.js b/third_party/test262/test/built-ins/TypedArrayConstructors/from/BigInt/custom-ctor-returns-other-instance.js index 3281dad98bbd32..56bd94303552bb 100644 --- a/third_party/test262/test/built-ins/TypedArrayConstructors/from/BigInt/custom-ctor-returns-other-instance.js +++ b/third_party/test262/test/built-ins/TypedArrayConstructors/from/BigInt/custom-ctor-returns-other-instance.js @@ -49,4 +49,4 @@ testWithBigIntTypedArrayConstructors(function(TA, makeCtorArg) { result = TypedArray.from.call(ctor, sourceObj); assert.sameValue(result, custom, "not using iterator, higher length"); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArrayConstructors/from/custom-ctor-returns-immutable-arraybuffer.js b/third_party/test262/test/built-ins/TypedArrayConstructors/from/custom-ctor-returns-immutable-arraybuffer.js new file mode 100644 index 00000000000000..54e33ba2e1bbf6 --- /dev/null +++ b/third_party/test262/test/built-ins/TypedArrayConstructors/from/custom-ctor-returns-immutable-arraybuffer.js @@ -0,0 +1,146 @@ +// Copyright (C) 2025 Richard Gibson. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-%typedarray%.from +description: > + Throws a TypeError if species constructor returns an immutable ArrayBuffer. +info: | + %TypedArray%.from ( source [ , mapper [ , thisArg ] ] ) + 1. Let C be the this value. + 2. If IsConstructor(C) is false, throw a TypeError exception. + 3. If mapper is undefined, then + a. Let mapping be false. + 4. Else, + a. If IsCallable(mapper) is false, throw a TypeError exception. + b. Let mapping be true. + 5. Let usingIterator be ? GetMethod(source, %Symbol.iterator%). + 6. If usingIterator is not undefined, then + a. Let values be ? IteratorToList(? GetIteratorFromMethod(source, usingIterator)). + b. Let len be the number of elements in values. + c. Let targetObj be ? TypedArrayCreateFromConstructor(C, ยซ ๐”ฝ(len) ยป, write). + d. Let k be 0. + e. Repeat, while k < len, + i. Let Pk be ! ToString(๐”ฝ(k)). + ii. Let kValue be the first element of values. + iii. Remove the first element from values. + iv. If mapping is true, then + 1. Let mappedValue be ? Call(mapper, thisArg, ยซ kValue, ๐”ฝ(k) ยป). + v. Else, + 1. Let mappedValue be kValue. + vi. Perform ? Set(targetObj, Pk, mappedValue, true). + vii. Set k to k + 1. + f. Assert: values is now an empty List. + g. Return targetObj. + 7. NOTE: source is not an iterable object, so assume it is already an array-like object. + 8. Let arrayLike be ! ToObject(source). + 9. Let len be ? LengthOfArrayLike(arrayLike). + 10. Let targetObj be ? TypedArrayCreateFromConstructor(C, ยซ ๐”ฝ(len) ยป, write). + 11. Let k be 0. + 12. Repeat, while k < len, + a. Let Pk be ! ToString(๐”ฝ(k)). + b. Let kValue be ? Get(arrayLike, Pk). + c. If mapping is true, then + i. Let mappedValue be ? Call(mapper, thisArg, ยซ kValue, ๐”ฝ(k) ยป). +features: [Symbol.iterator, TypedArray, immutable-arraybuffer] +includes: [testTypedArray.js, compareArray.js] +---*/ + +testWithAllTypedArrayConstructors((TA, makeCtorArg) => { + var calls = []; + var expectCalls = []; + + var custom = new TA(makeCtorArg(2)); + var ctor = function(len) { + calls.push("construct(" + len + ")"); + return custom; + }; + var mapper = function(value, index) { + calls.push("map index " + index); + return value + value; + }; + + // arraylike source + calls = []; + var srcArraylike = { + get length() { + calls.push("get source.length"); + return 1; + }, + get 0() { + calls.push("get source[0]"); + return "8"; + } + }; + Object.defineProperty(srcArraylike, Symbol.iterator, { + get: function() { + calls.push("get source[Symbol.iterator]"); + return undefined; + } + }); + assert.throws(TypeError, function() { + TA.from.call(ctor, srcArraylike, mapper); + }, "arraylike source"); + expectCalls = [ + "get source[Symbol.iterator]", + "get source.length", + "construct(1)" + ]; + assert.compareArray(calls, expectCalls, + "Must construct the result before visiting arraylike source elements."); + + // iterable source + calls = []; + var srcIterable = Object.defineProperty({}, Symbol.iterator, { + get: function() { + calls.push("get source[Symbol.iterator]"); + function getIterator() { + calls.push("call source[Symbol.iterator]"); + var itor = { + get next() { + calls.push("get source iterator.next"); + var iterationResults = [ + { done: false, value: "4", msg: "yield 4" }, + { done: true, value: "8", msg: "done" }, + { done: true, value: "9", msg: "unexpected" } + ]; + function next() { + var result = iterationResults.shift(); + calls.push("source iterator " + result.msg); + var resultSpy = { + get done() { + calls.push("get iterationResult.done " + result.done); + return result.done; + }, + get value() { + calls.push("get iterationResult.value " + result.value); + return result.value; + } + }; + return resultSpy; + }; + return next; + } + }; + return itor; + } + return getIterator; + } + }); + assert.throws(TypeError, function() { + TA.from.call(ctor, srcIterable, mapper); + }, "iterable source"); + expectCalls = [ + "get source[Symbol.iterator]", + "call source[Symbol.iterator]", + "get source iterator.next", + "source iterator yield 4", + "get iterationResult.done false", + "get iterationResult.value 4", + "source iterator done", + "get iterationResult.done true", + "construct(1)" + ]; + assert.compareArray(calls, expectCalls, + "Must construct the result before visiting iterable source elements."); +}, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArrayConstructors/from/custom-ctor-returns-other-instance.js b/third_party/test262/test/built-ins/TypedArrayConstructors/from/custom-ctor-returns-other-instance.js index 82a769a4865a3e..8d490623a4cf36 100644 --- a/third_party/test262/test/built-ins/TypedArrayConstructors/from/custom-ctor-returns-other-instance.js +++ b/third_party/test262/test/built-ins/TypedArrayConstructors/from/custom-ctor-returns-other-instance.js @@ -47,4 +47,4 @@ testWithTypedArrayConstructors(function(TA, makeCtorArg) { result = TypedArray.from.call(ctor, sourceObj); assert.sameValue(result, custom, "not using iterator, higher length"); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArrayConstructors/internals/DefineOwnProperty/conversion-operation-consistent-nan.js b/third_party/test262/test/built-ins/TypedArrayConstructors/internals/DefineOwnProperty/conversion-operation-consistent-nan.js index 492002f2fb2cf5..26b4b1a31c44c4 100644 --- a/third_party/test262/test/built-ins/TypedArrayConstructors/internals/DefineOwnProperty/conversion-operation-consistent-nan.js +++ b/third_party/test262/test/built-ins/TypedArrayConstructors/internals/DefineOwnProperty/conversion-operation-consistent-nan.js @@ -94,5 +94,4 @@ testWithTypedArrayConstructors(function(FA, makeCtorArg) { ); } } -}, floatArrayConstructors); - +}, floatArrayConstructors, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArrayConstructors/internals/Set/BigInt/boolean-tobigint.js b/third_party/test262/test/built-ins/TypedArrayConstructors/internals/Set/BigInt/boolean-tobigint.js index 53680e92cbefc5..40ebe0115c4e0a 100644 --- a/third_party/test262/test/built-ins/TypedArrayConstructors/internals/Set/BigInt/boolean-tobigint.js +++ b/third_party/test262/test/built-ins/TypedArrayConstructors/internals/Set/BigInt/boolean-tobigint.js @@ -56,4 +56,4 @@ testWithBigIntTypedArrayConstructors(function(TA, makeCtorArg) { typedArray[1] = true; assert.sameValue(typedArray[0], 0n, 'The value of typedArray[0] is 0n'); assert.sameValue(typedArray[1], 1n, 'The value of typedArray[1] is 1n'); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArrayConstructors/internals/Set/BigInt/key-is-minus-zero.js b/third_party/test262/test/built-ins/TypedArrayConstructors/internals/Set/BigInt/key-is-minus-zero.js index 69cd7d7ec5a9f8..f8529f8b675967 100644 --- a/third_party/test262/test/built-ins/TypedArrayConstructors/internals/Set/BigInt/key-is-minus-zero.js +++ b/third_party/test262/test/built-ins/TypedArrayConstructors/internals/Set/BigInt/key-is-minus-zero.js @@ -21,4 +21,4 @@ testWithBigIntTypedArrayConstructors(function(TA, makeCtorArg) { var sample = new TA(makeCtorArg([42n])); assert.sameValue(Reflect.set(sample, '-0', 1n), true, 'Reflect.set("new TA(makeCtorArg([42n]))", "-0", 1n) must return true'); assert.sameValue(sample.hasOwnProperty('-0'), false, 'sample.hasOwnProperty("-0") must return false'); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArrayConstructors/internals/Set/BigInt/key-is-not-integer.js b/third_party/test262/test/built-ins/TypedArrayConstructors/internals/Set/BigInt/key-is-not-integer.js index 73a5a66c61a43e..a450c4a5c17926 100644 --- a/third_party/test262/test/built-ins/TypedArrayConstructors/internals/Set/BigInt/key-is-not-integer.js +++ b/third_party/test262/test/built-ins/TypedArrayConstructors/internals/Set/BigInt/key-is-not-integer.js @@ -30,4 +30,4 @@ testWithBigIntTypedArrayConstructors(function(TA, makeCtorArg) { assert.sameValue(sample.hasOwnProperty('1.1'), false, 'sample.hasOwnProperty("1.1") must return false'); assert.sameValue(sample.hasOwnProperty('0.0001'), false, 'sample.hasOwnProperty("0.0001") must return false'); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArrayConstructors/internals/Set/BigInt/key-is-out-of-bounds.js b/third_party/test262/test/built-ins/TypedArrayConstructors/internals/Set/BigInt/key-is-out-of-bounds.js index e62d524add2331..08d15742b76015 100644 --- a/third_party/test262/test/built-ins/TypedArrayConstructors/internals/Set/BigInt/key-is-out-of-bounds.js +++ b/third_party/test262/test/built-ins/TypedArrayConstructors/internals/Set/BigInt/key-is-out-of-bounds.js @@ -32,4 +32,4 @@ testWithBigIntTypedArrayConstructors(function(TA, makeCtorArg) { assert.sameValue(sample.hasOwnProperty('-1'), false, 'sample.hasOwnProperty("-1") must return false'); assert.sameValue(sample.hasOwnProperty('1'), false, 'sample.hasOwnProperty("1") must return false'); assert.sameValue(sample.hasOwnProperty('2'), false, 'sample.hasOwnProperty("2") must return false'); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArrayConstructors/internals/Set/BigInt/string-tobigint.js b/third_party/test262/test/built-ins/TypedArrayConstructors/internals/Set/BigInt/string-tobigint.js index 2e2ce86fdf9109..e7cb51c0237a5c 100644 --- a/third_party/test262/test/built-ins/TypedArrayConstructors/internals/Set/BigInt/string-tobigint.js +++ b/third_party/test262/test/built-ins/TypedArrayConstructors/internals/Set/BigInt/string-tobigint.js @@ -82,4 +82,4 @@ testWithBigIntTypedArrayConstructors(function(TA, makeCtorArg) { assert.throws(SyntaxError, function() { typedArray[0] = '1e7'; }, '`typedArray[0] = "1e7"` throws SyntaxError'); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArrayConstructors/internals/Set/conversion-operation-consistent-nan.js b/third_party/test262/test/built-ins/TypedArrayConstructors/internals/Set/conversion-operation-consistent-nan.js index a814e27c644248..c04983de4b63e8 100644 --- a/third_party/test262/test/built-ins/TypedArrayConstructors/internals/Set/conversion-operation-consistent-nan.js +++ b/third_party/test262/test/built-ins/TypedArrayConstructors/internals/Set/conversion-operation-consistent-nan.js @@ -101,5 +101,4 @@ testWithTypedArrayConstructors(function(FA, makeCtorArg) { ); } } -}, floatArrayConstructors); - +}, floatArrayConstructors, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArrayConstructors/internals/Set/key-is-minus-zero.js b/third_party/test262/test/built-ins/TypedArrayConstructors/internals/Set/key-is-minus-zero.js index 4b2912c8377553..680d2eb95b2d35 100644 --- a/third_party/test262/test/built-ins/TypedArrayConstructors/internals/Set/key-is-minus-zero.js +++ b/third_party/test262/test/built-ins/TypedArrayConstructors/internals/Set/key-is-minus-zero.js @@ -24,4 +24,4 @@ testWithTypedArrayConstructors(function(TA, makeCtorArg) { assert.sameValue(Reflect.set(sample, "-0", 1), true, 'Reflect.set(sample, "-0", 1) must return true'); assert.sameValue(sample.hasOwnProperty("-0"), false, 'sample.hasOwnProperty("-0") must return false'); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArrayConstructors/internals/Set/key-is-not-integer.js b/third_party/test262/test/built-ins/TypedArrayConstructors/internals/Set/key-is-not-integer.js index 59c2f16efb6eef..663f628927ac1f 100644 --- a/third_party/test262/test/built-ins/TypedArrayConstructors/internals/Set/key-is-not-integer.js +++ b/third_party/test262/test/built-ins/TypedArrayConstructors/internals/Set/key-is-not-integer.js @@ -31,4 +31,4 @@ testWithTypedArrayConstructors(function(TA, makeCtorArg) { false, 'sample.hasOwnProperty("0.0001") must return false' ); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArrayConstructors/internals/Set/key-is-out-of-bounds.js b/third_party/test262/test/built-ins/TypedArrayConstructors/internals/Set/key-is-out-of-bounds.js index 702e89e842075a..f5c073e5d1f9e2 100644 --- a/third_party/test262/test/built-ins/TypedArrayConstructors/internals/Set/key-is-out-of-bounds.js +++ b/third_party/test262/test/built-ins/TypedArrayConstructors/internals/Set/key-is-out-of-bounds.js @@ -29,4 +29,4 @@ testWithTypedArrayConstructors(function(TA, makeCtorArg) { assert.sameValue(sample.hasOwnProperty("-1"), false, 'sample.hasOwnProperty("-1") must return false'); assert.sameValue(sample.hasOwnProperty("1"), false, 'sample.hasOwnProperty("1") must return false'); assert.sameValue(sample.hasOwnProperty("2"), false, 'sample.hasOwnProperty("2") must return false'); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArrayConstructors/of/BigInt/custom-ctor-returns-other-instance.js b/third_party/test262/test/built-ins/TypedArrayConstructors/of/BigInt/custom-ctor-returns-other-instance.js index a893232a95ccb0..b0adf28e2e66e5 100644 --- a/third_party/test262/test/built-ins/TypedArrayConstructors/of/BigInt/custom-ctor-returns-other-instance.js +++ b/third_party/test262/test/built-ins/TypedArrayConstructors/of/BigInt/custom-ctor-returns-other-instance.js @@ -29,4 +29,4 @@ testWithBigIntTypedArrayConstructors(function(TA, makeCtorArg) { result = TypedArray.of.call(ctor, 1n, 2n); assert.sameValue(result, custom, "using iterator, higher length"); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArrayConstructors/of/custom-ctor-returns-immutable-arraybuffer.js b/third_party/test262/test/built-ins/TypedArrayConstructors/of/custom-ctor-returns-immutable-arraybuffer.js new file mode 100644 index 00000000000000..e7a8b50ea500b5 --- /dev/null +++ b/third_party/test262/test/built-ins/TypedArrayConstructors/of/custom-ctor-returns-immutable-arraybuffer.js @@ -0,0 +1,49 @@ +// Copyright (C) 2025 Richard Gibson. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-%typedarray%.of +description: > + Throws a TypeError if species constructor returns an immutable ArrayBuffer. +info: | + %TypedArray%.of ( ...items ) + 1. Let len be the number of elements in items. + 2. Let C be the this value. + 3. If IsConstructor(C) is false, throw a TypeError exception. + 4. Let newObj be ? TypedArrayCreateFromConstructor(C, ยซ ๐”ฝ(len) ยป, write). + 5. Let k be 0. + 6. Repeat, while k < len, + a. Let kValue be items[k]. + b. Let Pk be ! ToString(๐”ฝ(k)). + c. Perform ? Set(newObj, Pk, kValue, true). + d. Set k to k + 1. +features: [Symbol.iterator, TypedArray, immutable-arraybuffer] +includes: [testTypedArray.js, compareArray.js] +---*/ + +testWithAllTypedArrayConstructors((TA, makeCtorArg) => { + var calls = []; + + var custom = new TA(makeCtorArg(2)); + var ctor = function(len) { + calls.push("construct(" + len + ")"); + return custom; + }; + + var a = { + valueOf() { + calls.push("a.valueOf"); + return "1"; + } + }; + var b = { + valueOf() { + calls.push("b.valueOf"); + return "2"; + } + }; + assert.throws(TypeError, function() { + TA.of.call(ctor, a, b); + }, "iterable source"); + assert.compareArray(calls, ["construct(2)"]); +}, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/TypedArrayConstructors/of/custom-ctor-returns-other-instance.js b/third_party/test262/test/built-ins/TypedArrayConstructors/of/custom-ctor-returns-other-instance.js index 8484dc0d760896..12cf8af04b86f8 100644 --- a/third_party/test262/test/built-ins/TypedArrayConstructors/of/custom-ctor-returns-other-instance.js +++ b/third_party/test262/test/built-ins/TypedArrayConstructors/of/custom-ctor-returns-other-instance.js @@ -29,4 +29,4 @@ testWithTypedArrayConstructors(function(TA, makeCtorArg) { result = TypedArray.of.call(ctor, 1, 2); assert.sameValue(result, custom, "using iterator, higher length"); -}); +}, null, null, ["immutable"]); diff --git a/third_party/test262/test/built-ins/Uint8Array/prototype/setFromBase64/throws-when-target-is-backed-by-immutable-arraybuffer.js b/third_party/test262/test/built-ins/Uint8Array/prototype/setFromBase64/throws-when-target-is-backed-by-immutable-arraybuffer.js new file mode 100644 index 00000000000000..2984c2b4e3817e --- /dev/null +++ b/third_party/test262/test/built-ins/Uint8Array/prototype/setFromBase64/throws-when-target-is-backed-by-immutable-arraybuffer.js @@ -0,0 +1,19 @@ +// Copyright (C) 2026 Kevin Gibbons. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-uint8array.prototype.setfrombase64 +description: Uint8Array.prototype.setFromBase64 throws a TypeError when the target is backed by an immutable ArrayBuffer. +features: [ArrayBuffer, TypedArray, uint8array-base64, immutable-arraybuffer] +---*/ + +var iab = (new ArrayBuffer(10)).transferToImmutable(); +var target = new Uint8Array(iab); + +assert.throws(TypeError, function () { + target.setFromBase64('Zg=='); +}); + +assert.throws(TypeError, function () { + target.setFromBase64(''); +}); diff --git a/third_party/test262/test/built-ins/Uint8Array/prototype/setFromHex/throws-when-target-is-backed-by-immutable-arraybuffer.js b/third_party/test262/test/built-ins/Uint8Array/prototype/setFromHex/throws-when-target-is-backed-by-immutable-arraybuffer.js new file mode 100644 index 00000000000000..3b50a13559daad --- /dev/null +++ b/third_party/test262/test/built-ins/Uint8Array/prototype/setFromHex/throws-when-target-is-backed-by-immutable-arraybuffer.js @@ -0,0 +1,19 @@ +// Copyright (C) 2026 Kevin Gibbons. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-uint8array.prototype.setfromhex +description: Uint8Array.prototype.setFromHex throws a TypeError when the target is backed by an immutable ArrayBuffer. +features: [ArrayBuffer, TypedArray, uint8array-base64, immutable-arraybuffer] +---*/ + +var iab = (new ArrayBuffer(10)).transferToImmutable(); +var target = new Uint8Array(iab); + +assert.throws(TypeError, function () { + target.setFromHex('aa'); +}); + +assert.throws(TypeError, function () { + target.setFromHex(''); +}); diff --git a/third_party/test262/test/harness/verifyProperty-value-error.js b/third_party/test262/test/harness/verifyProperty-value-error.js index 26e5f5422ce786..0145243db1603c 100644 --- a/third_party/test262/test/harness/verifyProperty-value-error.js +++ b/third_party/test262/test/harness/verifyProperty-value-error.js @@ -29,7 +29,7 @@ try { ); } - if (err.message !== "obj['prop'] descriptor value should be 2; obj['prop'] value should be 2") { + if (err.message !== "prop descriptor value should be 2; prop value should be 2") { throw new Error('The error thrown did not define the specified message'); } } diff --git a/third_party/test262/test/intl402/DateTimeFormat/constructor-options-calendar-future-fallback.js b/third_party/test262/test/intl402/DateTimeFormat/constructor-options-calendar-future-fallback.js new file mode 100644 index 00000000000000..e524189dca92b4 --- /dev/null +++ b/third_party/test262/test/intl402/DateTimeFormat/constructor-options-calendar-future-fallback.js @@ -0,0 +1,45 @@ +// Copyright (C) 2026 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-intl.datetimeformat +description: > + Tests that fallbacks for not-yet-adopted calendars are selected from one of + the values returned from `AvailableCalendars`. +locale: [en] +includes: [temporalHelpers.js] +features: [Intl.Era-monthcode] +---*/ + +const availableCalendars = [ + "buddhist", + "chinese", + "coptic", + "dangi", + "ethioaa", + "ethiopic", + "gregory", + "hebrew", + "indian", + "islamic-civil", + "islamic-tbla", + "islamic-umalqura", + "iso8601", + "japanese", + "persian", + "roc", +]; + +for (const calendar of TemporalHelpers.NotYetSupportedCalendars) { + const option = new Intl.DateTimeFormat("en", { calendar }); + assert( + availableCalendars.includes(option.resolvedOptions().calendar), + `${calendar} should fall back to an available calendar` + ); + + const uExtension = new Intl.DateTimeFormat(`en-u-ca-${calendar}`); + assert( + availableCalendars.includes(uExtension.resolvedOptions().calendar), + `${calendar} should fall back to an available calendar` + ); +} diff --git a/third_party/test262/test/intl402/Temporal/Duration/prototype/round/rounding-increment-relativeto.js b/third_party/test262/test/intl402/Temporal/Duration/prototype/round/rounding-increment-relativeto.js new file mode 100644 index 00000000000000..b50c5d7e3cb1a3 --- /dev/null +++ b/third_party/test262/test/intl402/Temporal/Duration/prototype/round/rounding-increment-relativeto.js @@ -0,0 +1,16 @@ +// Copyright (C) 2026 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.duration.prototype.round +description: Test a specific buggy case from temporal_rs +includes: [temporalHelpers.js] +features: [Temporal] +---*/ + +const relativeTo = Temporal.ZonedDateTime.from('2025-03-09T03:00:00-07:00[America/Vancouver]'); +TemporalHelpers.assertDuration(new Temporal.Duration(0, 1, 0, 30).round({ + smallestUnit: "months", + roundingIncrement: 2, + relativeTo, +}), 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, `1m30d to 2m with relativeTo 2025-03-09T03:00:00-07:00[America/Vancouver]`); diff --git a/third_party/test262/test/intl402/Temporal/PlainDate/compare/future-calendar.js b/third_party/test262/test/intl402/Temporal/PlainDate/compare/future-calendar.js new file mode 100644 index 00000000000000..91e02b7e67e855 --- /dev/null +++ b/third_party/test262/test/intl402/Temporal/PlainDate/compare/future-calendar.js @@ -0,0 +1,26 @@ +// Copyright (C) 2026 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindate.compare +description: Not-yet-adopted calendar IDs are rejected +includes: [temporalHelpers.js] +features: [Intl.Era-monthcode, Temporal] +---*/ + +const okDate = new Temporal.PlainDate(1970, 1, 1); + +for (const calendar of TemporalHelpers.NotYetSupportedCalendars) { + assert.throws(RangeError, function () { + Temporal.PlainDate.compare(`1970-01-01[u-ca=${calendar}]`, okDate); + }, `${calendar} is not yet supported (first argument, string)`); + assert.throws(RangeError, function () { + Temporal.PlainDate.compare({ year: 1970, month: 1, day: 1, calendar }, okDate); + }, `${calendar} is not yet supported (first argument, property bag)`); + assert.throws(RangeError, function () { + Temporal.PlainDate.compare(okDate, `1970-01-01[u-ca=${calendar}]`); + }, `${calendar} is not yet supported (second argument, string)`); + assert.throws(RangeError, function () { + Temporal.PlainDate.compare(okDate, { year: 1970, month: 1, day: 1, calendar }); + }, `${calendar} is not yet supported (second argument, property bag)`); +} diff --git a/third_party/test262/test/intl402/Temporal/PlainDate/from/future-calendar.js b/third_party/test262/test/intl402/Temporal/PlainDate/from/future-calendar.js new file mode 100644 index 00000000000000..c34c2013672bef --- /dev/null +++ b/third_party/test262/test/intl402/Temporal/PlainDate/from/future-calendar.js @@ -0,0 +1,18 @@ +// Copyright (C) 2026 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindate.from +description: Not-yet-adopted calendar IDs are rejected +includes: [temporalHelpers.js] +features: [Intl.Era-monthcode, Temporal] +---*/ + +for (const calendar of TemporalHelpers.NotYetSupportedCalendars) { + assert.throws(RangeError, function () { + Temporal.PlainDate.from(`1970-01-01[u-ca=${calendar}]`); + }, `${calendar} is not yet supported (string)`); + assert.throws(RangeError, function () { + Temporal.PlainDate.from({ year: 1970, month: 1, day: 1, calendar }); + }, `${calendar} is not yet supported (property bag)`); +} diff --git a/third_party/test262/test/intl402/Temporal/PlainDate/future-calendar.js b/third_party/test262/test/intl402/Temporal/PlainDate/future-calendar.js new file mode 100644 index 00000000000000..74815358e0dd6d --- /dev/null +++ b/third_party/test262/test/intl402/Temporal/PlainDate/future-calendar.js @@ -0,0 +1,15 @@ +// Copyright (C) 2026 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindate +description: Not-yet-adopted calendar IDs are rejected +includes: [temporalHelpers.js] +features: [Intl.Era-monthcode, Temporal] +---*/ + +for (const calendar of TemporalHelpers.NotYetSupportedCalendars) { + assert.throws(RangeError, function () { + new Temporal.PlainDate(1970, 1, 1, calendar); + }, `${calendar} is not yet supported`); +} diff --git a/third_party/test262/test/intl402/Temporal/PlainDate/prototype/equals/future-calendar.js b/third_party/test262/test/intl402/Temporal/PlainDate/prototype/equals/future-calendar.js new file mode 100644 index 00000000000000..045201b56b33a0 --- /dev/null +++ b/third_party/test262/test/intl402/Temporal/PlainDate/prototype/equals/future-calendar.js @@ -0,0 +1,20 @@ +// Copyright (C) 2026 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindate.prototype.equals +description: Not-yet-adopted calendar IDs are rejected +includes: [temporalHelpers.js] +features: [Intl.Era-monthcode, Temporal] +---*/ + +const okDate = new Temporal.PlainDate(1970, 1, 1); + +for (const calendar of TemporalHelpers.NotYetSupportedCalendars) { + assert.throws(RangeError, function () { + okDate.equals(`1970-01-01[u-ca=${calendar}]`); + }, `${calendar} is not yet supported (string)`); + assert.throws(RangeError, function () { + okDate.equals({ year: 1970, month: 1, day: 1, calendar }); + }, `${calendar} is not yet supported (property bag)`); +} diff --git a/third_party/test262/test/intl402/Temporal/PlainDate/prototype/withCalendar/future-calendar.js b/third_party/test262/test/intl402/Temporal/PlainDate/prototype/withCalendar/future-calendar.js new file mode 100644 index 00000000000000..6ef223a8aeeb63 --- /dev/null +++ b/third_party/test262/test/intl402/Temporal/PlainDate/prototype/withCalendar/future-calendar.js @@ -0,0 +1,17 @@ +// Copyright (C) 2026 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindate.prototype.withcalendar +description: Not-yet-adopted calendar IDs are rejected +includes: [temporalHelpers.js] +features: [Intl.Era-monthcode, Temporal] +---*/ + +const okDate = new Temporal.PlainDate(1970, 1, 1); + +for (const calendar of TemporalHelpers.NotYetSupportedCalendars) { + assert.throws(RangeError, function () { + okDate.withCalendar(calendar); + }, `${calendar} is not yet supported`); +} diff --git a/third_party/test262/test/intl402/Temporal/PlainDateTime/compare/future-calendar.js b/third_party/test262/test/intl402/Temporal/PlainDateTime/compare/future-calendar.js new file mode 100644 index 00000000000000..fdfe8f7f8b6c03 --- /dev/null +++ b/third_party/test262/test/intl402/Temporal/PlainDateTime/compare/future-calendar.js @@ -0,0 +1,26 @@ +// Copyright (C) 2026 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindatetime.compare +description: Not-yet-adopted calendar IDs are rejected +includes: [temporalHelpers.js] +features: [Intl.Era-monthcode, Temporal] +---*/ + +const okDate = new Temporal.PlainDateTime(1970, 1, 1); + +for (const calendar of TemporalHelpers.NotYetSupportedCalendars) { + assert.throws(RangeError, function () { + Temporal.PlainDateTime.compare(`1970-01-01[u-ca=${calendar}]`, okDate); + }, `${calendar} is not yet supported (first argument, string)`); + assert.throws(RangeError, function () { + Temporal.PlainDateTime.compare({ year: 1970, month: 1, day: 1, calendar }, okDate); + }, `${calendar} is not yet supported (first argument, property bag)`); + assert.throws(RangeError, function () { + Temporal.PlainDateTime.compare(okDate, `1970-01-01[u-ca=${calendar}]`); + }, `${calendar} is not yet supported (second argument, string)`); + assert.throws(RangeError, function () { + Temporal.PlainDateTime.compare(okDate, { year: 1970, month: 1, day: 1, calendar }); + }, `${calendar} is not yet supported (second argument, property bag)`); +} diff --git a/third_party/test262/test/intl402/Temporal/PlainDateTime/from/future-calendar.js b/third_party/test262/test/intl402/Temporal/PlainDateTime/from/future-calendar.js new file mode 100644 index 00000000000000..ef2a5b4391ab11 --- /dev/null +++ b/third_party/test262/test/intl402/Temporal/PlainDateTime/from/future-calendar.js @@ -0,0 +1,18 @@ +// Copyright (C) 2026 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindatetime.from +description: Not-yet-adopted calendar IDs are rejected +includes: [temporalHelpers.js] +features: [Intl.Era-monthcode, Temporal] +---*/ + +for (const calendar of TemporalHelpers.NotYetSupportedCalendars) { + assert.throws(RangeError, function () { + Temporal.PlainDateTime.from(`1970-01-01[u-ca=${calendar}]`); + }, `${calendar} is not yet supported (string)`); + assert.throws(RangeError, function () { + Temporal.PlainDateTime.from({ year: 1970, month: 1, day: 1, calendar }); + }, `${calendar} is not yet supported (property bag)`); +} diff --git a/third_party/test262/test/intl402/Temporal/PlainDateTime/future-calendar.js b/third_party/test262/test/intl402/Temporal/PlainDateTime/future-calendar.js new file mode 100644 index 00000000000000..7a8e28cb9bec54 --- /dev/null +++ b/third_party/test262/test/intl402/Temporal/PlainDateTime/future-calendar.js @@ -0,0 +1,15 @@ +// Copyright (C) 2026 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindatetime +description: Not-yet-adopted calendar IDs are rejected +includes: [temporalHelpers.js] +features: [Intl.Era-monthcode, Temporal] +---*/ + +for (const calendar of TemporalHelpers.NotYetSupportedCalendars) { + assert.throws(RangeError, function () { + new Temporal.PlainDateTime(1970, 1, 1, 0, 0, 0, 0, 0, 0, calendar); + }, `${calendar} is not yet supported`); +} diff --git a/third_party/test262/test/intl402/Temporal/PlainDateTime/prototype/equals/future-calendar.js b/third_party/test262/test/intl402/Temporal/PlainDateTime/prototype/equals/future-calendar.js new file mode 100644 index 00000000000000..edbbd5ba0df1c4 --- /dev/null +++ b/third_party/test262/test/intl402/Temporal/PlainDateTime/prototype/equals/future-calendar.js @@ -0,0 +1,20 @@ +// Copyright (C) 2026 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindatetime.prototype.equals +description: Not-yet-adopted calendar IDs are rejected +includes: [temporalHelpers.js] +features: [Intl.Era-monthcode, Temporal] +---*/ + +const okDate = new Temporal.PlainDateTime(1970, 1, 1); + +for (const calendar of TemporalHelpers.NotYetSupportedCalendars) { + assert.throws(RangeError, function () { + okDate.equals(`1970-01-01[u-ca=${calendar}]`); + }, `${calendar} is not yet supported (string)`); + assert.throws(RangeError, function () { + okDate.equals({ year: 1970, month: 1, day: 1, calendar }); + }, `${calendar} is not yet supported (property bag)`); +} diff --git a/third_party/test262/test/intl402/Temporal/PlainDateTime/prototype/withCalendar/future-calendar.js b/third_party/test262/test/intl402/Temporal/PlainDateTime/prototype/withCalendar/future-calendar.js new file mode 100644 index 00000000000000..3c04c90f8891f3 --- /dev/null +++ b/third_party/test262/test/intl402/Temporal/PlainDateTime/prototype/withCalendar/future-calendar.js @@ -0,0 +1,17 @@ +// Copyright (C) 2026 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindatetime.prototype.withcalendar +description: Not-yet-adopted calendar IDs are rejected +includes: [temporalHelpers.js] +features: [Intl.Era-monthcode, Temporal] +---*/ + +const okDate = new Temporal.PlainDateTime(1970, 1, 1); + +for (const calendar of TemporalHelpers.NotYetSupportedCalendars) { + assert.throws(RangeError, function () { + okDate.withCalendar(calendar); + }, `${calendar} is not yet supported`); +} diff --git a/third_party/test262/test/intl402/Temporal/PlainMonthDay/from/future-calendar.js b/third_party/test262/test/intl402/Temporal/PlainMonthDay/from/future-calendar.js new file mode 100644 index 00000000000000..67822b6486ab91 --- /dev/null +++ b/third_party/test262/test/intl402/Temporal/PlainMonthDay/from/future-calendar.js @@ -0,0 +1,18 @@ +// Copyright (C) 2026 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plainmonthday.from +description: Not-yet-adopted calendar IDs are rejected +includes: [temporalHelpers.js] +features: [Intl.Era-monthcode, Temporal] +---*/ + +for (const calendar of TemporalHelpers.NotYetSupportedCalendars) { + assert.throws(RangeError, function () { + Temporal.PlainMonthDay.from(`1970-01-01[u-ca=${calendar}]`); + }, `${calendar} is not yet supported (string)`); + assert.throws(RangeError, function () { + Temporal.PlainMonthDay.from({ monthCode: "M01", day: 1, calendar }); + }, `${calendar} is not yet supported (property bag)`); +} diff --git a/third_party/test262/test/intl402/Temporal/PlainMonthDay/future-calendar.js b/third_party/test262/test/intl402/Temporal/PlainMonthDay/future-calendar.js new file mode 100644 index 00000000000000..3e790b941712dc --- /dev/null +++ b/third_party/test262/test/intl402/Temporal/PlainMonthDay/future-calendar.js @@ -0,0 +1,15 @@ +// Copyright (C) 2026 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plainmonthday +description: Not-yet-adopted calendar IDs are rejected +includes: [temporalHelpers.js] +features: [Intl.Era-monthcode, Temporal] +---*/ + +for (const calendar of TemporalHelpers.NotYetSupportedCalendars) { + assert.throws(RangeError, function () { + new Temporal.PlainMonthDay(1, 1, calendar, 1970); + }, `${calendar} is not yet supported`); +} diff --git a/third_party/test262/test/intl402/Temporal/PlainMonthDay/prototype/equals/future-calendar.js b/third_party/test262/test/intl402/Temporal/PlainMonthDay/prototype/equals/future-calendar.js new file mode 100644 index 00000000000000..cada985c9227cf --- /dev/null +++ b/third_party/test262/test/intl402/Temporal/PlainMonthDay/prototype/equals/future-calendar.js @@ -0,0 +1,20 @@ +// Copyright (C) 2026 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plainmonthday.prototype.equals +description: Not-yet-adopted calendar IDs are rejected +includes: [temporalHelpers.js] +features: [Intl.Era-monthcode, Temporal] +---*/ + +const okDate = new Temporal.PlainMonthDay(1, 1); + +for (const calendar of TemporalHelpers.NotYetSupportedCalendars) { + assert.throws(RangeError, function () { + okDate.equals(`1970-01-01[u-ca=${calendar}]`); + }, `${calendar} is not yet supported (string)`); + assert.throws(RangeError, function () { + okDate.equals({ monthCode: "M01", day: 1, calendar }); + }, `${calendar} is not yet supported (property bag)`); +} diff --git a/third_party/test262/test/intl402/Temporal/PlainYearMonth/compare/future-calendar.js b/third_party/test262/test/intl402/Temporal/PlainYearMonth/compare/future-calendar.js new file mode 100644 index 00000000000000..b866e7675ba91f --- /dev/null +++ b/third_party/test262/test/intl402/Temporal/PlainYearMonth/compare/future-calendar.js @@ -0,0 +1,26 @@ +// Copyright (C) 2026 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plainyearmonth.compare +description: Not-yet-adopted calendar IDs are rejected +includes: [temporalHelpers.js] +features: [Intl.Era-monthcode, Temporal] +---*/ + +const okDate = new Temporal.PlainYearMonth(1970, 1); + +for (const calendar of TemporalHelpers.NotYetSupportedCalendars) { + assert.throws(RangeError, function () { + Temporal.PlainYearMonth.compare(`1970-01-01[u-ca=${calendar}]`, okDate); + }, `${calendar} is not yet supported (first argument, string)`); + assert.throws(RangeError, function () { + Temporal.PlainYearMonth.compare({ year: 1970, month: 1, calendar }, okDate); + }, `${calendar} is not yet supported (first argument, property bag)`); + assert.throws(RangeError, function () { + Temporal.PlainYearMonth.compare(okDate, `1970-01-01[u-ca=${calendar}]`); + }, `${calendar} is not yet supported (second argument, string)`); + assert.throws(RangeError, function () { + Temporal.PlainYearMonth.compare(okDate, { year: 1970, month: 1, calendar }); + }, `${calendar} is not yet supported (second argument, property bag)`); +} diff --git a/third_party/test262/test/intl402/Temporal/PlainYearMonth/from/future-calendar.js b/third_party/test262/test/intl402/Temporal/PlainYearMonth/from/future-calendar.js new file mode 100644 index 00000000000000..7b5f62bfbd7d7c --- /dev/null +++ b/third_party/test262/test/intl402/Temporal/PlainYearMonth/from/future-calendar.js @@ -0,0 +1,18 @@ +// Copyright (C) 2026 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plainyearmonth.from +description: Not-yet-adopted calendar IDs are rejected +includes: [temporalHelpers.js] +features: [Intl.Era-monthcode, Temporal] +---*/ + +for (const calendar of TemporalHelpers.NotYetSupportedCalendars) { + assert.throws(RangeError, function () { + Temporal.PlainYearMonth.from(`1970-01-01[u-ca=${calendar}]`); + }, `${calendar} is not yet supported (string)`); + assert.throws(RangeError, function () { + Temporal.PlainYearMonth.from({ year: 1970, month: 1, calendar }); + }, `${calendar} is not yet supported (property bag)`); +} diff --git a/third_party/test262/test/intl402/Temporal/PlainYearMonth/future-calendar.js b/third_party/test262/test/intl402/Temporal/PlainYearMonth/future-calendar.js new file mode 100644 index 00000000000000..88cd89d014f0c7 --- /dev/null +++ b/third_party/test262/test/intl402/Temporal/PlainYearMonth/future-calendar.js @@ -0,0 +1,15 @@ +// Copyright (C) 2026 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plainyearmonth +description: Not-yet-adopted calendar IDs are rejected +includes: [temporalHelpers.js] +features: [Intl.Era-monthcode, Temporal] +---*/ + +for (const calendar of TemporalHelpers.NotYetSupportedCalendars) { + assert.throws(RangeError, function () { + new Temporal.PlainYearMonth(1970, 1, calendar, 1); + }, `${calendar} is not yet supported`); +} diff --git a/third_party/test262/test/intl402/Temporal/PlainYearMonth/prototype/equals/future-calendar.js b/third_party/test262/test/intl402/Temporal/PlainYearMonth/prototype/equals/future-calendar.js new file mode 100644 index 00000000000000..7d348e8008dd74 --- /dev/null +++ b/third_party/test262/test/intl402/Temporal/PlainYearMonth/prototype/equals/future-calendar.js @@ -0,0 +1,20 @@ +// Copyright (C) 2026 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plainyearmonth.prototype.equals +description: Not-yet-adopted calendar IDs are rejected +includes: [temporalHelpers.js] +features: [Intl.Era-monthcode, Temporal] +---*/ + +const okDate = new Temporal.PlainYearMonth(1970, 1); + +for (const calendar of TemporalHelpers.NotYetSupportedCalendars) { + assert.throws(RangeError, function () { + okDate.equals(`1970-01-01[u-ca=${calendar}]`); + }, `${calendar} is not yet supported (string)`); + assert.throws(RangeError, function () { + okDate.equals({ year: 1970, month: 1, calendar }); + }, `${calendar} is not yet supported (property bag)`); +} diff --git a/third_party/test262/test/intl402/Temporal/ZonedDateTime/compare/future-calendar.js b/third_party/test262/test/intl402/Temporal/ZonedDateTime/compare/future-calendar.js new file mode 100644 index 00000000000000..eae30935d5a914 --- /dev/null +++ b/third_party/test262/test/intl402/Temporal/ZonedDateTime/compare/future-calendar.js @@ -0,0 +1,26 @@ +// Copyright (C) 2026 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.zoneddatetime.compare +description: Not-yet-adopted calendar IDs are rejected +includes: [temporalHelpers.js] +features: [Intl.Era-monthcode, Temporal] +---*/ + +const okDate = new Temporal.ZonedDateTime(0n, "UTC"); + +for (const calendar of TemporalHelpers.NotYetSupportedCalendars) { + assert.throws(RangeError, function () { + Temporal.ZonedDateTime.compare(`1970-01-01[UTC][u-ca=${calendar}]`, okDate); + }, `${calendar} is not yet supported (first argument, string)`); + assert.throws(RangeError, function () { + Temporal.ZonedDateTime.compare({ year: 1970, month: 1, day: 1, timeZone: "UTC", calendar }, okDate); + }, `${calendar} is not yet supported (first argument, property bag)`); + assert.throws(RangeError, function () { + Temporal.ZonedDateTime.compare(okDate, `1970-01-01[UTC][u-ca=${calendar}]`); + }, `${calendar} is not yet supported (second argument, string)`); + assert.throws(RangeError, function () { + Temporal.ZonedDateTime.compare(okDate, { year: 1970, month: 1, day: 1, timeZone: "UTC", calendar }); + }, `${calendar} is not yet supported (second argument, property bag)`); +} diff --git a/third_party/test262/test/intl402/Temporal/ZonedDateTime/from/future-calendar.js b/third_party/test262/test/intl402/Temporal/ZonedDateTime/from/future-calendar.js new file mode 100644 index 00000000000000..3cad10c270e947 --- /dev/null +++ b/third_party/test262/test/intl402/Temporal/ZonedDateTime/from/future-calendar.js @@ -0,0 +1,18 @@ +// Copyright (C) 2026 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.zoneddatetime.from +description: Not-yet-adopted calendar IDs are rejected +includes: [temporalHelpers.js] +features: [Intl.Era-monthcode, Temporal] +---*/ + +for (const calendar of TemporalHelpers.NotYetSupportedCalendars) { + assert.throws(RangeError, function () { + Temporal.ZonedDateTime.from(`1970-01-01[UTC][u-ca=${calendar}]`); + }, `${calendar} is not yet supported (string)`); + assert.throws(RangeError, function () { + Temporal.ZonedDateTime.from({ year: 1970, month: 1, day: 1, timeZone: "UTC", calendar }); + }, `${calendar} is not yet supported (property bag)`); +} diff --git a/third_party/test262/test/intl402/Temporal/ZonedDateTime/future-calendar.js b/third_party/test262/test/intl402/Temporal/ZonedDateTime/future-calendar.js new file mode 100644 index 00000000000000..682fbeeeb0d8fa --- /dev/null +++ b/third_party/test262/test/intl402/Temporal/ZonedDateTime/future-calendar.js @@ -0,0 +1,15 @@ +// Copyright (C) 2026 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.zoneddatetime +description: Not-yet-adopted calendar IDs are rejected +includes: [temporalHelpers.js] +features: [Intl.Era-monthcode, Temporal] +---*/ + +for (const calendar of TemporalHelpers.NotYetSupportedCalendars) { + assert.throws(RangeError, function () { + new Temporal.ZonedDateTime(0n, "UTC", calendar); + }, `${calendar} is not yet supported`); +} diff --git a/third_party/test262/test/intl402/Temporal/ZonedDateTime/prototype/equals/future-calendar.js b/third_party/test262/test/intl402/Temporal/ZonedDateTime/prototype/equals/future-calendar.js new file mode 100644 index 00000000000000..66af5eef3825b0 --- /dev/null +++ b/third_party/test262/test/intl402/Temporal/ZonedDateTime/prototype/equals/future-calendar.js @@ -0,0 +1,20 @@ +// Copyright (C) 2026 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.zoneddatetime.prototype.equals +description: Not-yet-adopted calendar IDs are rejected +includes: [temporalHelpers.js] +features: [Intl.Era-monthcode, Temporal] +---*/ + +const okDate = new Temporal.ZonedDateTime(0n, "UTC"); + +for (const calendar of TemporalHelpers.NotYetSupportedCalendars) { + assert.throws(RangeError, function () { + okDate.equals(`1970-01-01[UTC][u-ca=${calendar}]`); + }, `${calendar} is not yet supported (string)`); + assert.throws(RangeError, function () { + okDate.equals({ year: 1970, month: 1, day: 1, timeZone: "UTC", calendar }); + }, `${calendar} is not yet supported (property bag)`); +} diff --git a/third_party/test262/test/intl402/Temporal/ZonedDateTime/prototype/withCalendar/future-calendar.js b/third_party/test262/test/intl402/Temporal/ZonedDateTime/prototype/withCalendar/future-calendar.js new file mode 100644 index 00000000000000..ee1ccd3db0fc24 --- /dev/null +++ b/third_party/test262/test/intl402/Temporal/ZonedDateTime/prototype/withCalendar/future-calendar.js @@ -0,0 +1,17 @@ +// Copyright (C) 2026 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.zoneddatetime.prototype.withcalendar +description: Not-yet-adopted calendar IDs are rejected +includes: [temporalHelpers.js] +features: [Intl.Era-monthcode, Temporal] +---*/ + +const okDate = new Temporal.ZonedDateTime(0n, "UTC"); + +for (const calendar of TemporalHelpers.NotYetSupportedCalendars) { + assert.throws(RangeError, function () { + okDate.withCalendar(calendar); + }, `${calendar} is not yet supported`); +} diff --git a/third_party/test262/test/staging/set-is-subset-of-empty-index.js b/third_party/test262/test/staging/set-is-subset-of-empty-index.js new file mode 100644 index 00000000000000..07706fe9dc0fc9 --- /dev/null +++ b/third_party/test262/test/staging/set-is-subset-of-empty-index.js @@ -0,0 +1,18 @@ +// Copyright (C) 2023 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: https://github.com/tc39/proposal-set-methods/pull/102 +features: [set-methods] +---*/ + +let firstSet = new Set('a', 'b'); +let secondSet = { + size: 3, + has() { + firstSet.delete('b'); + firstSet.add('c'); + return true; + }, + * keys() {} +}; +assert.sameValue(firstSet.isSubsetOf(secondSet), true); diff --git a/third_party/test262/test/staging/sm/Atomics/cross-compartment.js b/third_party/test262/test/staging/sm/Atomics/cross-compartment.js index 2606709b850ad6..4dd3fe77775b65 100644 --- a/third_party/test262/test/staging/sm/Atomics/cross-compartment.js +++ b/third_party/test262/test/staging/sm/Atomics/cross-compartment.js @@ -5,6 +5,7 @@ description: | pending esid: pending +features: [Atomics, SharedArrayBuffer] ---*/ const otherGlobal = $262.createRealm().global; @@ -111,4 +112,3 @@ for (let TA of intArrayConstructors) { assert.sameValue(val, 3); assert.sameValue(ta[0], 2); } - diff --git a/third_party/test262/test/staging/sm/Atomics/detached-buffers.js b/third_party/test262/test/staging/sm/Atomics/detached-buffers.js index 9d0e605c2793c7..d1b1bf3ce31a8e 100644 --- a/third_party/test262/test/staging/sm/Atomics/detached-buffers.js +++ b/third_party/test262/test/staging/sm/Atomics/detached-buffers.js @@ -6,6 +6,7 @@ includes: [detachArrayBuffer.js] description: | pending esid: pending +features: [Atomics] ---*/ const intArrayConstructors = [ @@ -97,4 +98,3 @@ for (let TA of intArrayConstructors) { assert.throws(TypeError, () => Atomics.xor(ta, badValue(ta), 0)); assert.throws(TypeError, () => Atomics.xor(ta, 0, badValue(ta))); } - diff --git a/third_party/test262/test/staging/sm/TypedArray/sort-negative-nan.js b/third_party/test262/test/staging/sm/TypedArray/sort-negative-nan.js index 00e1c6c070c298..c5e0f433017679 100644 --- a/third_party/test262/test/staging/sm/TypedArray/sort-negative-nan.js +++ b/third_party/test262/test/staging/sm/TypedArray/sort-negative-nan.js @@ -6,6 +6,7 @@ includes: [sm/non262-TypedArray-shell.js] description: | pending esid: pending +features: [Float16Array, Float32Array, Float64Array] ---*/ // Test with all floating point typed arrays. const floatConstructors = anyTypedArrayConstructors.filter(isFloatConstructor); @@ -136,4 +137,3 @@ for (const [TA, taLength] of prod(floatConstructors, typedArrayLengths)) { assert.sameValue(fta[nanOffset + i], NaN, `At offset: ${nanOffset + i}`); } } - diff --git a/third_party/test262/test/staging/sm/TypedArray/toString.js b/third_party/test262/test/staging/sm/TypedArray/toString.js index 29adb9038ba34b..2b4d27d99a9067 100644 --- a/third_party/test262/test/staging/sm/TypedArray/toString.js +++ b/third_party/test262/test/staging/sm/TypedArray/toString.js @@ -6,6 +6,7 @@ includes: [sm/non262-TypedArray-shell.js, propertyHelper.js] description: | pending esid: pending +features: [Float16Array] ---*/ const TypedArrayPrototype = Object.getPrototypeOf(Int8Array.prototype); diff --git a/third_party/test262/vendored.toml b/third_party/test262/vendored.toml index 11954844c86b41..37f0ece5273081 100644 --- a/third_party/test262/vendored.toml +++ b/third_party/test262/vendored.toml @@ -1,3 +1,3 @@ [test262] source = "https://github.com/tc39/test262" -rev = "b66872a92487694396fb082343e08dd7cca5ddf4" +rev = "82d777218c1e50d13765d292d97c427811c2ebc1"