From 55833cf799979e63c6b027fbbf018272308caf5c Mon Sep 17 00:00:00 2001 From: Kenta Moriuchi Date: Wed, 1 Mar 2023 08:14:16 +0900 Subject: fix(core): introduce `SafeRegExp` to primordials (#17592) --- core/00_primordials.js | 9 +++++++++ core/internal.d.ts | 1 + 2 files changed, 10 insertions(+) (limited to 'core') diff --git a/core/00_primordials.js b/core/00_primordials.js index 6495a5268..243f40e88 100644 --- a/core/00_primordials.js +++ b/core/00_primordials.js @@ -434,6 +434,15 @@ }, ); + primordials.SafeRegExp = makeSafe( + RegExp, + class SafeRegExp extends RegExp { + constructor(pattern, flags) { + super(pattern, flags); + } + }, + ); + primordials.SafeFinalizationRegistry = makeSafe( FinalizationRegistry, class SafeFinalizationRegistry extends FinalizationRegistry { diff --git a/core/internal.d.ts b/core/internal.d.ts index 004e068ff..a91ac6244 100644 --- a/core/internal.d.ts +++ b/core/internal.d.ts @@ -78,6 +78,7 @@ declare namespace __bootstrap { export const SafePromisePrototypeFinally: UncurryThis< Promise.prototype.finally >; + export const SafeRegExp: typeof RegExp; // safe iterators export const SafeArrayIterator: new (array: T[]) => IterableIterator; -- cgit v1.2.3