diff options
author | Achal Shah <achal@uber.com> | 2016-06-16 23:29:09 -0700 |
---|---|---|
committer | Achal Shah <achal@uber.com> | 2016-06-17 07:43:11 -0700 |
commit | af325a9a3a8685f3911dd30169c11b2252432ab2 (patch) | |
tree | 1df55893fd5ae860cbc055105bf18e8abc540100 /components/script/dom/blob.rs | |
parent | 3b98ce0dcce8e3e0b411368fc0a0b1043d91377a (diff) | |
download | servo-af325a9a3a8685f3911dd30169c11b2252432ab2.tar.gz servo-af325a9a3a8685f3911dd30169c11b2252432ab2.zip |
Update Blob::{new, new_inherited} to take Strings
Diffstat (limited to 'components/script/dom/blob.rs')
-rw-r--r-- | components/script/dom/blob.rs | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/components/script/dom/blob.rs b/components/script/dom/blob.rs index d8beec236a8..dcb4c68f34a 100644 --- a/components/script/dom/blob.rs +++ b/components/script/dom/blob.rs @@ -17,7 +17,6 @@ use ipc_channel::ipc; 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; @@ -127,16 +126,16 @@ pub struct Blob { } impl Blob { - pub fn new(global: GlobalRef, blob_impl: BlobImpl, typeString: &str) -> Root<Blob> { + pub fn new(global: GlobalRef, blob_impl: BlobImpl, typeString: String) -> Root<Blob> { let boxed_blob = box Blob::new_inherited(blob_impl, typeString); reflect_dom_object(boxed_blob, global, BlobBinding::Wrap) } - pub fn new_inherited(blob_impl: BlobImpl, typeString: &str) -> Blob { + pub fn new_inherited(blob_impl: BlobImpl, typeString: String) -> Blob { Blob { reflector_: Reflector::new(), blob_impl: blob_impl, - typeString: typeString.to_owned(), + typeString: typeString, isClosed_: Cell::new(false), } } @@ -156,7 +155,7 @@ impl Blob { }; let slice = DataSlice::from_bytes(bytes); - Ok(Blob::new(global, BlobImpl::new_from_slice(slice), &blobPropertyBag.get_typestring())) + Ok(Blob::new(global, BlobImpl::new_from_slice(slice), blobPropertyBag.get_typestring())) } /// Get a slice to inner data, this might incur synchronous read and caching @@ -252,7 +251,7 @@ impl BlobMethods for Blob { let global = self.global(); let bytes = self.get_slice_or_empty().bytes.clone(); let slice = DataSlice::new(bytes, start, end); - Blob::new(global.r(), BlobImpl::new_from_slice(slice), &relativeContentType) + Blob::new(global.r(), BlobImpl::new_from_slice(slice), relativeContentType.into()) } // https://w3c.github.io/FileAPI/#dfn-isClosed |