mirror of
https://github.com/denoland/deno.git
synced 2025-08-04 19:08:15 +00:00
fix(core): Use safe primordials wrappers (#18687)
This commit is contained in:
parent
136dce67ce
commit
f086ec57b4
22 changed files with 83 additions and 60 deletions
|
@ -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"),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue