summaryrefslogtreecommitdiff
path: root/ext/web/06_streams.js
diff options
context:
space:
mode:
authorKenta Moriuchi <moriken@kimamass.com>2023-04-15 05:23:28 +0900
committerGitHub <noreply@github.com>2023-04-14 22:23:28 +0200
commitf086ec57b453fc0af763564eb80fea4b5b7f7296 (patch)
tree8c7800d918751893e4011eb86f23e8f687d4139b /ext/web/06_streams.js
parent136dce67cec749dce5989ea29e88359ef79a0045 (diff)
fix(core): Use safe primordials wrappers (#18687)
Diffstat (limited to 'ext/web/06_streams.js')
-rw-r--r--ext/web/06_streams.js10
1 files changed, 5 insertions, 5 deletions
diff --git a/ext/web/06_streams.js b/ext/web/06_streams.js
index b49d7ecd7..c51606365 100644
--- a/ext/web/06_streams.js
+++ b/ext/web/06_streams.js
@@ -34,7 +34,6 @@ const {
DataViewPrototypeGetByteOffset,
Float32Array,
Float64Array,
- FinalizationRegistry,
Int8Array,
Int16Array,
Int32Array,
@@ -56,7 +55,9 @@ const {
queueMicrotask,
RangeError,
ReflectHas,
+ SafeFinalizationRegistry,
SafePromiseAll,
+ SafeWeakMap,
// TODO(lucacasonato): add SharedArrayBuffer to primordials
// SharedArrayBufferPrototype
Symbol,
@@ -73,7 +74,6 @@ const {
Uint16Array,
Uint32Array,
Uint8ClampedArray,
- WeakMap,
WeakMapPrototypeGet,
WeakMapPrototypeHas,
WeakMapPrototypeSet,
@@ -695,7 +695,7 @@ function isReadableStreamDisturbed(stream) {
const DEFAULT_CHUNK_SIZE = 64 * 1024; // 64 KiB
// A finalization registry to clean up underlying resources that are GC'ed.
-const RESOURCE_REGISTRY = new FinalizationRegistry((rid) => {
+const RESOURCE_REGISTRY = new SafeFinalizationRegistry((rid) => {
core.tryClose(rid);
});
@@ -4743,7 +4743,7 @@ webidl.configurePrototype(ByteLengthQueuingStrategy);
const ByteLengthQueuingStrategyPrototype = ByteLengthQueuingStrategy.prototype;
/** @type {WeakMap<typeof globalThis, (chunk: ArrayBufferView) => number>} */
-const byteSizeFunctionWeakMap = new WeakMap();
+const byteSizeFunctionWeakMap = new SafeWeakMap();
function initializeByteLengthSizeFunction(globalObject) {
if (WeakMapPrototypeHas(byteSizeFunctionWeakMap, globalObject)) {
@@ -4800,7 +4800,7 @@ webidl.configurePrototype(CountQueuingStrategy);
const CountQueuingStrategyPrototype = CountQueuingStrategy.prototype;
/** @type {WeakMap<typeof globalThis, () => 1>} */
-const countSizeFunctionWeakMap = new WeakMap();
+const countSizeFunctionWeakMap = new SafeWeakMap();
/** @param {typeof globalThis} globalObject */
function initializeCountSizeFunction(globalObject) {