From 5a548431119b1bf8f45958f97df72c0cf35a2bea Mon Sep 17 00:00:00 2001 From: Matt McCoy Date: Thu, 8 Jan 2015 11:16:55 -0500 Subject: [PATCH] Fixes #4164 Make file.rs Constructor and new functions take GlobalRef by value --- components/script/dom/file.rs | 8 ++++---- components/script/dom/formdata.rs | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/components/script/dom/file.rs b/components/script/dom/file.rs index 3acedb43265a..482b0aa9478d 100644 --- a/components/script/dom/file.rs +++ b/components/script/dom/file.rs @@ -17,20 +17,20 @@ pub struct File { } impl File { - fn new_inherited(global: &GlobalRef, type_: BlobTypeId, + fn new_inherited(global: GlobalRef, type_: BlobTypeId, _file_bits: JSRef, name: DOMString) -> File { File { //TODO: get type from the underlying filesystem instead of "".to_string() - blob: Blob::new_inherited(*global, type_, None, ""), + blob: Blob::new_inherited(global, type_, None, ""), name: name, } // XXXManishearth Once Blob is able to store data // the relevant subfields of file_bits should be copied over } - pub fn new(global: &GlobalRef, file_bits: JSRef, name: DOMString) -> Temporary { + pub fn new(global: GlobalRef, file_bits: JSRef, name: DOMString) -> Temporary { reflect_dom_object(box File::new_inherited(global, BlobTypeId::File, file_bits, name), - *global, + global, FileBinding::Wrap) } diff --git a/components/script/dom/formdata.rs b/components/script/dom/formdata.rs index 120debde6b15..42a495686ed0 100644 --- a/components/script/dom/formdata.rs +++ b/components/script/dom/formdata.rs @@ -116,6 +116,6 @@ impl PrivateFormDataHelpers for FormData { let global = self.global.root(); let f: Option> = FileCast::to_ref(value); let name = filename.unwrap_or(f.map(|inner| inner.name().clone()).unwrap_or("blob".into_string())); - File::new(&global.r(), value, name) + File::new(global.r(), value, name) } }