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:
parent
5d24ddf9b2
commit
7e5698fb2e
1 changed files with 18 additions and 22 deletions
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue