Skip to content

Commit

Permalink
Convert directly from DOMString to Vec<u8>
Browse files Browse the repository at this point in the history
  • Loading branch information
saurvs committed Mar 11, 2016
1 parent 53aca4b commit 663e42b
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions components/script/dom/blob.rs
Expand Up @@ -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 {
Expand Down

0 comments on commit 663e42b

Please sign in to comment.