aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--components/script/dom/blob.rs7
-rw-r--r--components/script/dom/file.rs5
-rw-r--r--tests/wpt/metadata/FileAPI/file/File-constructor.html.ini5
3 files changed, 8 insertions, 9 deletions
diff --git a/components/script/dom/blob.rs b/components/script/dom/blob.rs
index f63e66e3b7b..1e3c74e1e26 100644
--- a/components/script/dom/blob.rs
+++ b/components/script/dom/blob.rs
@@ -20,6 +20,7 @@ use net_traits::filemanager_thread::{FileManagerThreadMsg, SelectedFileId, Relat
use std::cell::Cell;
use std::ops::Index;
use std::path::PathBuf;
+use uuid::Uuid;
/// File-based blob
#[derive(JSTraceable)]
@@ -183,7 +184,7 @@ impl Blob {
match rx.recv().unwrap() {
Ok(_) => f.id.clone(),
- Err(_) => SelectedFileId("".to_string()) // Return a dummy id on error
+ Err(_) => SelectedFileId(Uuid::new_v4().simple().to_string()) // Return a dummy id on error
}
}
BlobImpl::Memory(ref slice) => {
@@ -194,7 +195,7 @@ impl Blob {
BlobImpl::Sliced(_, _) => {
debug!("Sliced can't have a sliced parent");
// Return dummy id
- SelectedFileId("".to_string())
+ SelectedFileId(Uuid::new_v4().simple().to_string())
}
BlobImpl::File(ref f) =>
self.create_sliced_url_id(&f.id, rel_pos),
@@ -230,7 +231,7 @@ impl Blob {
match rx.recv().unwrap() {
Ok(new_id) => SelectedFileId(new_id.0),
// Dummy id
- Err(_) => SelectedFileId("".to_string()),
+ Err(_) => SelectedFileId(Uuid::new_v4().simple().to_string()),
}
}
diff --git a/components/script/dom/file.rs b/components/script/dom/file.rs
index 4528a116e45..f9b181dbf1a 100644
--- a/components/script/dom/file.rs
+++ b/components/script/dom/file.rs
@@ -73,7 +73,10 @@ impl File {
let ref typeString = blobPropertyBag.type_;
let modified = filePropertyBag.lastModified;
- Ok(File::new(global, BlobImpl::new_from_bytes(bytes), filename, modified, typeString))
+ // NOTE: Following behaviour might be removed in future,
+ // see https://github.com/w3c/FileAPI/issues/41
+ let replaced_filename = DOMString::from_string(filename.replace("/", ":"));
+ Ok(File::new(global, BlobImpl::new_from_bytes(bytes), replaced_filename, modified, typeString))
}
pub fn name(&self) -> &DOMString {
diff --git a/tests/wpt/metadata/FileAPI/file/File-constructor.html.ini b/tests/wpt/metadata/FileAPI/file/File-constructor.html.ini
index d9c18b41655..79167726fa2 100644
--- a/tests/wpt/metadata/FileAPI/file/File-constructor.html.ini
+++ b/tests/wpt/metadata/FileAPI/file/File-constructor.html.ini
@@ -11,8 +11,3 @@
[Various fileBits]
expected: FAIL
bug: https://github.com/servo/servo/issues/10911
-
- [Using special character in fileName]
- expected: FAIL
- bug: https://github.com/w3c/FileAPI/issues/41
-