summaryrefslogtreecommitdiff
path: root/ext/web/09_file.js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/web/09_file.js')
-rw-r--r--ext/web/09_file.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/ext/web/09_file.js b/ext/web/09_file.js
index b44537dd4..c2fe7782c 100644
--- a/ext/web/09_file.js
+++ b/ext/web/09_file.js
@@ -29,6 +29,7 @@ const {
RegExpPrototypeTest,
// TODO(lucacasonato): add SharedArrayBuffer to primordials
// SharedArrayBufferPrototype
+ SafeRegExp,
StringPrototypeCharAt,
StringPrototypeToLowerCase,
StringPrototypeSlice,
@@ -143,13 +144,15 @@ function processBlobParts(parts, endings) {
return { parts: processedParts, size };
}
+const NORMALIZE_PATTERN = new SafeRegExp(/^[\x20-\x7E]*$/);
+
/**
* @param {string} str
* @returns {string}
*/
function normalizeType(str) {
let normalizedType = str;
- if (!RegExpPrototypeTest(/^[\x20-\x7E]*$/, str)) {
+ if (!RegExpPrototypeTest(NORMALIZE_PATTERN, str)) {
normalizedType = "";
}
return StringPrototypeToLowerCase(normalizedType);