aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/blob.rs
diff options
context:
space:
mode:
authorbors-servo <metajack+bors@gmail.com>2015-04-26 05:30:28 -0500
committerbors-servo <metajack+bors@gmail.com>2015-04-26 05:30:28 -0500
commit1389be37823fccf4108f4e79d0a3a793f0bbe93e (patch)
tree30b2dc45c0aad707848dab7bfc53a3c11e1bdfe8 /components/script/dom/blob.rs
parentaef48baeb4a67d003c8a88d91d01d3a33ac3620d (diff)
parent9185c3de7984fa46b71a62b2902a707c9d4134c3 (diff)
downloadservo-1389be37823fccf4108f4e79d0a3a793f0bbe93e.tar.gz
servo-1389be37823fccf4108f4e79d0a3a793f0bbe93e.zip
Auto merge of #5847 - Ms2ger:slice, r=SimonSapin
<!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/5847) <!-- Reviewable:end -->
Diffstat (limited to 'components/script/dom/blob.rs')
-rw-r--r--components/script/dom/blob.rs11
1 files changed, 5 insertions, 6 deletions
diff --git a/components/script/dom/blob.rs b/components/script/dom/blob.rs
index bfecd088bbe..47d03d72082 100644
--- a/components/script/dom/blob.rs
+++ b/components/script/dom/blob.rs
@@ -70,12 +70,11 @@ impl Blob {
//TODO: accept other blobParts types - ArrayBuffer or ArrayBufferView or Blob
let bytes: Option<Vec<u8>> = Some(blobParts.into_bytes());
let typeString = if is_ascii_printable(&blobPropertyBag.type_) {
- blobPropertyBag.type_.as_slice()
+ &*blobPropertyBag.type_
} else {
""
};
- let typeStrLower = typeString.as_slice().to_ascii_lowercase();
- Ok(Blob::new(global, bytes, typeStrLower.as_slice()))
+ Ok(Blob::new(global, bytes, &typeString.to_ascii_lowercase()))
}
}
@@ -121,7 +120,7 @@ impl<'a> BlobMethods for JSRef<'a, Blob> {
None => "".to_owned(),
Some(str) => {
if is_ascii_printable(&str) {
- str.as_slice().to_ascii_lowercase().to_owned()
+ str.to_ascii_lowercase()
} else {
"".to_owned()
}
@@ -130,13 +129,13 @@ impl<'a> BlobMethods for JSRef<'a, Blob> {
let span: i64 = max(relativeEnd - relativeStart, 0);
let global = self.global.root();
match self.bytes {
- None => Blob::new(global.r(), None, relativeContentType.as_slice()),
+ None => Blob::new(global.r(), None, &relativeContentType),
Some(ref vec) => {
let start = relativeStart.to_usize().unwrap();
let end = (relativeStart + span).to_usize().unwrap();
let mut bytes: Vec<u8> = Vec::new();
bytes.push_all(&vec[start..end]);
- Blob::new(global.r(), Some(bytes), relativeContentType.as_slice())
+ Blob::new(global.r(), Some(bytes), &relativeContentType)
}
}
}