mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-22 01:35:35 +00:00
servo: Merge #7433 - Cleanup, refactor FormDataMethods::Get (from frewsxcv:formdata-get); r=nox
Source-Repo: https://github.com/servo/servo Source-Revision: 89a5e2b3d098fc2afdb95ebcebeb8d7beeebc96a
This commit is contained in:
parent
2d6351b526
commit
ad213d5384
@ -85,21 +85,14 @@ impl FormDataMethods for FormData {
|
||||
self.data.borrow_mut().remove(&name);
|
||||
}
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
// https://xhr.spec.whatwg.org/#dom-formdata-get
|
||||
fn Get(&self, name: DOMString) -> Option<FileOrString> {
|
||||
// FIXME(https://github.com/rust-lang/rust/issues/23338)
|
||||
let data = self.data.borrow();
|
||||
if data.contains_key(&name) {
|
||||
match data[&name][0].clone() {
|
||||
FormDatum::StringData(ref s) => Some(eString(s.clone())),
|
||||
FormDatum::FileData(ref f) => {
|
||||
Some(eFile(f.root()))
|
||||
}
|
||||
}
|
||||
} else {
|
||||
None
|
||||
}
|
||||
self.data.borrow()
|
||||
.get(&name)
|
||||
.map(|entry| match entry[0] {
|
||||
FormDatum::StringData(ref s) => eString(s.clone()),
|
||||
FormDatum::FileData(ref f) => eFile(f.root()),
|
||||
})
|
||||
}
|
||||
|
||||
// https://xhr.spec.whatwg.org/#dom-formdata-has
|
||||
|
Loading…
Reference in New Issue
Block a user