summaryrefslogtreecommitdiff
path: root/ext/webidl/00_webidl.js
diff options
context:
space:
mode:
authorKenta Moriuchi <moriken@kimamass.com>2023-03-01 08:14:16 +0900
committerGitHub <noreply@github.com>2023-03-01 08:14:16 +0900
commit55833cf799979e63c6b027fbbf018272308caf5c (patch)
treecc0ae9aa9116e6296e5e74e1c926cfd94fa26449 /ext/webidl/00_webidl.js
parent6ffbf8a9410f5ea41669efdece60f7f47f77e3c7 (diff)
fix(core): introduce `SafeRegExp` to primordials (#17592)
Diffstat (limited to 'ext/webidl/00_webidl.js')
-rw-r--r--ext/webidl/00_webidl.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/ext/webidl/00_webidl.js b/ext/webidl/00_webidl.js
index 46d0a2c1d..124c81c73 100644
--- a/ext/webidl/00_webidl.js
+++ b/ext/webidl/00_webidl.js
@@ -58,6 +58,7 @@ const {
ReflectHas,
ReflectOwnKeys,
RegExpPrototypeTest,
+ SafeRegExp,
Set,
SetPrototypeEntries,
SetPrototypeForEach,
@@ -386,7 +387,7 @@ converters.DOMString = function (V, opts = {}) {
};
// deno-lint-ignore no-control-regex
-const IS_BYTE_STRING = /^[\x00-\xFF]*$/;
+const IS_BYTE_STRING = new SafeRegExp(/^[\x00-\xFF]*$/);
converters.ByteString = (V, opts) => {
const x = converters.DOMString(V, opts);
if (!RegExpPrototypeTest(IS_BYTE_STRING, x)) {
@@ -500,7 +501,9 @@ ArrayPrototypeForEach(
],
(func) => {
const name = func.name;
- const article = RegExpPrototypeTest(/^[AEIOU]/, name) ? "an" : "a";
+ const article = RegExpPrototypeTest(new SafeRegExp(/^[AEIOU]/), name)
+ ? "an"
+ : "a";
converters[name] = (V, opts = {}) => {
if (TypedArrayPrototypeGetSymbolToStringTag(V) !== name) {
throw makeException(