mirror of
https://github.com/servo/servo.git
synced 2025-07-23 23:33:43 +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
|
@ -11,7 +11,7 @@ use dom::bindings::global::GlobalRef;
|
|||
use dom::bindings::js::{JS, Root};
|
||||
use dom::bindings::reflector::{Reflectable, Reflector, reflect_dom_object};
|
||||
use dom::bindings::str::{DOMString, USVString};
|
||||
use dom::blob::Blob;
|
||||
use dom::blob::{Blob, BlobImpl};
|
||||
use dom::file::File;
|
||||
use dom::htmlformelement::HTMLFormElement;
|
||||
use std::collections::HashMap;
|
||||
|
@ -121,14 +121,15 @@ impl FormDataMethods for FormData {
|
|||
|
||||
|
||||
impl FormData {
|
||||
fn get_file_or_blob(&self, value: &Blob, filename: Option<USVString>) -> Root<Blob> {
|
||||
fn get_file_or_blob(&self, blob: &Blob, filename: Option<USVString>) -> Root<Blob> {
|
||||
match filename {
|
||||
Some(fname) => {
|
||||
let global = self.global();
|
||||
let name = DOMString::from(fname.0);
|
||||
Root::upcast(File::new(global.r(), value.get_data().clone(), name, None, ""))
|
||||
let slice = blob.get_slice_or_empty();
|
||||
Root::upcast(File::new(global.r(), BlobImpl::new_from_slice(slice), name, None, ""))
|
||||
}
|
||||
None => Root::from_ref(value)
|
||||
None => Root::from_ref(blob)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue