mirror of
https://github.com/servo/servo.git
synced 2025-08-04 13:10:20 +01:00
Auto merge of #9967 - saurvs:master, r=Ms2ger
Convert directly from DOMString to Vec<u8> <!-- Reviewable:start --> This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9967) <!-- Reviewable:end -->
This commit is contained in:
commit
00ab2e9f9e
1 changed files with 1 additions and 3 deletions
|
@ -124,14 +124,12 @@ impl Blob {
|
||||||
blobPropertyBag: &BlobBinding::BlobPropertyBag)
|
blobPropertyBag: &BlobBinding::BlobPropertyBag)
|
||||||
-> Fallible<Root<Blob>> {
|
-> Fallible<Root<Blob>> {
|
||||||
// TODO: accept other blobParts types - ArrayBuffer or ArrayBufferView or 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_) {
|
let typeString = if is_ascii_printable(&blobPropertyBag.type_) {
|
||||||
&*blobPropertyBag.type_
|
&*blobPropertyBag.type_
|
||||||
} else {
|
} 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 {
|
pub fn get_data(&self) -> &DataSlice {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue