summaryrefslogtreecommitdiff
path: root/ext/fetch
diff options
context:
space:
mode:
Diffstat (limited to 'ext/fetch')
-rw-r--r--ext/fetch/21_formdata.js8
-rw-r--r--ext/fetch/26_fetch.js4
2 files changed, 7 insertions, 5 deletions
diff --git a/ext/fetch/21_formdata.js b/ext/fetch/21_formdata.js
index 92c914b8c..1961643d2 100644
--- a/ext/fetch/21_formdata.js
+++ b/ext/fetch/21_formdata.js
@@ -22,12 +22,12 @@ const {
ArrayPrototypePush,
ArrayPrototypeSlice,
ArrayPrototypeSplice,
- Map,
MapPrototypeGet,
MapPrototypeSet,
MathRandom,
ObjectFreeze,
ObjectPrototypeIsPrototypeOf,
+ SafeMap,
SafeRegExp,
Symbol,
StringFromCharCode,
@@ -346,13 +346,15 @@ function formDataToBlob(formData) {
});
}
+const QUOTE_CONTENT_PATTERN = new SafeRegExp(/^"([^"]*)"$/);
+
/**
* @param {string} value
* @returns {Map<string, string>}
*/
function parseContentDisposition(value) {
/** @type {Map<string, string>} */
- const params = new Map();
+ const params = new SafeMap();
// Forced to do so for some Map constructor param mismatch
const values = ArrayPrototypeSlice(StringPrototypeSplit(value, ";"), 1);
for (let i = 0; i < values.length; i++) {
@@ -361,7 +363,7 @@ function parseContentDisposition(value) {
MapPrototypeSet(
params,
entries[0],
- StringPrototypeReplace(entries[1], /^"([^"]*)"$/, "$1"),
+ StringPrototypeReplace(entries[1], QUOTE_CONTENT_PATTERN, "$1"),
);
}
}
diff --git a/ext/fetch/26_fetch.js b/ext/fetch/26_fetch.js
index 18cb47a59..42e1ae962 100644
--- a/ext/fetch/26_fetch.js
+++ b/ext/fetch/26_fetch.js
@@ -42,13 +42,13 @@ const {
PromisePrototypeThen,
PromisePrototypeCatch,
SafeArrayIterator,
+ SafeWeakMap,
String,
StringPrototypeStartsWith,
StringPrototypeToLowerCase,
TypeError,
Uint8Array,
Uint8ArrayPrototype,
- WeakMap,
WeakMapPrototypeDelete,
WeakMapPrototypeGet,
WeakMapPrototypeHas,
@@ -62,7 +62,7 @@ const REQUEST_BODY_HEADER_NAMES = [
"content-type",
];
-const requestBodyReaders = new WeakMap();
+const requestBodyReaders = new SafeWeakMap();
/**
* @param {{ method: string, url: string, headers: [string, string][], clientRid: number | null, hasBody: boolean }} args