1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-29 16:30:56 -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", "Date",
"Error", "Error",
"EvalError", "EvalError",
// TODO(lucacasonato): not present in snapshots. Why? "FinalizationRegistry",
// "FinalizationRegistry",
"Float32Array", "Float32Array",
"Float64Array", "Float64Array",
"Function", "Function",
@ -231,8 +230,7 @@
"Uint8Array", "Uint8Array",
"Uint8ClampedArray", "Uint8ClampedArray",
"WeakMap", "WeakMap",
// TODO(lucacasonato): not present in snapshots. Why? "WeakRef",
// "WeakRef",
"WeakSet", "WeakSet",
].forEach((name) => { ].forEach((name) => {
const original = globalThis[name]; const original = globalThis[name];
@ -410,25 +408,23 @@
}, },
); );
// TODO(lucacasonato): not present in snapshots. Why? primordials.SafeFinalizationRegistry = makeSafe(
// primordials.SafeFinalizationRegistry = makeSafe( FinalizationRegistry,
// FinalizationRegistry, class SafeFinalizationRegistry extends FinalizationRegistry {
// class SafeFinalizationRegistry extends FinalizationRegistry { constructor(cleanupCallback) {
// constructor(cleanupCallback) { super(cleanupCallback);
// super(cleanupCallback); }
// } },
// }, );
// );
// TODO(lucacasonato): not present in snapshots. Why? primordials.SafeWeakRef = makeSafe(
// primordials.SafeWeakRef = makeSafe( WeakRef,
// WeakRef, class SafeWeakRef extends WeakRef {
// class SafeWeakRef extends WeakRef { constructor(target) {
// constructor(target) { super(target);
// super(target); }
// } },
// }, );
// );
const SafePromise = makeSafe( const SafePromise = makeSafe(
Promise, Promise,