diff --git a/components/script/dom/file.rs b/components/script/dom/file.rs index 14a0ce68094..b80b02b0d0e 100644 --- a/components/script/dom/file.rs +++ b/components/script/dom/file.rs @@ -108,6 +108,10 @@ impl File { pub(crate) fn file_type(&self) -> String { self.blob.type_string() } + + pub(crate) fn get_modified(&self) -> SystemTime { + self.modified + } } impl FileMethods for File { @@ -132,15 +136,12 @@ impl FileMethods for File { .map(|modified| OffsetDateTime::UNIX_EPOCH + Duration::milliseconds(modified)) .map(Into::into); - // NOTE: Following behaviour might be removed in future, - // see https://github.com/w3c/FileAPI/issues/41 - let replaced_filename = DOMString::from_string(filename.replace('/', ":")); let type_string = normalize_type_string(blobPropertyBag.type_.as_ref()); Ok(File::new_with_proto( global, proto, BlobImpl::new_from_bytes(bytes, type_string), - replaced_filename, + filename, modified, can_gc, )) diff --git a/components/script/dom/formdata.rs b/components/script/dom/formdata.rs index 1082a202f34..7703ecb0e76 100644 --- a/components/script/dom/formdata.rs +++ b/components/script/dom/formdata.rs @@ -275,12 +275,13 @@ impl FormData { }; let bytes = blob.get_bytes().unwrap_or_default(); + let last_modified = blob.downcast::().map(|file| file.get_modified()); File::new( &self.global(), BlobImpl::new_from_bytes(bytes, blob.type_string()), name, - None, + last_modified, can_gc, ) } diff --git a/tests/wpt/meta/FileAPI/file/File-constructor.any.js.ini b/tests/wpt/meta/FileAPI/file/File-constructor.any.js.ini deleted file mode 100644 index 1c83950aa88..00000000000 --- a/tests/wpt/meta/FileAPI/file/File-constructor.any.js.ini +++ /dev/null @@ -1,8 +0,0 @@ -[File-constructor.any.html] - [No replacement when using special character in fileName] - expected: FAIL - - -[File-constructor.any.worker.html] - [No replacement when using special character in fileName] - expected: FAIL diff --git a/tests/wpt/meta/xhr/formdata/set-blob.any.js.ini b/tests/wpt/meta/xhr/formdata/set-blob.any.js.ini deleted file mode 100644 index aee33830031..00000000000 --- a/tests/wpt/meta/xhr/formdata/set-blob.any.js.ini +++ /dev/null @@ -1,8 +0,0 @@ -[set-blob.any.html] - [file with lastModified and custom name] - expected: FAIL - - -[set-blob.any.worker.html] - [file with lastModified and custom name] - expected: FAIL