aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/blob.rs
diff options
context:
space:
mode:
authorZhen Zhang <izgzhen@gmail.com>2016-06-02 15:08:44 +0800
committerZhen Zhang <izgzhen@gmail.com>2016-06-10 02:20:52 +0800
commitf8fa9aaf422d8bfca757d835bc073e769ed8e003 (patch)
treea8c9a1fe9a1e76d11f37ea1693c99a5f9811a97d /components/script/dom/blob.rs
parent3977128d7e8a21425650894c6ecd55b71bcfa042 (diff)
downloadservo-f8fa9aaf422d8bfca757d835bc073e769ed8e003.tar.gz
servo-f8fa9aaf422d8bfca757d835bc073e769ed8e003.zip
Add unit testing to file manager; Replace uuid by stringified version in FileManagerThreadMsg
Diffstat (limited to 'components/script/dom/blob.rs')
-rw-r--r--components/script/dom/blob.rs9
1 files changed, 4 insertions, 5 deletions
diff --git a/components/script/dom/blob.rs b/components/script/dom/blob.rs
index b89aa3b9ac2..d8beec236a8 100644
--- a/components/script/dom/blob.rs
+++ b/components/script/dom/blob.rs
@@ -14,14 +14,13 @@ use dom::bindings::str::DOMString;
use encoding::all::UTF_8;
use encoding::types::{EncoderTrap, Encoding};
use ipc_channel::ipc;
-use net_traits::filemanager_thread::FileManagerThreadMsg;
+use net_traits::filemanager_thread::{FileManagerThreadMsg, SelectedFileId};
use num_traits::ToPrimitive;
use std::ascii::AsciiExt;
use std::borrow::ToOwned;
use std::cell::Cell;
use std::cmp::{max, min};
use std::sync::Arc;
-use uuid::Uuid;
#[derive(Clone, JSTraceable)]
pub struct DataSlice {
@@ -95,7 +94,7 @@ impl DataSlice {
#[derive(Clone, JSTraceable)]
pub enum BlobImpl {
/// File-based, cached backend
- File(Uuid, DOMRefCell<Option<DataSlice>>),
+ File(SelectedFileId, DOMRefCell<Option<DataSlice>>),
/// Memory-based backend
Memory(DataSlice),
}
@@ -107,7 +106,7 @@ impl BlobImpl {
}
/// Construct file-backed BlobImpl from File ID
- pub fn new_from_file(file_id: Uuid) -> BlobImpl {
+ pub fn new_from_file(file_id: SelectedFileId) -> BlobImpl {
BlobImpl::File(file_id, DOMRefCell::new(None))
}
@@ -184,7 +183,7 @@ impl Blob {
}
}
-fn read_file(global: GlobalRef, id: Uuid) -> Result<DataSlice, ()> {
+fn read_file(global: GlobalRef, id: SelectedFileId) -> Result<DataSlice, ()> {
let file_manager = global.filemanager_thread();
let (chan, recv) = ipc::channel().map_err(|_|())?;
let _ = file_manager.send(FileManagerThreadMsg::ReadFile(chan, id));