1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-26 09:10:40 -05:00

chore: add FinalizationRegistry and WeakRef to primordials (#11735)

Because it was possible to disable those with a runtime flag, they were
not available through primordials. The flag has since been removed
upstream.

Refs: d59db06bf5
This commit is contained in:
Antoine du Hamel 2021-08-17 12:04:09 +02:00 committed by GitHub
parent 5d24ddf9b2
commit 7e5698fb2e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -206,8 +206,7 @@
"Date",
"Error",
"EvalError",
// TODO(lucacasonato): not present in snapshots. Why?
// "FinalizationRegistry",
"FinalizationRegistry",
"Float32Array",
"Float64Array",
"Function",
@ -231,8 +230,7 @@
"Uint8Array",
"Uint8ClampedArray",
"WeakMap",
// TODO(lucacasonato): not present in snapshots. Why?
// "WeakRef",
"WeakRef",
"WeakSet",
].forEach((name) => {
const original = globalThis[name];
@ -410,25 +408,23 @@
},
);
// TODO(lucacasonato): not present in snapshots. Why?
// primordials.SafeFinalizationRegistry = makeSafe(
// FinalizationRegistry,
// class SafeFinalizationRegistry extends FinalizationRegistry {
// constructor(cleanupCallback) {
// super(cleanupCallback);
// }
// },
// );
primordials.SafeFinalizationRegistry = makeSafe(
FinalizationRegistry,
class SafeFinalizationRegistry extends FinalizationRegistry {
constructor(cleanupCallback) {
super(cleanupCallback);
}
},
);
// TODO(lucacasonato): not present in snapshots. Why?
// primordials.SafeWeakRef = makeSafe(
// WeakRef,
// class SafeWeakRef extends WeakRef {
// constructor(target) {
// super(target);
// }
// },
// );
primordials.SafeWeakRef = makeSafe(
WeakRef,
class SafeWeakRef extends WeakRef {
constructor(target) {
super(target);
}
},
);
const SafePromise = makeSafe(
Promise,