0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-02-01 20:25:12 -05:00

fix(extension/file): update File constructor following the spec (#10760)

This commit is contained in:
Yoshiya Hinosawa 2021-05-25 22:35:17 +09:00 committed by Bert Belder
parent 18a02c0f79
commit 323fa5272d
No known key found for this signature in database
GPG key ID: 7A77887B2E2ED461
4 changed files with 23 additions and 29 deletions

View file

@ -88,10 +88,6 @@ unitTest(function fileUsingFileName(): void {
testSecondArgument("dummy", "dummy"); testSecondArgument("dummy", "dummy");
}); });
unitTest(function fileUsingSpecialCharacterInFileName(): void {
testSecondArgument("dummy/foo", "dummy:foo");
});
unitTest(function fileUsingNullFileName(): void { unitTest(function fileUsingNullFileName(): void {
testSecondArgument(null, "null"); testSecondArgument(null, "null");
}); });

View file

@ -371,7 +371,7 @@
super(fileBits, options); super(fileBits, options);
/** @type {string} */ /** @type {string} */
this[_Name] = fileName.replaceAll("/", ":"); this[_Name] = fileName;
if (options.lastModified === undefined) { if (options.lastModified === undefined) {
/** @type {number} */ /** @type {number} */
this[_LastModfied] = new Date().getTime(); this[_LastModfied] = new Date().getTime();

View file

@ -374,7 +374,6 @@
"getReader({mode: \"byob\"}) throws on non-bytes streams", "getReader({mode: \"byob\"}) throws on non-bytes streams",
"ReadableStream with byte source can be constructed with no errors", "ReadableStream with byte source can be constructed with no errors",
"getReader({mode}) must perform ToString()", "getReader({mode}) must perform ToString()",
"ReadableStream with byte source: autoAllocateChunkSize cannot be 0",
"ReadableStreamBYOBReader can be constructed directly", "ReadableStreamBYOBReader can be constructed directly",
"ReadableStreamBYOBReader constructor requires a ReadableStream argument", "ReadableStreamBYOBReader constructor requires a ReadableStream argument",
"ReadableStreamBYOBReader constructor requires an unlocked ReadableStream", "ReadableStreamBYOBReader constructor requires an unlocked ReadableStream",
@ -483,7 +482,6 @@
"writable-streams": { "writable-streams": {
"aborting.any.html": false, "aborting.any.html": false,
"bad-strategies.any.html": [ "bad-strategies.any.html": [
"reject any non-function value for strategy.size",
"Writable stream: invalid size beats invalid highWaterMark" "Writable stream: invalid size beats invalid highWaterMark"
], ],
"bad-underlying-sinks.any.html": true, "bad-underlying-sinks.any.html": true,
@ -491,8 +489,6 @@
"close.any.html": false, "close.any.html": false,
"constructor.any.html": [ "constructor.any.html": [
"underlyingSink argument should be converted after queuingStrategy argument", "underlyingSink argument should be converted after queuingStrategy argument",
"WritableStreamDefaultController constructor should throw",
"WritableStreamDefaultController constructor should throw when passed an initialised WritableStream",
"WritableStreamDefaultWriter should throw unless passed a WritableStream" "WritableStreamDefaultWriter should throw unless passed a WritableStream"
], ],
"count-queuing-strategy.any.html": true, "count-queuing-strategy.any.html": true,
@ -522,9 +518,7 @@
"Performance interface: operation mark(DOMString, optional PerformanceMarkOptions)", "Performance interface: operation mark(DOMString, optional PerformanceMarkOptions)",
"Performance interface: operation clearMarks(optional DOMString)", "Performance interface: operation clearMarks(optional DOMString)",
"Performance interface: operation measure(DOMString, optional (DOMString or PerformanceMeasureOptions), optional DOMString)", "Performance interface: operation measure(DOMString, optional (DOMString or PerformanceMeasureOptions), optional DOMString)",
"Performance interface: operation clearMeasures(optional DOMString)", "Performance interface: operation clearMeasures(optional DOMString)"
"Performance interface: calling mark(DOMString, optional PerformanceMarkOptions) on performance with too few arguments must throw TypeError",
"Performance interface: calling measure(DOMString, optional (DOMString or PerformanceMeasureOptions), optional DOMString) on performance with too few arguments must throw TypeError"
], ],
"mark-entry-constructor.any.html": true, "mark-entry-constructor.any.html": true,
"mark-errors.any.html": true, "mark-errors.any.html": true,
@ -583,7 +577,10 @@
"toString.any.html": true, "toString.any.html": true,
"type.tentative.any.html": false, "type.tentative.any.html": false,
"constructor-shared.tentative.any.html": true, "constructor-shared.tentative.any.html": true,
"constructor-types.tentative.any.html": false "constructor-types.tentative.any.html": [
"Zero minimum",
"Non-zero minimum"
]
}, },
"module": { "module": {
"constructor.any.html": true, "constructor.any.html": true,
@ -603,10 +600,12 @@
"toString.any.html": true, "toString.any.html": true,
"constructor-reftypes.tentative.any.html": [ "constructor-reftypes.tentative.any.html": [
"initialize externref table with default value", "initialize externref table with default value",
"initialize anyfunc table with default value", "initialize anyfunc table with default value"
"initialize anyfunc table with a bad default value" ],
"constructor-types.tentative.any.html": [
"Zero minimum",
"Non-zero minimum"
], ],
"constructor-types.tentative.any.html": false,
"grow-reftypes.tentative.any.html": false, "grow-reftypes.tentative.any.html": false,
"set-reftypes.tentative.any.html": false, "set-reftypes.tentative.any.html": false,
"type.tentative.any.html": false "type.tentative.any.html": false
@ -670,6 +669,7 @@
"URL interface: attribute searchParams", "URL interface: attribute searchParams",
"URL interface: attribute hash", "URL interface: attribute hash",
"URL interface: operation toJSON()", "URL interface: operation toJSON()",
"URL interface: legacy window alias",
"Stringification of new URL(\"http://foo\")", "Stringification of new URL(\"http://foo\")",
"URLSearchParams interface: operation append(USVString, USVString)", "URLSearchParams interface: operation append(USVString, USVString)",
"URLSearchParams interface: operation delete(USVString)", "URLSearchParams interface: operation delete(USVString)",
@ -683,12 +683,6 @@
"Stringification of new URLSearchParams(\"hi=there&thank=you\")" "Stringification of new URLSearchParams(\"hi=there&thank=you\")"
], ],
"url-constructor.any.html": [ "url-constructor.any.html": [
"Parsing: <file://%43%7C> against <about:blank>",
"Parsing: <file://%43|> against <about:blank>",
"Parsing: <file://C%7C> against <about:blank>",
"Parsing: <file://%43%7C/> against <about:blank>",
"Parsing: <https://%43%7C/> against <about:blank>",
"Parsing: <asdf://%43|/> against <about:blank>",
"Parsing: </> against <file://h/C:/a/b>", "Parsing: </> against <file://h/C:/a/b>",
"Parsing: <file:\\\\//> against <about:blank>", "Parsing: <file:\\\\//> against <about:blank>",
"Parsing: <file:\\\\\\\\> against <about:blank>", "Parsing: <file:\\\\\\\\> against <about:blank>",
@ -779,11 +773,7 @@
"api": { "api": {
"request": { "request": {
"request-init-002.any.html": true, "request-init-002.any.html": true,
"request-init-stream.any.html": [ "request-init-stream.any.html": true,
"Constructing a Request with a Request on which body.getReader() is called",
"Constructing a Request with a Request on which body.getReader().read() is called",
"Constructing a Request with a Request on which read() and releaseLock() are called"
],
"request-consume-empty.any.html": [ "request-consume-empty.any.html": [
"Consume empty FormData request body as text" "Consume empty FormData request body as text"
], ],
@ -979,7 +969,6 @@
"Response interface: operation formData()", "Response interface: operation formData()",
"Response interface: operation json()", "Response interface: operation json()",
"Response interface: operation text()", "Response interface: operation text()",
"Response interface: calling redirect(USVString, optional unsigned short) on new Response() with too few arguments must throw TypeError",
"Window interface: operation fetch(RequestInfo, optional RequestInit)" "Window interface: operation fetch(RequestInfo, optional RequestInit)"
] ]
}, },
@ -1110,4 +1099,4 @@
"set.any.html": true "set.any.html": true
} }
} }
} }

View file

@ -13,3 +13,12 @@ window.add_result_callback(({ message, name, stack, status }) => {
window.add_completion_callback((_tests, _harnessStatus) => { window.add_completion_callback((_tests, _harnessStatus) => {
Deno.exit(0); Deno.exit(0);
}); });
globalThis.document = {
// document.body shim for FileAPI/file/File-constructor.any.html test
body: {
toString() {
return "[object HTMLBodyElement]";
},
},
};