diff options
Diffstat (limited to 'ext/webidl')
-rw-r--r-- | ext/webidl/00_webidl.js | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/ext/webidl/00_webidl.js b/ext/webidl/00_webidl.js index 0b8d5c03d..88384406a 100644 --- a/ext/webidl/00_webidl.js +++ b/ext/webidl/00_webidl.js @@ -62,7 +62,6 @@ String, StringFromCodePoint, StringPrototypeCharCodeAt, - StringPrototypeCodePointAt, Symbol, SymbolIterator, SymbolToStringTag, @@ -375,15 +374,13 @@ return String(V); }; + // deno-lint-ignore no-control-regex + const IS_BYTE_STRING = /^[\x00-\xFF]*$/; converters.ByteString = (V, opts) => { const x = converters.DOMString(V, opts); - let c; - for (let i = 0; (c = StringPrototypeCodePointAt(x, i)) !== undefined; ++i) { - if (c > 255) { - throw makeException(TypeError, "is not a valid ByteString", opts); - } + if (!RegExpPrototypeTest(IS_BYTE_STRING, x)) { + throw makeException(TypeError, "is not a valid ByteString", opts); } - return x; }; |