diff options
author | Cameron Zwarich <zwarich@mozilla.com> | 2014-09-18 13:43:15 -0700 |
---|---|---|
committer | Cameron Zwarich <zwarich@mozilla.com> | 2014-09-19 13:39:17 -0700 |
commit | 4fa872511117eafd934cad70c7d3b8c583fb960e (patch) | |
tree | 8c75e871c896648de54c2e9aa376d30b4b98220e /components/script/dom/formdata.rs | |
parent | b8f34bbc5170f78e4939b1d647f8d8498e3c2fb6 (diff) | |
download | servo-4fa872511117eafd934cad70c7d3b8c583fb960e.tar.gz servo-4fa872511117eafd934cad70c7d3b8c583fb960e.zip |
First steps of &JSRef -> JSRef conversion
Replace &JSRef with JSRef in the bulk of the generated code. This will
remove a level of indirection throughout all DOM code.
This patch doesn't change methods implemented on JSRef<T> to take `self`
rather than `&self`, and it leaves a few other uses of &JSRef, but those
changes can be made incrementally.
Diffstat (limited to 'components/script/dom/formdata.rs')
-rw-r--r-- | components/script/dom/formdata.rs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/components/script/dom/formdata.rs b/components/script/dom/formdata.rs index 1a9f1252f53..7e5f22845de 100644 --- a/components/script/dom/formdata.rs +++ b/components/script/dom/formdata.rs @@ -40,7 +40,7 @@ impl FormData { data: Traceable::new(RefCell::new(HashMap::new())), reflector_: Reflector::new(), global: GlobalField::from_rooted(global), - form: form.map(|f| JS::from_rooted(&f)), + form: form.map(|f| JS::from_rooted(f)), } } @@ -56,8 +56,8 @@ impl FormData { impl<'a> FormDataMethods for JSRef<'a, FormData> { #[allow(unrooted_must_root)] - fn Append(&self, name: DOMString, value: &JSRef<Blob>, filename: Option<DOMString>) { - let file = FileData(JS::from_rooted(&self.get_file_from_blob(value, filename))); + fn Append(&self, name: DOMString, value: JSRef<Blob>, filename: Option<DOMString>) { + let file = FileData(JS::from_rooted(self.get_file_from_blob(value, filename))); self.data.deref().borrow_mut().insert_or_update_with(name.clone(), vec!(file.clone()), |_k, v| {v.push(file.clone());}); } @@ -88,8 +88,8 @@ impl<'a> FormDataMethods for JSRef<'a, FormData> { self.data.deref().borrow().contains_key_equiv(&name) } #[allow(unrooted_must_root)] - fn Set(&self, name: DOMString, value: &JSRef<Blob>, filename: Option<DOMString>) { - let file = FileData(JS::from_rooted(&self.get_file_from_blob(value, filename))); + fn Set(&self, name: DOMString, value: JSRef<Blob>, filename: Option<DOMString>) { + let file = FileData(JS::from_rooted(self.get_file_from_blob(value, filename))); self.data.deref().borrow_mut().insert(name, vec!(file)); } @@ -105,13 +105,13 @@ impl Reflectable for FormData { } trait PrivateFormDataHelpers{ - fn get_file_from_blob(&self, value: &JSRef<Blob>, filename: Option<DOMString>) -> Temporary<File>; + fn get_file_from_blob(&self, value: JSRef<Blob>, filename: Option<DOMString>) -> Temporary<File>; } impl PrivateFormDataHelpers for FormData { - fn get_file_from_blob(&self, value: &JSRef<Blob>, filename: Option<DOMString>) -> Temporary<File> { + fn get_file_from_blob(&self, value: JSRef<Blob>, filename: Option<DOMString>) -> Temporary<File> { let global = self.global.root(); - let f: Option<&JSRef<File>> = FileCast::to_ref(value); + let f: Option<JSRef<File>> = FileCast::to_ref(value); let name = filename.unwrap_or(f.map(|inner| inner.name.clone()).unwrap_or("blob".to_string())); File::new(&global.root_ref(), value, name) } |