mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Add spec links
This commit is contained in:
parent
f039827dcd
commit
233a769c67
61 changed files with 284 additions and 87 deletions
|
@ -58,6 +58,7 @@ impl FormData {
|
|||
|
||||
impl<'a> FormDataMethods for &'a FormData {
|
||||
#[allow(unrooted_must_root)]
|
||||
// https://xhr.spec.whatwg.org/#dom-formdata-append
|
||||
fn Append(self, name: DOMString, value: &Blob, filename: Option<DOMString>) {
|
||||
let file = FormDatum::FileData(JS::from_rooted(&self.get_file_from_blob(value, filename)));
|
||||
let mut data = self.data.borrow_mut();
|
||||
|
@ -69,6 +70,7 @@ impl<'a> FormDataMethods for &'a FormData {
|
|||
}
|
||||
}
|
||||
|
||||
// https://xhr.spec.whatwg.org/#dom-formdata-append
|
||||
fn Append_(self, name: DOMString, value: DOMString) {
|
||||
let mut data = self.data.borrow_mut();
|
||||
match data.entry(name) {
|
||||
|
@ -77,11 +79,13 @@ impl<'a> FormDataMethods for &'a FormData {
|
|||
}
|
||||
}
|
||||
|
||||
// https://xhr.spec.whatwg.org/#dom-formdata-delete
|
||||
fn Delete(self, name: DOMString) {
|
||||
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();
|
||||
|
@ -97,18 +101,22 @@ impl<'a> FormDataMethods for &'a FormData {
|
|||
}
|
||||
}
|
||||
|
||||
// https://xhr.spec.whatwg.org/#dom-formdata-has
|
||||
fn Has(self, name: DOMString) -> bool {
|
||||
self.data.borrow().contains_key(&name)
|
||||
}
|
||||
|
||||
// https://xhr.spec.whatwg.org/#dom-formdata-set
|
||||
fn Set_(self, name: DOMString, value: DOMString) {
|
||||
self.data.borrow_mut().insert(name, vec!(FormDatum::StringData(value)));
|
||||
}
|
||||
|
||||
#[allow(unrooted_must_root)]
|
||||
// https://xhr.spec.whatwg.org/#dom-formdata-set
|
||||
fn Set(self, name: DOMString, value: &Blob, filename: Option<DOMString>) {
|
||||
let file = FormDatum::FileData(JS::from_rooted(&self.get_file_from_blob(value, filename)));
|
||||
self.data.borrow_mut().insert(name, vec!(file));
|
||||
}
|
||||
|
||||
fn Set_(self, name: DOMString, value: DOMString) {
|
||||
self.data.borrow_mut().insert(name, vec!(FormDatum::StringData(value)));
|
||||
}
|
||||
}
|
||||
|
||||
trait PrivateFormDataHelpers{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue