Auto merge of #12258 - izgzhen:remove-data-slice, r=Manishearth

Remove DataSlice, fix #12249

r? @Manishearth

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #12249

<!-- Either: -->
- [ ] There are tests for these changes OR
- [ ] These changes do not require tests because _____

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/12258)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2016-07-05 06:24:46 -07:00 committed by GitHub
commit 87c7772527
12 changed files with 61 additions and 163 deletions

View file

@ -20,7 +20,7 @@ use dom::bindings::js::{Root, RootedReference};
use dom::bindings::refcounted::Trusted;
use dom::bindings::reflector::{Reflectable, reflect_dom_object};
use dom::bindings::str::{ByteString, DOMString, USVString, is_token};
use dom::blob::{Blob, DataSlice, BlobImpl};
use dom::blob::{Blob, BlobImpl};
use dom::document::DocumentSource;
use dom::document::{Document, IsHTMLDocument};
use dom::event::{Event, EventBubbles, EventCancelable};
@ -1105,8 +1105,8 @@ impl XMLHttpRequest {
let mime = self.final_mime_type().as_ref().map(Mime::to_string).unwrap_or("".to_owned());
// Step 3, 4
let slice = DataSlice::from_bytes(self.response.borrow().to_vec());
let blob = Blob::new(self.global().r(), BlobImpl::new_from_slice(slice), mime);
let bytes = self.response.borrow().to_vec();
let blob = Blob::new(self.global().r(), BlobImpl::new_from_bytes(bytes), mime);
self.response_blob.set(Some(blob.r()));
blob
}
@ -1375,7 +1375,8 @@ impl Extractable for BodyInit {
} else {
Some(b.Type())
};
(b.get_slice_or_empty().get_bytes().to_vec(), content_type)
let bytes = b.get_bytes().unwrap_or(vec![]);
(bytes, content_type)
},
}
}