mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Convert directly from DOMString to Vec<u8>
This commit is contained in:
parent
53aca4b80e
commit
663e42bdbd
1 changed files with 1 additions and 3 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue