Skip to content

Commit ef96249

Browse files
committed
[Fix] Uint8Array.prototype.setFromBase64: avoid invoking toString on a non-string string argument
Also: - add test coverage from tc39/test262#3994
1 parent 85c927f commit ef96249

File tree

4 files changed

+470
-3
lines changed

4 files changed

+470
-3
lines changed

.eslintrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"capIsNewExceptions": [
1919
"FromBase64",
2020
"FromHex",
21+
"DetachArrayBuffer",
2122
"Get",
2223
"GetIntrinsic",
2324
"GetOptionsObject",

Uint8Array.prototype.setFromBase64/implementation.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ module.exports = function setFromBase64(string) {
2929
ValidateUint8Array(into); // step 2
3030

3131
if (typeof string !== 'string') {
32-
throw new $TypeError('`string` is not a string: ' + string); // step 3
32+
throw new $TypeError('`string` is not a string: ' + typeof string); // step 3
3333
}
3434

3535
var opts = GetOptionsObject(arguments.length > 1 ? arguments[1] : void undefined); // step 4
@@ -41,7 +41,7 @@ module.exports = function setFromBase64(string) {
4141
}
4242

4343
if (typeof alphabet !== 'string') {
44-
throw new $TypeError('`alphabet` is not a string: ' + alphabet); // step 7
44+
throw new $TypeError('`alphabet` is not a string: ' + typeof alphabet); // step 7
4545
}
4646

4747
if (alphabet !== 'base64' && alphabet !== 'base64url') {

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@
6969
"evalmd": "^0.0.19",
7070
"for-each": "^0.3.3",
7171
"in-publish": "^2.0.1",
72+
"is-core-module": "^2.13.1",
7273
"npmignore": "^0.3.1",
7374
"nyc": "^10.3.2",
7475
"object-inspect": "^1.13.1",

0 commit comments

Comments
 (0)