Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix typed array subclasses in crypto.getRandomValues()
Closes #3395.
- Loading branch information
1 parent
b1c0072
commit fd00838
Showing
2 changed files
with
44 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
...eb-platform-tests/to-upstream/WebCryptoAPI/getRandomValues-BufferSource-subclasses.any.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
"use strict"; | ||
|
||
const arrays = [ | ||
"Int8Array", | ||
"Int16Array", | ||
"Int32Array", | ||
"BigInt64Array", | ||
"Uint8Array", | ||
"Uint8ClampedArray", | ||
"Uint16Array", | ||
"Uint32Array", | ||
"BigUint64Array" | ||
]; | ||
|
||
for (const array of arrays) { | ||
const ctor = globalThis[array]; | ||
test(() => { | ||
class Buffer extends ctor {} | ||
// Must not throw for the test to pass | ||
self.crypto.getRandomValues(new Buffer(256)); | ||
}, "Subclass of " + array); | ||
} |