diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2016-10-07 07:52:09 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-07 07:52:09 -0500 |
commit | a6e4b5bb86ad707a0863acff87344ca4239cfd2c (patch) | |
tree | c820d9f2420c44cdfe29de97f1a710e7dc354bb7 /components/script/dom/file.rs | |
parent | e23959a7618e8e7b7ca20300a2afeb1ac77712f3 (diff) | |
parent | d8e92bb271a9f9dd87bf77e38cd820d01f2f0ae4 (diff) | |
download | servo-a6e4b5bb86ad707a0863acff87344ca4239cfd2c.tar.gz servo-a6e4b5bb86ad707a0863acff87344ca4239cfd2c.zip |
Auto merge of #13596 - nox:inline, r=Ms2ger
Get rid of dom::bindings::global
Globals in that PR are now represented by the fake IDL interface `GlobalScope`.
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/13596)
<!-- Reviewable:end -->
Diffstat (limited to 'components/script/dom/file.rs')
-rw-r--r-- | components/script/dom/file.rs | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/components/script/dom/file.rs b/components/script/dom/file.rs index 8b4abaaed80..dba94a85e50 100644 --- a/components/script/dom/file.rs +++ b/components/script/dom/file.rs @@ -6,11 +6,12 @@ use dom::bindings::codegen::Bindings::FileBinding; use dom::bindings::codegen::Bindings::FileBinding::FileMethods; use dom::bindings::codegen::UnionTypes::BlobOrString; use dom::bindings::error::{Error, Fallible}; -use dom::bindings::global::GlobalRef; +use dom::bindings::inheritance::Castable; use dom::bindings::js::Root; use dom::bindings::reflector::reflect_dom_object; use dom::bindings::str::DOMString; use dom::blob::{Blob, BlobImpl, blob_parts_to_bytes}; +use dom::globalscope::GlobalScope; use dom::window::Window; use net_traits::filemanager_thread::SelectedFile; use time; @@ -41,7 +42,7 @@ impl File { } #[allow(unrooted_must_root)] - pub fn new(global: GlobalRef, blob_impl: BlobImpl, + pub fn new(global: &GlobalScope, blob_impl: BlobImpl, name: DOMString, modified: Option<i64>, typeString: &str) -> Root<File> { reflect_dom_object(box File::new_inherited(blob_impl, name, modified, typeString), global, @@ -52,14 +53,12 @@ impl File { pub fn new_from_selected(window: &Window, selected: SelectedFile) -> Root<File> { let name = DOMString::from(selected.filename.to_str().expect("File name encoding error")); - let global = GlobalRef::Window(window); - - File::new(global, BlobImpl::new_from_file(selected.id, selected.filename, selected.size), + File::new(window.upcast(), BlobImpl::new_from_file(selected.id, selected.filename, selected.size), name, Some(selected.modified as i64), &selected.type_string) } // https://w3c.github.io/FileAPI/#file-constructor - pub fn Constructor(global: GlobalRef, + pub fn Constructor(global: &GlobalScope, fileBits: Vec<BlobOrString>, filename: DOMString, filePropertyBag: &FileBinding::FilePropertyBag) @@ -76,7 +75,11 @@ impl File { // NOTE: Following behaviour might be removed in future, // see https://github.com/w3c/FileAPI/issues/41 let replaced_filename = DOMString::from_string(filename.replace("/", ":")); - Ok(File::new(global, BlobImpl::new_from_bytes(bytes), replaced_filename, modified, typeString)) + Ok(File::new(global, + BlobImpl::new_from_bytes(bytes), + replaced_filename, + modified, + typeString)) } pub fn name(&self) -> &DOMString { |