diff --git a/test/built-ins/Uint8Array/fromBase64Into/ignores-receiver.js b/test/built-ins/Uint8Array/fromBase64Into/ignores-receiver.js deleted file mode 100644 index 55d3bb96cb..0000000000 --- a/test/built-ins/Uint8Array/fromBase64Into/ignores-receiver.js +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright (C) 2024 Kevin Gibbons. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-uint8array.frombase64into -description: Uint8Array.fromBase64Into ignores its receiver -includes: [compareArray.js] -features: [uint8array-base64] ----*/ - -var fromBase64Into = Uint8Array.fromBase64Into; -var target = new Uint8Array([255, 255, 255]); - -var result = fromBase64Into("Zg==", target); -assert.sameValue(result.read, 4); -assert.sameValue(result.written, 1); -assert.compareArray(target, [102, 255, 255]); diff --git a/test/built-ins/Uint8Array/fromHexInto/ignores-receiver.js b/test/built-ins/Uint8Array/fromHexInto/ignores-receiver.js deleted file mode 100644 index 6c45490d19..0000000000 --- a/test/built-ins/Uint8Array/fromHexInto/ignores-receiver.js +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright (C) 2024 Kevin Gibbons. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-uint8array.fromhexinto -description: Uint8Array.fromHexInto ignores its receiver -includes: [compareArray.js] -features: [uint8array-base64] ----*/ - -var fromHexInto = Uint8Array.fromHexInto; -var target = new Uint8Array([255, 255, 255]); - -var result = fromHexInto("aa", target); -assert.sameValue(result.read, 2); -assert.sameValue(result.written, 1); -assert.compareArray(target, [170, 255, 255]); diff --git a/test/built-ins/Uint8Array/fromBase64Into/alphabet.js b/test/built-ins/Uint8Array/prototype/setFromBase64/alphabet.js similarity index 73% rename from test/built-ins/Uint8Array/fromBase64Into/alphabet.js rename to test/built-ins/Uint8Array/prototype/setFromBase64/alphabet.js index 270396581c..d931f7ca05 100644 --- a/test/built-ins/Uint8Array/fromBase64Into/alphabet.js +++ b/test/built-ins/Uint8Array/prototype/setFromBase64/alphabet.js @@ -1,41 +1,41 @@ // Copyright (C) 2024 Kevin Gibbons. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- -esid: sec-uint8array.frombase64into +esid: sec-uint8array.prototype.setfrombase64 description: Conversion of base64 strings to Uint8Arrays exercising the alphabet option includes: [compareArray.js] features: [uint8array-base64] ---*/ var target = new Uint8Array([255, 255, 255, 255]); -var result = Uint8Array.fromBase64Into('x+/y', target); +var result = target.setFromBase64('x+/y'); assert.sameValue(result.read, 4); assert.sameValue(result.written, 3); assert.compareArray(target, [199, 239, 242, 255]); var target = new Uint8Array([255, 255, 255, 255]); -var result = Uint8Array.fromBase64Into('x+/y', target, { alphabet: 'base64' }); +var result = target.setFromBase64('x+/y', { alphabet: 'base64' }); assert.sameValue(result.read, 4); assert.sameValue(result.written, 3); assert.compareArray(target, [199, 239, 242, 255]); assert.throws(SyntaxError, function() { var target = new Uint8Array([255, 255, 255, 255]); - Uint8Array.fromBase64('x+/y', { alphabet: 'base64url' }); + target.setFromBase64('x+/y', { alphabet: 'base64url' }); }); var target = new Uint8Array([255, 255, 255, 255]); -var result = Uint8Array.fromBase64Into('x-_y', target, { alphabet: 'base64url' }); +var result = target.setFromBase64('x-_y', { alphabet: 'base64url' }); assert.sameValue(result.read, 4); assert.sameValue(result.written, 3); assert.compareArray(target, [199, 239, 242, 255]); assert.throws(SyntaxError, function() { var target = new Uint8Array([255, 255, 255, 255]); - Uint8Array.fromBase64('x-_y'); + target.setFromBase64('x-_y'); }); assert.throws(SyntaxError, function() { var target = new Uint8Array([255, 255, 255, 255]); - Uint8Array.fromBase64('x-_y', { alphabet: 'base64' }); + target.setFromBase64('x-_y', { alphabet: 'base64' }); }); diff --git a/test/built-ins/Uint8Array/fromHexInto/descriptor.js b/test/built-ins/Uint8Array/prototype/setFromBase64/descriptor.js similarity index 61% rename from test/built-ins/Uint8Array/fromHexInto/descriptor.js rename to test/built-ins/Uint8Array/prototype/setFromBase64/descriptor.js index e26dea928b..f6765bb60c 100644 --- a/test/built-ins/Uint8Array/fromHexInto/descriptor.js +++ b/test/built-ins/Uint8Array/prototype/setFromBase64/descriptor.js @@ -1,14 +1,14 @@ // Copyright (C) 2024 Kevin Gibbons. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- -esid: sec-uint8array.fromhexinto +esid: sec-uint8array.prototype.setfrombase64 description: > - Uint8Array.fromHexInto has default data property attributes. + Uint8Array.prototype.setFromBase64 has default data property attributes. includes: [propertyHelper.js] features: [uint8array-base64] ---*/ -verifyProperty(Uint8Array, 'fromHexInto', { +verifyProperty(Uint8Array.prototype, 'setFromBase64', { enumerable: false, writable: true, configurable: true diff --git a/test/built-ins/Uint8Array/fromBase64Into/detached-buffer.js b/test/built-ins/Uint8Array/prototype/setFromBase64/detached-buffer.js similarity index 73% rename from test/built-ins/Uint8Array/fromBase64Into/detached-buffer.js rename to test/built-ins/Uint8Array/prototype/setFromBase64/detached-buffer.js index 80ebbcf4f4..11597b55a6 100644 --- a/test/built-ins/Uint8Array/fromBase64Into/detached-buffer.js +++ b/test/built-ins/Uint8Array/prototype/setFromBase64/detached-buffer.js @@ -1,15 +1,15 @@ // Copyright (C) 2024 Kevin Gibbons. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- -esid: sec-uint8array.frombase64into -description: Uint8Array.fromBase64Into does not write to or error on detatched buffers +esid: sec-uint8array.prototype.setfrombase64 +description: Uint8Array.prototype.setFromBase64 does not write to or error on detatched buffers includes: [detachArrayBuffer.js] features: [uint8array-base64] ---*/ var target = new Uint8Array([255, 255, 255]); $DETACHBUFFER(target.buffer); -var result = Uint8Array.fromBase64Into('Zg==', target); +var result = target.setFromBase64('Zg=='); assert.sameValue(result.read, 0); assert.sameValue(result.written, 0); @@ -23,7 +23,7 @@ Object.defineProperty(targetDetachingOptions, 'alphabet', { } }); var target = new Uint8Array([255, 255, 255]); -var result = Uint8Array.fromBase64Into('Zg==', target, targetDetachingOptions); +var result = target.setFromBase64('Zg==', targetDetachingOptions); assert.sameValue(getterCalls, 1); assert.sameValue(result.read, 0); assert.sameValue(result.written, 0); diff --git a/test/built-ins/Uint8Array/fromBase64Into/illegal-characters.js b/test/built-ins/Uint8Array/prototype/setFromBase64/illegal-characters.js similarity index 72% rename from test/built-ins/Uint8Array/fromBase64Into/illegal-characters.js rename to test/built-ins/Uint8Array/prototype/setFromBase64/illegal-characters.js index 899d934c91..c3978f89ca 100644 --- a/test/built-ins/Uint8Array/fromBase64Into/illegal-characters.js +++ b/test/built-ins/Uint8Array/prototype/setFromBase64/illegal-characters.js @@ -1,8 +1,8 @@ // Copyright (C) 2024 Kevin Gibbons. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- -esid: sec-uint8array.frombase64into -description: Uint8Array.fromBase64 throws a SyntaxError when input has non-base64, non-ascii-whitespace characters +esid: sec-uint8array.prototype.setfrombase64 +description: Uint8Array.prototype.setFromBase64 throws a SyntaxError when input has non-base64, non-ascii-whitespace characters features: [uint8array-base64] ---*/ @@ -19,6 +19,6 @@ var illegal = [ illegal.forEach(function(value) { assert.throws(SyntaxError, function() { var target = new Uint8Array([255, 255, 255, 255, 255]); - Uint8Array.fromBase64Into(value, target); + target.setFromBase64(value); }); }); diff --git a/test/built-ins/Uint8Array/fromBase64Into/last-chunk-handling.js b/test/built-ins/Uint8Array/prototype/setFromBase64/last-chunk-handling.js similarity index 67% rename from test/built-ins/Uint8Array/fromBase64Into/last-chunk-handling.js rename to test/built-ins/Uint8Array/prototype/setFromBase64/last-chunk-handling.js index 1c0ab248d6..3f0656af56 100644 --- a/test/built-ins/Uint8Array/fromBase64Into/last-chunk-handling.js +++ b/test/built-ins/Uint8Array/prototype/setFromBase64/last-chunk-handling.js @@ -1,33 +1,33 @@ // Copyright (C) 2024 Kevin Gibbons. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- -esid: sec-uint8array.frombase64into -description: Handling of final chunks in Uint8Array.fromBase64Into +esid: sec-uint8array.prototype.setfrombase64 +description: Handling of final chunks in target.setFromBase64 includes: [compareArray.js] features: [uint8array-base64] ---*/ // padding var target = new Uint8Array([255, 255, 255, 255, 255, 255]); -var result = Uint8Array.fromBase64Into('ZXhhZg==', target); +var result = target.setFromBase64('ZXhhZg=='); assert.sameValue(result.read, 8); assert.sameValue(result.written, 4); assert.compareArray(target, [101, 120, 97, 102, 255, 255]); var target = new Uint8Array([255, 255, 255, 255, 255, 255]); -var result = Uint8Array.fromBase64Into('ZXhhZg==', target, { lastChunkHandling: 'loose' }); +var result = target.setFromBase64('ZXhhZg==', { lastChunkHandling: 'loose' }); assert.sameValue(result.read, 8); assert.sameValue(result.written, 4); assert.compareArray(target, [101, 120, 97, 102, 255, 255]); var target = new Uint8Array([255, 255, 255, 255, 255, 255]); -var result = Uint8Array.fromBase64Into('ZXhhZg==', target, { lastChunkHandling: 'stop-before-partial' }); +var result = target.setFromBase64('ZXhhZg==', { lastChunkHandling: 'stop-before-partial' }); assert.sameValue(result.read, 8); assert.sameValue(result.written, 4); assert.compareArray(target, [101, 120, 97, 102, 255, 255]); var target = new Uint8Array([255, 255, 255, 255, 255, 255]); -var result = Uint8Array.fromBase64Into('ZXhhZg==', target, { lastChunkHandling: 'strict' }); +var result = target.setFromBase64('ZXhhZg==', { lastChunkHandling: 'strict' }); assert.sameValue(result.read, 8); assert.sameValue(result.written, 4); assert.compareArray(target, [101, 120, 97, 102, 255, 255]); @@ -35,97 +35,97 @@ assert.compareArray(target, [101, 120, 97, 102, 255, 255]); // no padding var target = new Uint8Array([255, 255, 255, 255, 255, 255]); -var result = Uint8Array.fromBase64Into('ZXhhZg', target); +var result = target.setFromBase64('ZXhhZg'); assert.sameValue(result.read, 6); assert.sameValue(result.written, 4); assert.compareArray(target, [101, 120, 97, 102, 255, 255]); var target = new Uint8Array([255, 255, 255, 255, 255, 255]); -var result = Uint8Array.fromBase64Into('ZXhhZg', target, { lastChunkHandling: 'loose' }); +var result = target.setFromBase64('ZXhhZg', { lastChunkHandling: 'loose' }); assert.sameValue(result.read, 6); assert.sameValue(result.written, 4); assert.compareArray(target, [101, 120, 97, 102, 255, 255]); var target = new Uint8Array([255, 255, 255, 255, 255, 255]); -var result = Uint8Array.fromBase64Into('ZXhhZg', target, { lastChunkHandling: 'stop-before-partial' }); +var result = target.setFromBase64('ZXhhZg', { lastChunkHandling: 'stop-before-partial' }); assert.sameValue(result.read, 4); assert.sameValue(result.written, 3); assert.compareArray(target, [101, 120, 97, 255, 255, 255]); assert.throws(SyntaxError, function() { var target = new Uint8Array([255, 255, 255, 255, 255, 255]); - Uint8Array.fromBase64Into('ZXhhZg', target, { lastChunkHandling: 'strict' }); + target.setFromBase64('ZXhhZg', { lastChunkHandling: 'strict' }); }); // non-zero padding bits var target = new Uint8Array([255, 255, 255, 255, 255, 255]); -var result = Uint8Array.fromBase64Into('ZXhhZh==', target); +var result = target.setFromBase64('ZXhhZh=='); assert.sameValue(result.read, 8); assert.sameValue(result.written, 4); assert.compareArray(target, [101, 120, 97, 102, 255, 255]); var target = new Uint8Array([255, 255, 255, 255, 255, 255]); -var result = Uint8Array.fromBase64Into('ZXhhZh==', target, { lastChunkHandling: 'loose' }); +var result = target.setFromBase64('ZXhhZh==', { lastChunkHandling: 'loose' }); assert.sameValue(result.read, 8); assert.sameValue(result.written, 4); assert.compareArray(target, [101, 120, 97, 102, 255, 255]); var target = new Uint8Array([255, 255, 255, 255, 255, 255]); -var result = Uint8Array.fromBase64Into('ZXhhZh==', target, { lastChunkHandling: 'stop-before-partial' }); +var result = target.setFromBase64('ZXhhZh==', { lastChunkHandling: 'stop-before-partial' }); assert.sameValue(result.read, 8); assert.sameValue(result.written, 4); assert.compareArray(target, [101, 120, 97, 102, 255, 255]); assert.throws(SyntaxError, function() { var target = new Uint8Array([255, 255, 255, 255, 255, 255]); - Uint8Array.fromBase64Into('ZXhhZh==', target, { lastChunkHandling: 'strict' }); + target.setFromBase64('ZXhhZh==', { lastChunkHandling: 'strict' }); }); // non-zero padding bits, no padding var target = new Uint8Array([255, 255, 255, 255, 255, 255]); -var result = Uint8Array.fromBase64Into('ZXhhZh', target); +var result = target.setFromBase64('ZXhhZh'); assert.sameValue(result.read, 6); assert.sameValue(result.written, 4); assert.compareArray(target, [101, 120, 97, 102, 255, 255]); var target = new Uint8Array([255, 255, 255, 255, 255, 255]); -var result = Uint8Array.fromBase64Into('ZXhhZh', target, { lastChunkHandling: 'loose' }); +var result = target.setFromBase64('ZXhhZh', { lastChunkHandling: 'loose' }); assert.sameValue(result.read, 6); assert.sameValue(result.written, 4); assert.compareArray(target, [101, 120, 97, 102, 255, 255]); var target = new Uint8Array([255, 255, 255, 255, 255, 255]); -var result = Uint8Array.fromBase64Into('ZXhhZh', target, { lastChunkHandling: 'stop-before-partial' }); +var result = target.setFromBase64('ZXhhZh', { lastChunkHandling: 'stop-before-partial' }); assert.sameValue(result.read, 4); assert.sameValue(result.written, 3); assert.compareArray(target, [101, 120, 97, 255, 255, 255]); assert.throws(SyntaxError, function() { var target = new Uint8Array([255, 255, 255, 255, 255, 255]); - Uint8Array.fromBase64Into('ZXhhZh', target, { lastChunkHandling: 'strict' }); + target.setFromBase64('ZXhhZh', { lastChunkHandling: 'strict' }); }); // malformed padding assert.throws(SyntaxError, function() { var target = new Uint8Array([255, 255, 255, 255, 255, 255]); - Uint8Array.fromBase64Into('ZXhhZg=', target); + target.setFromBase64('ZXhhZg='); }); assert.throws(SyntaxError, function() { var target = new Uint8Array([255, 255, 255, 255, 255, 255]); - Uint8Array.fromBase64Into('ZXhhZg=', target, { lastChunkHandling: 'loose' }); + target.setFromBase64('ZXhhZg=', { lastChunkHandling: 'loose' }); }); var target = new Uint8Array([255, 255, 255, 255, 255, 255]); -var result = Uint8Array.fromBase64Into('ZXhhZg=', target, { lastChunkHandling: 'stop-before-partial' }); +var result = target.setFromBase64('ZXhhZg=', { lastChunkHandling: 'stop-before-partial' }); assert.sameValue(result.read, 4); assert.sameValue(result.written, 3); assert.compareArray(target, [101, 120, 97, 255, 255, 255]); assert.throws(SyntaxError, function() { var target = new Uint8Array([255, 255, 255, 255, 255, 255]); - Uint8Array.fromBase64Into('ZXhhZg=', target, { lastChunkHandling: 'strict' }); + target.setFromBase64('ZXhhZg=', { lastChunkHandling: 'strict' }); }); diff --git a/test/built-ins/Uint8Array/fromBase64Into/length.js b/test/built-ins/Uint8Array/prototype/setFromBase64/length.js similarity index 62% rename from test/built-ins/Uint8Array/fromBase64Into/length.js rename to test/built-ins/Uint8Array/prototype/setFromBase64/length.js index a97be01f69..bc7a976967 100644 --- a/test/built-ins/Uint8Array/fromBase64Into/length.js +++ b/test/built-ins/Uint8Array/prototype/setFromBase64/length.js @@ -1,15 +1,15 @@ // Copyright (C) 2024 Kevin Gibbons. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- -esid: sec-uint8array.frombase64into +esid: sec-uint8array.prototype.setfrombase64 description: > - Uint8Array.fromBase64Into.length is 2. + Uint8Array.prototype.setFromBase64.length is 1. includes: [propertyHelper.js] features: [uint8array-base64] ---*/ -verifyProperty(Uint8Array.fromBase64Into, 'length', { - value: 2, +verifyProperty(Uint8Array.prototype.setFromBase64, 'length', { + value: 1, enumerable: false, writable: false, configurable: true diff --git a/test/built-ins/Uint8Array/fromHexInto/name.js b/test/built-ins/Uint8Array/prototype/setFromBase64/name.js similarity index 59% rename from test/built-ins/Uint8Array/fromHexInto/name.js rename to test/built-ins/Uint8Array/prototype/setFromBase64/name.js index 7bf3d9761f..18f124fb6a 100644 --- a/test/built-ins/Uint8Array/fromHexInto/name.js +++ b/test/built-ins/Uint8Array/prototype/setFromBase64/name.js @@ -1,15 +1,15 @@ // Copyright (C) 2024 Kevin Gibbons. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- -esid: sec-uint8array.fromhexinto +esid: sec-uint8array.prototype.setfrombase64 description: > - Uint8Array.fromHexInto.name is "fromHexInto". + Uint8Array.prototype.setFromBase64.name is "setFromBase64". includes: [propertyHelper.js] features: [uint8array-base64] ---*/ -verifyProperty(Uint8Array.fromHexInto, 'name', { - value: 'fromHexInto', +verifyProperty(Uint8Array.prototype.setFromBase64, 'name', { + value: 'setFromBase64', enumerable: false, writable: false, configurable: true diff --git a/test/built-ins/Uint8Array/fromBase64Into/nonconstructor.js b/test/built-ins/Uint8Array/prototype/setFromBase64/nonconstructor.js similarity index 54% rename from test/built-ins/Uint8Array/fromBase64Into/nonconstructor.js rename to test/built-ins/Uint8Array/prototype/setFromBase64/nonconstructor.js index a5e9f0ec7a..14b429f4f0 100644 --- a/test/built-ins/Uint8Array/fromBase64Into/nonconstructor.js +++ b/test/built-ins/Uint8Array/prototype/setFromBase64/nonconstructor.js @@ -1,16 +1,16 @@ // Copyright (C) 2024 Kevin Gibbons. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- -esid: sec-uint8array.frombase64into +esid: sec-uint8array.prototype.setfrombase64 description: > - Uint8Array.fromBase64Into is not a constructor function. + Uint8Array.prototype.setFromBase64 is not a constructor function. includes: [isConstructor.js] features: [uint8array-base64, Reflect.construct] ---*/ -assert(!isConstructor(Uint8Array.fromBase64Into), "Uint8Array.fromBase64Into is not a constructor"); +assert(!isConstructor(Uint8Array.prototype.setFromBase64), "Uint8Array.prototype.setFromBase64 is not a constructor"); assert.throws(TypeError, function() { var target = new Uint8Array(10); - new Uint8Array.fromBase64Into('', target); + new target.setFromBase64(''); }); diff --git a/test/built-ins/Uint8Array/fromBase64Into/option-coercion.js b/test/built-ins/Uint8Array/prototype/setFromBase64/option-coercion.js similarity index 74% rename from test/built-ins/Uint8Array/fromBase64Into/option-coercion.js rename to test/built-ins/Uint8Array/prototype/setFromBase64/option-coercion.js index 174712f932..fbe07427ae 100644 --- a/test/built-ins/Uint8Array/fromBase64Into/option-coercion.js +++ b/test/built-ins/Uint8Array/prototype/setFromBase64/option-coercion.js @@ -1,8 +1,8 @@ // Copyright (C) 2024 Kevin Gibbons. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- -esid: sec-uint8array.frombase64into -description: Uint8Array.fromBase64Into triggers effects of the "alphabet" and "lastChunkHandling" getters, but does not perform toString on the results +esid: sec-uint8array.prototype.setfrombase64 +description: Uint8Array.prototype.setFromBase64 triggers effects of the "alphabet" and "lastChunkHandling" getters, but does not perform toString on the results includes: [compareArray.js] features: [uint8array-base64] ---*/ @@ -16,13 +16,13 @@ var throwyToString = { }; assert.throws(TypeError, function() { var target = new Uint8Array([255, 255, 255]); - Uint8Array.fromBase64Into("Zg==", target, { alphabet: throwyToString }); + target.setFromBase64("Zg==", { alphabet: throwyToString }); }); assert.sameValue(toStringCalls, 0); assert.throws(TypeError, function() { var target = new Uint8Array([255, 255, 255]); - Uint8Array.fromBase64Into("Zg==", target, { lastChunkHandling: throwyToString }); + target.setFromBase64("Zg==", { lastChunkHandling: throwyToString }); }); assert.sameValue(toStringCalls, 0); @@ -36,7 +36,7 @@ Object.defineProperty(base64UrlOptions, "alphabet", { } }); var target = new Uint8Array([255, 255, 255, 255]); -var result = Uint8Array.fromBase64Into("x-_y", target, base64UrlOptions); +var result = target.setFromBase64("x-_y", base64UrlOptions); assert.sameValue(result.read, 4); assert.sameValue(result.written, 3); assert.compareArray(target, [199, 239, 242, 255]); @@ -51,7 +51,7 @@ Object.defineProperty(strictOptions, "lastChunkHandling", { } }); var target = new Uint8Array([255, 255, 255, 255]); -var result = Uint8Array.fromBase64Into("Zg==", target, strictOptions); +var result = target.setFromBase64("Zg==", strictOptions); assert.sameValue(result.read, 4); assert.sameValue(result.written, 1); assert.compareArray(target, [102, 255, 255, 255]); diff --git a/test/built-ins/Uint8Array/fromBase64Into/results.js b/test/built-ins/Uint8Array/prototype/setFromBase64/results.js similarity index 90% rename from test/built-ins/Uint8Array/fromBase64Into/results.js rename to test/built-ins/Uint8Array/prototype/setFromBase64/results.js index 35b02b4078..cfd87afc01 100644 --- a/test/built-ins/Uint8Array/fromBase64Into/results.js +++ b/test/built-ins/Uint8Array/prototype/setFromBase64/results.js @@ -1,7 +1,7 @@ // Copyright (C) 2024 Kevin Gibbons. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- -esid: sec-uint8array.frombase64into +esid: sec-uint8array.prototype.setfrombase64 description: Conversion of base64 strings to Uint8Arrays includes: [compareArray.js] features: [uint8array-base64] @@ -21,7 +21,7 @@ var standardBase64Vectors = [ standardBase64Vectors.forEach(function (pair) { var allFF = [255, 255, 255, 255, 255, 255, 255, 255]; var target = new Uint8Array(allFF); - var result = Uint8Array.fromBase64Into(pair[0], target); + var result = target.setFromBase64(pair[0]); assert.sameValue(result.read, pair[0].length); assert.sameValue(result.written, pair[1].length); diff --git a/test/built-ins/Uint8Array/fromBase64Into/string-coercion.js b/test/built-ins/Uint8Array/prototype/setFromBase64/string-coercion.js similarity index 79% rename from test/built-ins/Uint8Array/fromBase64Into/string-coercion.js rename to test/built-ins/Uint8Array/prototype/setFromBase64/string-coercion.js index 17ad8b48f6..22499d3493 100644 --- a/test/built-ins/Uint8Array/fromBase64Into/string-coercion.js +++ b/test/built-ins/Uint8Array/prototype/setFromBase64/string-coercion.js @@ -1,8 +1,8 @@ // Copyright (C) 2024 Kevin Gibbons. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- -esid: sec-uint8array.frombase64into -description: Uint8Array.fromBase64Into throws if its first argument is not a string +esid: sec-uint8array.prototype.setfrombase64 +description: Uint8Array.prototype.setFromBase64 throws if its first argument is not a string features: [uint8array-base64] ---*/ @@ -16,7 +16,7 @@ var throwyToString = { assert.throws(TypeError, function() { var target = new Uint8Array(10); - Uint8Array.fromBase64Into(throwyToString, target); + target.setFromBase64(throwyToString); }); assert.sameValue(toStringCalls, 0); @@ -37,7 +37,7 @@ Object.defineProperty(touchyOptions, "lastChunkHandling", { }); assert.throws(TypeError, function() { var target = new Uint8Array(10); - Uint8Array.fromBase64Into(throwyToString, target, touchyOptions); + target.setFromBase64(throwyToString, touchyOptions); }); assert.sameValue(toStringCalls, 0); assert.sameValue(optionAccesses, 0); diff --git a/test/built-ins/Uint8Array/fromBase64Into/subarray.js b/test/built-ins/Uint8Array/prototype/setFromBase64/subarray.js similarity index 71% rename from test/built-ins/Uint8Array/fromBase64Into/subarray.js rename to test/built-ins/Uint8Array/prototype/setFromBase64/subarray.js index 6c5bb95e54..5c864aab21 100644 --- a/test/built-ins/Uint8Array/fromBase64Into/subarray.js +++ b/test/built-ins/Uint8Array/prototype/setFromBase64/subarray.js @@ -1,8 +1,8 @@ // Copyright (C) 2024 Kevin Gibbons. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- -esid: sec-uint8array.frombase64into -description: Uint8Array.fromBase64Into takes into account the offset of the target Uint8Array +esid: sec-uint8array.prototype.setfrombase64 +description: Uint8Array.prototype.setFromBase64 takes into account the offset of the target Uint8Array includes: [compareArray.js] features: [uint8array-base64] ---*/ @@ -10,7 +10,7 @@ features: [uint8array-base64] var base = new Uint8Array([255, 255, 255, 255, 255, 255, 255]); var subarray = base.subarray(2, 5); -var result = Uint8Array.fromBase64Into('Zm9vYmFy', subarray); +var result = subarray.setFromBase64('Zm9vYmFy'); assert.sameValue(result.read, 4); assert.sameValue(result.written, 3); assert.compareArray(subarray, [102, 111, 111]); diff --git a/test/built-ins/Uint8Array/fromBase64Into/target-size.js b/test/built-ins/Uint8Array/prototype/setFromBase64/target-size.js similarity index 73% rename from test/built-ins/Uint8Array/fromBase64Into/target-size.js rename to test/built-ins/Uint8Array/prototype/setFromBase64/target-size.js index 4b44c9eaef..5d03f060e8 100644 --- a/test/built-ins/Uint8Array/fromBase64Into/target-size.js +++ b/test/built-ins/Uint8Array/prototype/setFromBase64/target-size.js @@ -1,64 +1,64 @@ // Copyright (C) 2024 Kevin Gibbons. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- -esid: sec-uint8array.frombase64 -description: Uint8Array.fromBase64Into behavior when target buffer is small +esid: sec-uint8array.prototype.setfrombase64 +description: Uint8Array.prototype.setFromBase64 behavior when target buffer is small includes: [compareArray.js] features: [uint8array-base64] ---*/ // buffer too small var target = new Uint8Array([255, 255, 255, 255, 255]); -var result = Uint8Array.fromBase64Into('Zm9vYmFy', target); +var result = target.setFromBase64('Zm9vYmFy'); assert.sameValue(result.read, 4); assert.sameValue(result.written, 3); assert.compareArray(target, [102, 111, 111, 255, 255]); // buffer too small, padded var target = new Uint8Array([255, 255, 255, 255]); -var result = Uint8Array.fromBase64Into('Zm9vYmE=', target); +var result = target.setFromBase64('Zm9vYmE='); assert.sameValue(result.read, 4); assert.sameValue(result.written, 3); assert.compareArray(target, [102, 111, 111, 255]); // buffer exact var target = new Uint8Array([255, 255, 255, 255, 255, 255]); -var result = Uint8Array.fromBase64Into('Zm9vYmFy', target); +var result = target.setFromBase64('Zm9vYmFy'); assert.sameValue(result.read, 8); assert.sameValue(result.written, 6); assert.compareArray(target, [102, 111, 111, 98, 97, 114]); // buffer exact, padded var target = new Uint8Array([255, 255, 255, 255, 255]); -var result = Uint8Array.fromBase64Into('Zm9vYmE=', target); +var result = target.setFromBase64('Zm9vYmE='); assert.sameValue(result.read, 8); assert.sameValue(result.written, 5); assert.compareArray(target, [102, 111, 111, 98, 97]); // buffer exact, not padded var target = new Uint8Array([255, 255, 255, 255, 255]); -var result = Uint8Array.fromBase64Into('Zm9vYmE', target); +var result = target.setFromBase64('Zm9vYmE'); assert.sameValue(result.read, 7); assert.sameValue(result.written, 5); assert.compareArray(target, [102, 111, 111, 98, 97]); // buffer exact, padded, stop-before-partial var target = new Uint8Array([255, 255, 255, 255, 255]); -var result = Uint8Array.fromBase64Into('Zm9vYmE=', target, { lastChunkHandling: 'stop-before-partial' }); +var result = target.setFromBase64('Zm9vYmE=', { lastChunkHandling: 'stop-before-partial' }); assert.sameValue(result.read, 8); assert.sameValue(result.written, 5); assert.compareArray(target, [102, 111, 111, 98, 97]); // buffer exact, not padded, stop-before-partial var target = new Uint8Array([255, 255, 255, 255, 255]); -var result = Uint8Array.fromBase64Into('Zm9vYmE', target, { lastChunkHandling: 'stop-before-partial' }); +var result = target.setFromBase64('Zm9vYmE', { lastChunkHandling: 'stop-before-partial' }); assert.sameValue(result.read, 4); assert.sameValue(result.written, 3); assert.compareArray(target, [102, 111, 111, 255, 255]); // buffer too large var target = new Uint8Array([255, 255, 255, 255, 255, 255, 255]); -var result = Uint8Array.fromBase64Into('Zm9vYmFy', target); +var result = target.setFromBase64('Zm9vYmFy'); assert.sameValue(result.read, 8); assert.sameValue(result.written, 6); assert.compareArray(target, [102, 111, 111, 98, 97, 114, 255]); diff --git a/test/built-ins/Uint8Array/fromBase64Into/whitespace.js b/test/built-ins/Uint8Array/prototype/setFromBase64/whitespace.js similarity index 76% rename from test/built-ins/Uint8Array/fromBase64Into/whitespace.js rename to test/built-ins/Uint8Array/prototype/setFromBase64/whitespace.js index 8ba0b01064..38bcb3d3a0 100644 --- a/test/built-ins/Uint8Array/fromBase64Into/whitespace.js +++ b/test/built-ins/Uint8Array/prototype/setFromBase64/whitespace.js @@ -1,8 +1,8 @@ // Copyright (C) 2024 Kevin Gibbons. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- -esid: sec-uint8array.frombase64into -description: Uint8Array.fromBase64Into ignores ASCII whitespace in the input +esid: sec-uint8array.prototype.setfrombase64 +description: Uint8Array.prototype.setFromBase64 ignores ASCII whitespace in the input includes: [compareArray.js] features: [uint8array-base64] ---*/ @@ -16,7 +16,7 @@ var whitespaceKinds = [ ]; whitespaceKinds.forEach(function(pair) { var target = new Uint8Array([255, 255, 255]); - var result = Uint8Array.fromBase64Into(pair[0], target); + var result = target.setFromBase64(pair[0]); assert.sameValue(result.read, 5); assert.sameValue(result.written, 1); assert.compareArray(target, [102, 255, 255], "ascii whitespace: " + pair[1]); diff --git a/test/built-ins/Uint8Array/fromBase64Into/descriptor.js b/test/built-ins/Uint8Array/prototype/setFromHex/descriptor.js similarity index 62% rename from test/built-ins/Uint8Array/fromBase64Into/descriptor.js rename to test/built-ins/Uint8Array/prototype/setFromHex/descriptor.js index 672a29cb6a..080cda9411 100644 --- a/test/built-ins/Uint8Array/fromBase64Into/descriptor.js +++ b/test/built-ins/Uint8Array/prototype/setFromHex/descriptor.js @@ -1,14 +1,14 @@ // Copyright (C) 2024 Kevin Gibbons. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- -esid: sec-uint8array.frombase64into +esid: sec-uint8array.prototype.setfromhex description: > - Uint8Array.fromBase64Into has default data property attributes. + Uint8Array.prototype.setFromHex has default data property attributes. includes: [propertyHelper.js] features: [uint8array-base64] ---*/ -verifyProperty(Uint8Array, 'fromBase64Into', { +verifyProperty(Uint8Array.prototype, 'setFromHex', { enumerable: false, writable: true, configurable: true diff --git a/test/built-ins/Uint8Array/fromHexInto/detached-buffer.js b/test/built-ins/Uint8Array/prototype/setFromHex/detached-buffer.js similarity index 67% rename from test/built-ins/Uint8Array/fromHexInto/detached-buffer.js rename to test/built-ins/Uint8Array/prototype/setFromHex/detached-buffer.js index 0da1767acd..6f77c4de47 100644 --- a/test/built-ins/Uint8Array/fromHexInto/detached-buffer.js +++ b/test/built-ins/Uint8Array/prototype/setFromHex/detached-buffer.js @@ -1,14 +1,14 @@ // Copyright (C) 2024 Kevin Gibbons. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- -esid: sec-uint8array.fromhexinto -description: Uint8Array.fromHexInto does not write to or error on detatched buffers +esid: sec-uint8array.prototype.setfromhex +description: Uint8Array.prototype.setFromHex does not write to or error on detatched buffers includes: [detachArrayBuffer.js] features: [uint8array-base64] ---*/ var target = new Uint8Array([255, 255, 255]); $DETACHBUFFER(target.buffer); -var result = Uint8Array.fromHexInto('aa', target); +var result = target.setFromHex('aa'); assert.sameValue(result.read, 0); assert.sameValue(result.written, 0); diff --git a/test/built-ins/Uint8Array/fromHexInto/illegal-characters.js b/test/built-ins/Uint8Array/prototype/setFromHex/illegal-characters.js similarity index 74% rename from test/built-ins/Uint8Array/fromHexInto/illegal-characters.js rename to test/built-ins/Uint8Array/prototype/setFromHex/illegal-characters.js index 3b623f2197..970866078f 100644 --- a/test/built-ins/Uint8Array/fromHexInto/illegal-characters.js +++ b/test/built-ins/Uint8Array/prototype/setFromHex/illegal-characters.js @@ -1,8 +1,8 @@ // Copyright (C) 2024 Kevin Gibbons. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- -esid: sec-uint8array.fromhexinto -description: Uint8Array.fromHexInto throws a SyntaxError when input has non-hex characters +esid: sec-uint8array.prototype.setfromhex +description: Uint8Array.prototype.setFromHex throws a SyntaxError when input has non-hex characters features: [uint8array-base64] ---*/ @@ -21,6 +21,6 @@ var illegal = [ illegal.forEach(function(value) { assert.throws(SyntaxError, function() { var target = new Uint8Array([255, 255, 255, 255, 255]); - Uint8Array.fromHexInto(value, target); + target.setFromHex(value); }); }); diff --git a/test/built-ins/Uint8Array/fromHexInto/length.js b/test/built-ins/Uint8Array/prototype/setFromHex/length.js similarity index 63% rename from test/built-ins/Uint8Array/fromHexInto/length.js rename to test/built-ins/Uint8Array/prototype/setFromHex/length.js index d41f524286..3754878ffc 100644 --- a/test/built-ins/Uint8Array/fromHexInto/length.js +++ b/test/built-ins/Uint8Array/prototype/setFromHex/length.js @@ -1,15 +1,15 @@ // Copyright (C) 2024 Kevin Gibbons. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- -esid: sec-uint8array.fromhexinto +esid: sec-uint8array.prototype.setfromhex description: > - Uint8Array.fromHexInto.length is 2. + Uint8Array.prototype.setFromHex.length is 1. includes: [propertyHelper.js] features: [uint8array-base64] ---*/ -verifyProperty(Uint8Array.fromHexInto, 'length', { - value: 2, +verifyProperty(Uint8Array.prototype.setFromHex, 'length', { + value: 1, enumerable: false, writable: false, configurable: true diff --git a/test/built-ins/Uint8Array/fromBase64Into/name.js b/test/built-ins/Uint8Array/prototype/setFromHex/name.js similarity index 61% rename from test/built-ins/Uint8Array/fromBase64Into/name.js rename to test/built-ins/Uint8Array/prototype/setFromHex/name.js index dcdc49c99b..808ac1645e 100644 --- a/test/built-ins/Uint8Array/fromBase64Into/name.js +++ b/test/built-ins/Uint8Array/prototype/setFromHex/name.js @@ -1,15 +1,15 @@ // Copyright (C) 2024 Kevin Gibbons. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- -esid: sec-uint8array.frombase64into +esid: sec-uint8array.prototype.setfromhex description: > - Uint8Array.fromBase64Into.name is "fromBase64Into". + Uint8Array.prototype.setFromHex.name is "setFromHex". includes: [propertyHelper.js] features: [uint8array-base64] ---*/ -verifyProperty(Uint8Array.fromBase64Into, 'name', { - value: 'fromBase64Into', +verifyProperty(Uint8Array.prototype.setFromHex, 'name', { + value: 'setFromHex', enumerable: false, writable: false, configurable: true diff --git a/test/built-ins/Uint8Array/fromHexInto/nonconstructor.js b/test/built-ins/Uint8Array/prototype/setFromHex/nonconstructor.js similarity index 57% rename from test/built-ins/Uint8Array/fromHexInto/nonconstructor.js rename to test/built-ins/Uint8Array/prototype/setFromHex/nonconstructor.js index 5b9ccf7966..435ce51f5a 100644 --- a/test/built-ins/Uint8Array/fromHexInto/nonconstructor.js +++ b/test/built-ins/Uint8Array/prototype/setFromHex/nonconstructor.js @@ -1,16 +1,16 @@ // Copyright (C) 2024 Kevin Gibbons. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- -esid: sec-uint8array.fromhexinto +esid: sec-uint8array.prototype.setfromhex description: > - Uint8Array.fromHexInto is not a constructor function. + Uint8Array.prototype.setFromHex is not a constructor function. includes: [isConstructor.js] features: [uint8array-base64, Reflect.construct] ---*/ -assert(!isConstructor(Uint8Array.fromHexInto), "Uint8Array.fromHexInto is not a constructor"); +assert(!isConstructor(Uint8Array.prototype.setFromHex), "target.setFromHex is not a constructor"); assert.throws(TypeError, function() { var target = new Uint8Array(10); - new Uint8Array.fromHexInto('', target); + new target.setFromHex(''); }); diff --git a/test/built-ins/Uint8Array/fromHexInto/results.js b/test/built-ins/Uint8Array/prototype/setFromHex/results.js similarity index 90% rename from test/built-ins/Uint8Array/fromHexInto/results.js rename to test/built-ins/Uint8Array/prototype/setFromHex/results.js index 41256e1baf..2359a9060d 100644 --- a/test/built-ins/Uint8Array/fromHexInto/results.js +++ b/test/built-ins/Uint8Array/prototype/setFromHex/results.js @@ -1,7 +1,7 @@ // Copyright (C) 2024 Kevin Gibbons. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- -esid: sec-uint8array.fromhexinto +esid: sec-uint8array.prototype.setfromhex description: Conversion of hex strings to Uint8Arrays includes: [compareArray.js] features: [uint8array-base64] @@ -22,7 +22,7 @@ var cases = [ cases.forEach(function (pair) { var allFF = [255, 255, 255, 255, 255, 255, 255, 255]; var target = new Uint8Array(allFF); - var result = Uint8Array.fromHexInto(pair[0], target); + var result = target.setFromHex(pair[0]); assert.sameValue(result.read, pair[0].length); assert.sameValue(result.written, pair[1].length); diff --git a/test/built-ins/Uint8Array/fromHexInto/string-coercion.js b/test/built-ins/Uint8Array/prototype/setFromHex/string-coercion.js similarity index 72% rename from test/built-ins/Uint8Array/fromHexInto/string-coercion.js rename to test/built-ins/Uint8Array/prototype/setFromHex/string-coercion.js index e7f08661ca..822ee7a349 100644 --- a/test/built-ins/Uint8Array/fromHexInto/string-coercion.js +++ b/test/built-ins/Uint8Array/prototype/setFromHex/string-coercion.js @@ -1,8 +1,8 @@ // Copyright (C) 2024 Kevin Gibbons. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- -esid: sec-uint8array.fromhexinto -description: Uint8Array.fromHexInto throws if its first argument is not a string +esid: sec-uint8array.prototype.setfromhex +description: Uint8Array.prototype.setFromHex throws if its first argument is not a string features: [uint8array-base64] ---*/ @@ -16,6 +16,6 @@ var throwyToString = { assert.throws(TypeError, function() { var target = new Uint8Array(10); - Uint8Array.fromHexInto(throwyToString, target); + target.setFromHex(throwyToString); }); assert.sameValue(toStringCalls, 0); diff --git a/test/built-ins/Uint8Array/fromHexInto/subarray.js b/test/built-ins/Uint8Array/prototype/setFromHex/subarray.js similarity index 72% rename from test/built-ins/Uint8Array/fromHexInto/subarray.js rename to test/built-ins/Uint8Array/prototype/setFromHex/subarray.js index 92330afad2..3868ace014 100644 --- a/test/built-ins/Uint8Array/fromHexInto/subarray.js +++ b/test/built-ins/Uint8Array/prototype/setFromHex/subarray.js @@ -1,8 +1,8 @@ // Copyright (C) 2024 Kevin Gibbons. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- -esid: sec-uint8array.fromhexinto -description: Uint8Array.fromHexInto takes into account the offset of the target Uint8Array +esid: sec-uint8array.prototype.setfromhex +description: Uint8Array.prototype.setFromHex takes into account the offset of the target Uint8Array includes: [compareArray.js] features: [uint8array-base64] ---*/ @@ -10,7 +10,7 @@ features: [uint8array-base64] var base = new Uint8Array([255, 255, 255, 255, 255, 255, 255]); var subarray = base.subarray(2, 5); -var result = Uint8Array.fromHexInto('aabbcc', subarray); +var result = subarray.setFromHex('aabbcc'); assert.sameValue(result.read, 6); assert.sameValue(result.written, 3); assert.compareArray(subarray, [170, 187, 204]); diff --git a/test/built-ins/Uint8Array/fromHexInto/target-size.js b/test/built-ins/Uint8Array/prototype/setFromHex/target-size.js similarity index 73% rename from test/built-ins/Uint8Array/fromHexInto/target-size.js rename to test/built-ins/Uint8Array/prototype/setFromHex/target-size.js index b56a8a5905..b794a44ee8 100644 --- a/test/built-ins/Uint8Array/fromHexInto/target-size.js +++ b/test/built-ins/Uint8Array/prototype/setFromHex/target-size.js @@ -1,29 +1,29 @@ // Copyright (C) 2024 Kevin Gibbons. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- -esid: sec-uint8array.fromhexinto -description: Uint8Array.fromHexInto behavior when target buffer is small +esid: sec-uint8array.prototype.setfromhex +description: Uint8Array.prototype.setFromHex behavior when target buffer is small includes: [compareArray.js] features: [uint8array-base64] ---*/ // buffer too small var target = new Uint8Array([255, 255]); -var result = Uint8Array.fromHexInto('aabbcc', target); +var result = target.setFromHex('aabbcc'); assert.sameValue(result.read, 4); assert.sameValue(result.written, 2); assert.compareArray(target, [170, 187]); // buffer exact var target = new Uint8Array([255, 255, 255]); -var result = Uint8Array.fromHexInto('aabbcc', target); +var result = target.setFromHex('aabbcc'); assert.sameValue(result.read, 6); assert.sameValue(result.written, 3); assert.compareArray(target, [170, 187, 204]); // buffer too large var target = new Uint8Array([255, 255, 255, 255]); -var result = Uint8Array.fromHexInto('aabbcc', target); +var result = target.setFromHex('aabbcc'); assert.sameValue(result.read, 6); assert.sameValue(result.written, 3); assert.compareArray(target, [170, 187, 204, 255]);