mirror of
https://github.com/denoland/deno.git
synced 2025-08-04 02:48:24 +00:00
This reverts commit 884143218f
.
This commit is contained in:
parent
382a978859
commit
f248e6f177
41 changed files with 658 additions and 1028 deletions
|
@ -13,8 +13,7 @@
|
|||
((window) => {
|
||||
const core = window.Deno.core;
|
||||
const webidl = globalThis.__bootstrap.webidl;
|
||||
const { Blob, BlobPrototype, File, FilePrototype } =
|
||||
globalThis.__bootstrap.file;
|
||||
const { Blob, File } = globalThis.__bootstrap.file;
|
||||
const {
|
||||
ArrayPrototypeMap,
|
||||
ArrayPrototypePush,
|
||||
|
@ -26,7 +25,6 @@
|
|||
MapPrototypeGet,
|
||||
MapPrototypeSet,
|
||||
MathRandom,
|
||||
ObjectPrototypeIsPrototypeOf,
|
||||
Symbol,
|
||||
StringFromCharCode,
|
||||
StringPrototypeTrim,
|
||||
|
@ -50,16 +48,10 @@
|
|||
* @returns {FormDataEntry}
|
||||
*/
|
||||
function createEntry(name, value, filename) {
|
||||
if (
|
||||
ObjectPrototypeIsPrototypeOf(BlobPrototype, value) &&
|
||||
!ObjectPrototypeIsPrototypeOf(FilePrototype, value)
|
||||
) {
|
||||
if (value instanceof Blob && !(value instanceof File)) {
|
||||
value = new File([value], "blob", { type: value.type });
|
||||
}
|
||||
if (
|
||||
ObjectPrototypeIsPrototypeOf(FilePrototype, value) &&
|
||||
filename !== undefined
|
||||
) {
|
||||
if (value instanceof File && filename !== undefined) {
|
||||
value = new File([value], filename, {
|
||||
type: value.type,
|
||||
lastModified: value.lastModified,
|
||||
|
@ -97,7 +89,7 @@
|
|||
* @returns {void}
|
||||
*/
|
||||
append(name, valueOrBlobValue, filename) {
|
||||
webidl.assertBranded(this, FormDataPrototype);
|
||||
webidl.assertBranded(this, FormData);
|
||||
const prefix = "Failed to execute 'append' on 'FormData'";
|
||||
webidl.requiredArguments(arguments.length, 2, { prefix });
|
||||
|
||||
|
@ -105,7 +97,7 @@
|
|||
prefix,
|
||||
context: "Argument 1",
|
||||
});
|
||||
if (ObjectPrototypeIsPrototypeOf(BlobPrototype, valueOrBlobValue)) {
|
||||
if (valueOrBlobValue instanceof Blob) {
|
||||
valueOrBlobValue = webidl.converters["Blob"](valueOrBlobValue, {
|
||||
prefix,
|
||||
context: "Argument 2",
|
||||
|
@ -133,7 +125,7 @@
|
|||
* @returns {void}
|
||||
*/
|
||||
delete(name) {
|
||||
webidl.assertBranded(this, FormDataPrototype);
|
||||
webidl.assertBranded(this, FormData);
|
||||
const prefix = "Failed to execute 'name' on 'FormData'";
|
||||
webidl.requiredArguments(arguments.length, 1, { prefix });
|
||||
|
||||
|
@ -156,7 +148,7 @@
|
|||
* @returns {FormDataEntryValue | null}
|
||||
*/
|
||||
get(name) {
|
||||
webidl.assertBranded(this, FormDataPrototype);
|
||||
webidl.assertBranded(this, FormData);
|
||||
const prefix = "Failed to execute 'get' on 'FormData'";
|
||||
webidl.requiredArguments(arguments.length, 1, { prefix });
|
||||
|
||||
|
@ -176,7 +168,7 @@
|
|||
* @returns {FormDataEntryValue[]}
|
||||
*/
|
||||
getAll(name) {
|
||||
webidl.assertBranded(this, FormDataPrototype);
|
||||
webidl.assertBranded(this, FormData);
|
||||
const prefix = "Failed to execute 'getAll' on 'FormData'";
|
||||
webidl.requiredArguments(arguments.length, 1, { prefix });
|
||||
|
||||
|
@ -197,7 +189,7 @@
|
|||
* @returns {boolean}
|
||||
*/
|
||||
has(name) {
|
||||
webidl.assertBranded(this, FormDataPrototype);
|
||||
webidl.assertBranded(this, FormData);
|
||||
const prefix = "Failed to execute 'has' on 'FormData'";
|
||||
webidl.requiredArguments(arguments.length, 1, { prefix });
|
||||
|
||||
|
@ -219,7 +211,7 @@
|
|||
* @returns {void}
|
||||
*/
|
||||
set(name, valueOrBlobValue, filename) {
|
||||
webidl.assertBranded(this, FormDataPrototype);
|
||||
webidl.assertBranded(this, FormData);
|
||||
const prefix = "Failed to execute 'set' on 'FormData'";
|
||||
webidl.requiredArguments(arguments.length, 2, { prefix });
|
||||
|
||||
|
@ -227,7 +219,7 @@
|
|||
prefix,
|
||||
context: "Argument 1",
|
||||
});
|
||||
if (ObjectPrototypeIsPrototypeOf(BlobPrototype, valueOrBlobValue)) {
|
||||
if (valueOrBlobValue instanceof Blob) {
|
||||
valueOrBlobValue = webidl.converters["Blob"](valueOrBlobValue, {
|
||||
prefix,
|
||||
context: "Argument 2",
|
||||
|
@ -269,7 +261,6 @@
|
|||
webidl.mixinPairIterable("FormData", FormData, entryList, "name", "value");
|
||||
|
||||
webidl.configurePrototype(FormData);
|
||||
const FormDataPrototype = FormData.prototype;
|
||||
|
||||
const escape = (str, isFilename) =>
|
||||
StringPrototypeReplace(
|
||||
|
@ -500,11 +491,10 @@
|
|||
}
|
||||
|
||||
webidl.converters["FormData"] = webidl
|
||||
.createInterfaceConverter("FormData", FormDataPrototype);
|
||||
.createInterfaceConverter("FormData", FormData);
|
||||
|
||||
globalThis.__bootstrap.formData = {
|
||||
FormData,
|
||||
FormDataPrototype,
|
||||
formDataToBlob,
|
||||
parseFormData,
|
||||
formDataFromEntries,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue