mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
Add file backend support for Blob and related
Changes include: - Add BlobImpl to Blob, and related caching mechanism - Expose ResourceThreads to document_loader, workerglobalscope, worker, and global - Fix encode_multipart_form_data - Other small fixes to accommodate the above changes
This commit is contained in:
parent
d53507f747
commit
43ad4ba585
18 changed files with 253 additions and 152 deletions
|
@ -16,7 +16,7 @@ use dom::bindings::js::Root;
|
|||
use dom::bindings::refcounted::Trusted;
|
||||
use dom::bindings::reflector::{Reflectable, reflect_dom_object};
|
||||
use dom::bindings::str::{DOMString, USVString, is_token};
|
||||
use dom::blob::{Blob, DataSlice};
|
||||
use dom::blob::{Blob, BlobImpl, DataSlice};
|
||||
use dom::closeevent::CloseEvent;
|
||||
use dom::event::{Event, EventBubbles, EventCancelable};
|
||||
use dom::eventtarget::EventTarget;
|
||||
|
@ -40,7 +40,6 @@ use std::ascii::AsciiExt;
|
|||
use std::borrow::ToOwned;
|
||||
use std::cell::Cell;
|
||||
use std::ptr;
|
||||
use std::sync::Arc;
|
||||
use std::thread;
|
||||
use websocket::client::request::Url;
|
||||
use websocket::header::{Headers, WebSocketProtocol};
|
||||
|
@ -406,7 +405,7 @@ impl WebSocketMethods for WebSocket {
|
|||
if send_data {
|
||||
let mut other_sender = self.sender.borrow_mut();
|
||||
let my_sender = other_sender.as_mut().unwrap();
|
||||
let bytes = blob.get_data().get_bytes().to_vec();
|
||||
let bytes = blob.get_slice_or_empty().get_bytes().to_vec();
|
||||
let _ = my_sender.send(WebSocketDomAction::SendMessage(MessageData::Binary(bytes)));
|
||||
}
|
||||
|
||||
|
@ -592,8 +591,8 @@ impl Runnable for MessageReceivedTask {
|
|||
MessageData::Binary(data) => {
|
||||
match ws.binary_type.get() {
|
||||
BinaryType::Blob => {
|
||||
let slice = DataSlice::new(Arc::new(data), None, None);
|
||||
let blob = Blob::new(global.r(), slice, "");
|
||||
let slice = DataSlice::from_bytes(data);
|
||||
let blob = Blob::new(global.r(), BlobImpl::new_from_slice(slice), "");
|
||||
blob.to_jsval(cx, message.handle_mut());
|
||||
}
|
||||
BinaryType::Arraybuffer => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue