diff options
Diffstat (limited to 'components/script')
-rw-r--r-- | components/script/Cargo.toml | 6 | ||||
-rw-r--r-- | components/script/dom/blob.rs | 24 | ||||
-rw-r--r-- | components/script/dom/file.rs | 4 | ||||
-rw-r--r-- | components/script/dom/webidls/Blob.webidl | 2 | ||||
-rw-r--r-- | components/script/dom/worklet.rs | 2 |
5 files changed, 23 insertions, 15 deletions
diff --git a/components/script/Cargo.toml b/components/script/Cargo.toml index 0d2b8a5b3d0..4730eeeb18a 100644 --- a/components/script/Cargo.toml +++ b/components/script/Cargo.toml @@ -51,7 +51,7 @@ html5ever = "0.22" hyper = "0.10" hyper_serde = "0.8" image = "0.18" -ipc-channel = "0.9" +ipc-channel = "0.10" jstraceable_derive = {path = "../jstraceable_derive"} lazy_static = "1" libc = "0.2" @@ -67,7 +67,7 @@ msg = {path = "../msg"} net_traits = {path = "../net_traits"} num-traits = "0.1.32" offscreen_gl_context = { version = "0.15", features = ["serde"] } -parking_lot = "0.4" +parking_lot = "0.5" phf = "0.7.18" profile_traits = {path = "../profile_traits"} ref_filter_map = "1.0.1" @@ -93,7 +93,7 @@ time = "0.1.12" unicode-segmentation = "1.1.0" url = "1.6" utf-8 = "0.7" -uuid = {version = "0.5", features = ["v4"]} +uuid = {version = "0.6", features = ["v4"]} xml5ever = {version = "0.12"} webrender_api = {git = "https://github.com/servo/webrender", features = ["ipc"]} webvr_traits = {path = "../webvr_traits"} diff --git a/components/script/dom/blob.rs b/components/script/dom/blob.rs index 32d923c7bc3..beb7ed69df3 100644 --- a/components/script/dom/blob.rs +++ b/components/script/dom/blob.rs @@ -5,7 +5,7 @@ use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::BlobBinding; use dom::bindings::codegen::Bindings::BlobBinding::BlobMethods; -use dom::bindings::codegen::UnionTypes::BlobOrString; +use dom::bindings::codegen::UnionTypes::ArrayBufferOrArrayBufferViewOrBlobOrString; use dom::bindings::error::{Error, Fallible}; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; use dom::bindings::root::{Dom, DomRoot}; @@ -43,7 +43,7 @@ pub enum BlobImpl { /// relative positions of current slicing range, /// IMPORTANT: The depth of tree is only two, i.e. the parent Blob must be /// either File-based or Memory-based - Sliced(Dom<Blob>, RelativePos), + Sliced(Dom<Blob>, RelativePos) } impl BlobImpl { @@ -117,7 +117,7 @@ impl Blob { // https://w3c.github.io/FileAPI/#constructorBlob pub fn Constructor(global: &GlobalScope, - blobParts: Option<Vec<BlobOrString>>, + blobParts: Option<Vec<ArrayBufferOrArrayBufferViewOrBlobOrString>>, blobPropertyBag: &BlobBinding::BlobPropertyBag) -> Fallible<DomRoot<Blob>> { // TODO: accept other blobParts types - ArrayBuffer or ArrayBufferView @@ -329,18 +329,26 @@ fn read_file(global: &GlobalScope, id: Uuid) -> Result<Vec<u8>, ()> { /// Extract bytes from BlobParts, used by Blob and File constructor /// <https://w3c.github.io/FileAPI/#constructorBlob> -pub fn blob_parts_to_bytes(blobparts: Vec<BlobOrString>) -> Result<Vec<u8>, ()> { +#[allow(unsafe_code)] +pub fn blob_parts_to_bytes(mut blobparts: Vec<ArrayBufferOrArrayBufferViewOrBlobOrString>) -> Result<Vec<u8>, ()> { let mut ret = vec![]; - - for blobpart in &blobparts { + for blobpart in &mut blobparts { match blobpart { - &BlobOrString::String(ref s) => { + &mut ArrayBufferOrArrayBufferViewOrBlobOrString::String(ref s) => { ret.extend(s.as_bytes()); }, - &BlobOrString::Blob(ref b) => { + &mut ArrayBufferOrArrayBufferViewOrBlobOrString::Blob(ref b) => { let bytes = b.get_bytes().unwrap_or(vec![]); ret.extend(bytes); }, + &mut ArrayBufferOrArrayBufferViewOrBlobOrString::ArrayBuffer(ref mut a) => unsafe { + let bytes = a.as_slice(); + ret.extend(bytes); + }, + &mut ArrayBufferOrArrayBufferViewOrBlobOrString::ArrayBufferView(ref mut a) => unsafe { + let bytes = a.as_slice(); + ret.extend(bytes); + } } } diff --git a/components/script/dom/file.rs b/components/script/dom/file.rs index e80c92cf83b..942fbb1a055 100644 --- a/components/script/dom/file.rs +++ b/components/script/dom/file.rs @@ -4,7 +4,7 @@ use dom::bindings::codegen::Bindings::FileBinding; use dom::bindings::codegen::Bindings::FileBinding::FileMethods; -use dom::bindings::codegen::UnionTypes::BlobOrString; +use dom::bindings::codegen::UnionTypes::ArrayBufferOrArrayBufferViewOrBlobOrString; use dom::bindings::error::{Error, Fallible}; use dom::bindings::inheritance::Castable; use dom::bindings::reflector::reflect_dom_object; @@ -60,7 +60,7 @@ impl File { // https://w3c.github.io/FileAPI/#file-constructor pub fn Constructor(global: &GlobalScope, - fileBits: Vec<BlobOrString>, + fileBits: Vec<ArrayBufferOrArrayBufferViewOrBlobOrString>, filename: DOMString, filePropertyBag: &FileBinding::FilePropertyBag) -> Fallible<DomRoot<File>> { diff --git a/components/script/dom/webidls/Blob.webidl b/components/script/dom/webidls/Blob.webidl index 18a009d39a9..0e96a894c35 100644 --- a/components/script/dom/webidls/Blob.webidl +++ b/components/script/dom/webidls/Blob.webidl @@ -22,4 +22,4 @@ dictionary BlobPropertyBag { DOMString type = ""; }; -typedef (/*ArrayBuffer or ArrayBufferView or */Blob or DOMString) BlobPart; +typedef (ArrayBuffer or ArrayBufferView or Blob or DOMString) BlobPart; diff --git a/components/script/dom/worklet.rs b/components/script/dom/worklet.rs index 55b99fe919b..95f639aedaa 100644 --- a/components/script/dom/worklet.rs +++ b/components/script/dom/worklet.rs @@ -154,7 +154,7 @@ malloc_size_of_is_0!(WorkletId); impl WorkletId { fn new() -> WorkletId { - WorkletId(servo_rand::random()) + WorkletId(servo_rand::random_uuid()) } } |