diff options
Diffstat (limited to 'components/script/dom/blob.rs')
-rw-r--r-- | components/script/dom/blob.rs | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/components/script/dom/blob.rs b/components/script/dom/blob.rs index aef31efd687..011f547c96a 100644 --- a/components/script/dom/blob.rs +++ b/components/script/dom/blob.rs @@ -11,6 +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; +use dom::globalscope::GlobalScope; use encoding::all::UTF_8; use encoding::types::{EncoderTrap, Encoding}; use ipc_channel::ipc; @@ -79,7 +80,9 @@ pub struct Blob { impl Blob { #[allow(unrooted_must_root)] - pub fn new(global: GlobalRef, blob_impl: BlobImpl, typeString: String) -> Root<Blob> { + pub fn new( + global: &GlobalScope, blob_impl: BlobImpl, typeString: String) + -> Root<Blob> { let boxed_blob = box Blob::new_inherited(blob_impl, typeString); reflect_dom_object(boxed_blob, global, BlobBinding::Wrap) } @@ -99,7 +102,6 @@ impl Blob { #[allow(unrooted_must_root)] fn new_sliced(parent: &Blob, rel_pos: RelativePos, relative_content_type: DOMString) -> Root<Blob> { - let global = parent.global(); let blob_impl = match *parent.blob_impl.borrow() { BlobImpl::File(_) => { // Create new parent node @@ -115,7 +117,7 @@ impl Blob { } }; - Blob::new(global.r(), blob_impl, relative_content_type.into()) + Blob::new(parent.global().r().as_global_scope(), blob_impl, relative_content_type.into()) } // https://w3c.github.io/FileAPI/#constructorBlob @@ -132,7 +134,7 @@ impl Blob { } }; - Ok(Blob::new(global, BlobImpl::new_from_bytes(bytes), blobPropertyBag.type_.to_string())) + Ok(Blob::new(global.as_global_scope(), BlobImpl::new_from_bytes(bytes), blobPropertyBag.type_.to_string())) } /// Get a slice to inner data, this might incur synchronous read and caching |