Skip to content

Commit 9d8a783

Browse files
bakkotgibson042
authored andcommitted
[immutable-arraybuffer] tests for interaction between immutable ABs and base64 proposal
1 parent 089b615 commit 9d8a783

2 files changed

Lines changed: 38 additions & 0 deletions

File tree

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Copyright (C) 2026 Kevin Gibbons. All rights reserved.
2+
// This code is governed by the BSD license found in the LICENSE file.
3+
4+
/*---
5+
esid: sec-uint8array.prototype.setfrombase64
6+
description: Uint8Array.prototype.setFromBase64 throws a TypeError when the target is backed by an immutable ArrayBuffer.
7+
features: [ArrayBuffer, TypedArray, uint8array-base64, immutable-arraybuffer]
8+
---*/
9+
10+
var iab = (new ArrayBuffer(10)).transferToImmutable();
11+
var target = new Uint8Array(iab);
12+
13+
assert.throws(TypeError, function () {
14+
target.setFromBase64('Zg==');
15+
});
16+
17+
assert.throws(TypeError, function () {
18+
target.setFromBase64('');
19+
});
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Copyright (C) 2026 Kevin Gibbons. All rights reserved.
2+
// This code is governed by the BSD license found in the LICENSE file.
3+
4+
/*---
5+
esid: sec-uint8array.prototype.setfromhex
6+
description: Uint8Array.prototype.setFromHex throws a TypeError when the target is backed by an immutable ArrayBuffer.
7+
features: [ArrayBuffer, TypedArray, uint8array-base64, immutable-arraybuffer]
8+
---*/
9+
10+
var iab = (new ArrayBuffer(10)).transferToImmutable();
11+
var target = new Uint8Array(iab);
12+
13+
assert.throws(TypeError, function () {
14+
target.setFromHex('aa');
15+
});
16+
17+
assert.throws(TypeError, function () {
18+
target.setFromHex('');
19+
});

0 commit comments

Comments
 (0)