diff options
author | Saurav Sachidanand <sauravsachidanand@gmail.com> | 2016-03-11 17:14:57 +0530 |
---|---|---|
committer | Saurav Sachidanand <sauravsachidanand@gmail.com> | 2016-03-11 23:38:16 +0530 |
commit | 663e42bdbd8999dee4fe024c79588ec42e2fbe81 (patch) | |
tree | 2ebd37c2537bbd35eda03f2fe2534db8018197c3 | |
parent | 53aca4b80eef2890c43dd2d0e905b25588651191 (diff) | |
download | servo-663e42bdbd8999dee4fe024c79588ec42e2fbe81.tar.gz servo-663e42bdbd8999dee4fe024c79588ec42e2fbe81.zip |
Convert directly from DOMString to Vec<u8>
-rw-r--r-- | components/script/dom/blob.rs | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/components/script/dom/blob.rs b/components/script/dom/blob.rs index 7e8f350b837..dc24cbb01fc 100644 --- a/components/script/dom/blob.rs +++ b/components/script/dom/blob.rs @@ -124,14 +124,12 @@ impl Blob { blobPropertyBag: &BlobBinding::BlobPropertyBag) -> Fallible<Root<Blob>> { // TODO: accept other blobParts types - ArrayBuffer or ArrayBufferView or Blob - // FIXME(ajeffrey): convert directly from a DOMString to a Vec<u8> - let bytes: Vec<u8> = String::from(blobParts).into_bytes(); let typeString = if is_ascii_printable(&blobPropertyBag.type_) { &*blobPropertyBag.type_ } else { "" }; - Ok(Blob::new(global, bytes, &typeString.to_ascii_lowercase())) + Ok(Blob::new(global, blobParts.into(), &typeString.to_ascii_lowercase())) } pub fn get_data(&self) -> &DataSlice { |