mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Auto merge of #11931 - izgzhen:fix-html-input-element, r=Manishearth
Fix file-type input element A simple fix to put `inputElem.files` online --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors <!-- Either: --> - [x] There are tests for these changes <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11931) <!-- Reviewable:end -->
This commit is contained in:
commit
8052f5b80d
8 changed files with 15 additions and 182 deletions
|
@ -302,6 +302,14 @@ impl HTMLInputElementMethods for HTMLInputElement {
|
|||
self.form_owner()
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-input-files
|
||||
fn GetFiles(&self) -> Option<Root<FileList>> {
|
||||
match self.filelist.get() {
|
||||
Some(ref fl) => Some(fl.clone()),
|
||||
None => None,
|
||||
}
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-input-defaultchecked
|
||||
make_bool_getter!(DefaultChecked, "checked");
|
||||
|
||||
|
@ -796,6 +804,12 @@ impl VirtualMethods for HTMLInputElement {
|
|||
el.set_read_write_state(false);
|
||||
}
|
||||
|
||||
if new_type == InputType::InputFile {
|
||||
let window = window_from_node(self);
|
||||
let filelist = FileList::new(window.r(), vec![]);
|
||||
self.filelist.set(Some(&filelist));
|
||||
}
|
||||
|
||||
let new_value_mode = self.value_mode();
|
||||
|
||||
match (&old_value_mode, old_idl_value.is_empty(), new_value_mode) {
|
||||
|
|
|
@ -13,7 +13,7 @@ interface HTMLInputElement : HTMLElement {
|
|||
attribute DOMString dirName;
|
||||
attribute boolean disabled;
|
||||
readonly attribute HTMLFormElement? form;
|
||||
//readonly attribute FileList? files;
|
||||
readonly attribute FileList? files;
|
||||
attribute DOMString formAction;
|
||||
attribute DOMString formEnctype;
|
||||
attribute DOMString formMethod;
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
[filelist.html]
|
||||
type: testharness
|
||||
[Check if item is a instanceof Function]
|
||||
expected: FAIL
|
||||
|
||||
[Check if item is a method of fileList]
|
||||
expected: FAIL
|
||||
|
||||
[Check if the item method returns null when no file selected]
|
||||
expected: FAIL
|
||||
|
||||
[Check if length is fileList's attribute]
|
||||
expected: FAIL
|
||||
|
||||
[Check if the fileList length is 0 when no file selected]
|
||||
expected: FAIL
|
||||
|
|
@ -3,21 +3,6 @@
|
|||
[URL interface: operation createFor(Blob)]
|
||||
expected: FAIL
|
||||
|
||||
[FileList must be primary interface of file_input.files]
|
||||
expected: FAIL
|
||||
|
||||
[Stringification of file_input.files]
|
||||
expected: FAIL
|
||||
|
||||
[FileList interface: file_input.files must inherit property "item" with the proper type (0)]
|
||||
expected: FAIL
|
||||
|
||||
[FileList interface: calling item(unsigned long) on file_input.files with too few arguments must throw TypeError]
|
||||
expected: FAIL
|
||||
|
||||
[FileList interface: file_input.files must inherit property "length" with the proper type (1)]
|
||||
expected: FAIL
|
||||
|
||||
[FileReaderSync interface: existence and properties of interface object]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -3570,9 +3570,6 @@
|
|||
[HTMLInputElement interface: attribute autofocus]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLInputElement interface: attribute files]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLInputElement interface: attribute height]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -3645,9 +3642,6 @@
|
|||
[HTMLInputElement interface: document.createElement("input") must inherit property "autofocus" with the proper type (3)]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLInputElement interface: document.createElement("input") must inherit property "files" with the proper type (9)]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLInputElement interface: document.createElement("input") must inherit property "height" with the proper type (15)]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -7590,9 +7584,6 @@
|
|||
[HTMLInputElement interface: createInput("text") must inherit property "autofocus" with the proper type (3)]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLInputElement interface: createInput("text") must inherit property "files" with the proper type (9)]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLInputElement interface: createInput("text") must inherit property "height" with the proper type (15)]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -7680,9 +7671,6 @@
|
|||
[HTMLInputElement interface: createInput("hidden") must inherit property "autofocus" with the proper type (3)]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLInputElement interface: createInput("hidden") must inherit property "files" with the proper type (9)]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLInputElement interface: createInput("hidden") must inherit property "height" with the proper type (15)]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -7770,9 +7758,6 @@
|
|||
[HTMLInputElement interface: createInput("search") must inherit property "autofocus" with the proper type (3)]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLInputElement interface: createInput("search") must inherit property "files" with the proper type (9)]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLInputElement interface: createInput("search") must inherit property "height" with the proper type (15)]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -7860,9 +7845,6 @@
|
|||
[HTMLInputElement interface: createInput("tel") must inherit property "autofocus" with the proper type (3)]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLInputElement interface: createInput("tel") must inherit property "files" with the proper type (9)]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLInputElement interface: createInput("tel") must inherit property "height" with the proper type (15)]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -7950,9 +7932,6 @@
|
|||
[HTMLInputElement interface: createInput("url") must inherit property "autofocus" with the proper type (3)]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLInputElement interface: createInput("url") must inherit property "files" with the proper type (9)]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLInputElement interface: createInput("url") must inherit property "height" with the proper type (15)]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -8040,9 +8019,6 @@
|
|||
[HTMLInputElement interface: createInput("email") must inherit property "autofocus" with the proper type (3)]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLInputElement interface: createInput("email") must inherit property "files" with the proper type (9)]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLInputElement interface: createInput("email") must inherit property "height" with the proper type (15)]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -8130,9 +8106,6 @@
|
|||
[HTMLInputElement interface: createInput("password") must inherit property "autofocus" with the proper type (3)]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLInputElement interface: createInput("password") must inherit property "files" with the proper type (9)]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLInputElement interface: createInput("password") must inherit property "height" with the proper type (15)]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -8220,9 +8193,6 @@
|
|||
[HTMLInputElement interface: createInput("date") must inherit property "autofocus" with the proper type (3)]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLInputElement interface: createInput("date") must inherit property "files" with the proper type (9)]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLInputElement interface: createInput("date") must inherit property "height" with the proper type (15)]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -8310,9 +8280,6 @@
|
|||
[HTMLInputElement interface: createInput("month") must inherit property "autofocus" with the proper type (3)]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLInputElement interface: createInput("month") must inherit property "files" with the proper type (9)]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLInputElement interface: createInput("month") must inherit property "height" with the proper type (15)]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -8400,9 +8367,6 @@
|
|||
[HTMLInputElement interface: createInput("week") must inherit property "autofocus" with the proper type (3)]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLInputElement interface: createInput("week") must inherit property "files" with the proper type (9)]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLInputElement interface: createInput("week") must inherit property "height" with the proper type (15)]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -8490,9 +8454,6 @@
|
|||
[HTMLInputElement interface: createInput("time") must inherit property "autofocus" with the proper type (3)]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLInputElement interface: createInput("time") must inherit property "files" with the proper type (9)]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLInputElement interface: createInput("time") must inherit property "height" with the proper type (15)]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -8580,9 +8541,6 @@
|
|||
[HTMLInputElement interface: createInput("datetime-local") must inherit property "autofocus" with the proper type (3)]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLInputElement interface: createInput("datetime-local") must inherit property "files" with the proper type (9)]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLInputElement interface: createInput("datetime-local") must inherit property "height" with the proper type (15)]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -8670,9 +8628,6 @@
|
|||
[HTMLInputElement interface: createInput("number") must inherit property "autofocus" with the proper type (3)]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLInputElement interface: createInput("number") must inherit property "files" with the proper type (9)]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLInputElement interface: createInput("number") must inherit property "height" with the proper type (15)]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -8760,9 +8715,6 @@
|
|||
[HTMLInputElement interface: createInput("range") must inherit property "autofocus" with the proper type (3)]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLInputElement interface: createInput("range") must inherit property "files" with the proper type (9)]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLInputElement interface: createInput("range") must inherit property "height" with the proper type (15)]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -8850,9 +8802,6 @@
|
|||
[HTMLInputElement interface: createInput("color") must inherit property "autofocus" with the proper type (3)]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLInputElement interface: createInput("color") must inherit property "files" with the proper type (9)]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLInputElement interface: createInput("color") must inherit property "height" with the proper type (15)]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -8940,9 +8889,6 @@
|
|||
[HTMLInputElement interface: createInput("checkbox") must inherit property "autofocus" with the proper type (3)]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLInputElement interface: createInput("checkbox") must inherit property "files" with the proper type (9)]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLInputElement interface: createInput("checkbox") must inherit property "height" with the proper type (15)]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -9030,9 +8976,6 @@
|
|||
[HTMLInputElement interface: createInput("radio") must inherit property "autofocus" with the proper type (3)]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLInputElement interface: createInput("radio") must inherit property "files" with the proper type (9)]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLInputElement interface: createInput("radio") must inherit property "height" with the proper type (15)]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -9210,9 +9153,6 @@
|
|||
[HTMLInputElement interface: createInput("submit") must inherit property "autofocus" with the proper type (3)]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLInputElement interface: createInput("submit") must inherit property "files" with the proper type (9)]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLInputElement interface: createInput("submit") must inherit property "height" with the proper type (15)]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -9300,9 +9240,6 @@
|
|||
[HTMLInputElement interface: createInput("image") must inherit property "autofocus" with the proper type (3)]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLInputElement interface: createInput("image") must inherit property "files" with the proper type (9)]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLInputElement interface: createInput("image") must inherit property "height" with the proper type (15)]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -9390,9 +9327,6 @@
|
|||
[HTMLInputElement interface: createInput("reset") must inherit property "autofocus" with the proper type (3)]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLInputElement interface: createInput("reset") must inherit property "files" with the proper type (9)]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLInputElement interface: createInput("reset") must inherit property "height" with the proper type (15)]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -9480,9 +9414,6 @@
|
|||
[HTMLInputElement interface: createInput("button") must inherit property "autofocus" with the proper type (3)]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLInputElement interface: createInput("button") must inherit property "files" with the proper type (9)]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLInputElement interface: createInput("button") must inherit property "height" with the proper type (15)]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -1,71 +0,0 @@
|
|||
[files.html]
|
||||
type: testharness
|
||||
[files for input type=hidden]
|
||||
expected: FAIL
|
||||
|
||||
[files for input type=text]
|
||||
expected: FAIL
|
||||
|
||||
[files for input type=search]
|
||||
expected: FAIL
|
||||
|
||||
[files for input type=tel]
|
||||
expected: FAIL
|
||||
|
||||
[files for input type=url]
|
||||
expected: FAIL
|
||||
|
||||
[files for input type=email]
|
||||
expected: FAIL
|
||||
|
||||
[files for input type=password]
|
||||
expected: FAIL
|
||||
|
||||
[files for input type=datetime]
|
||||
expected: FAIL
|
||||
|
||||
[files for input type=date]
|
||||
expected: FAIL
|
||||
|
||||
[files for input type=month]
|
||||
expected: FAIL
|
||||
|
||||
[files for input type=week]
|
||||
expected: FAIL
|
||||
|
||||
[files for input type=time]
|
||||
expected: FAIL
|
||||
|
||||
[files for input type=datetime-local]
|
||||
expected: FAIL
|
||||
|
||||
[files for input type=number]
|
||||
expected: FAIL
|
||||
|
||||
[files for input type=range]
|
||||
expected: FAIL
|
||||
|
||||
[files for input type=color]
|
||||
expected: FAIL
|
||||
|
||||
[files for input type=checkbox]
|
||||
expected: FAIL
|
||||
|
||||
[files for input type=radio]
|
||||
expected: FAIL
|
||||
|
||||
[files for input type=submit]
|
||||
expected: FAIL
|
||||
|
||||
[files for input type=image]
|
||||
expected: FAIL
|
||||
|
||||
[files for input type=reset]
|
||||
expected: FAIL
|
||||
|
||||
[files for input type=button]
|
||||
expected: FAIL
|
||||
|
||||
[files for input type=file]
|
||||
expected: FAIL
|
||||
|
|
@ -1,8 +1,5 @@
|
|||
[hidden.html]
|
||||
type: testharness
|
||||
[files attribute must return null for hidden]
|
||||
expected: FAIL
|
||||
|
||||
[valueAsDate attribute must return null for hidden]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -3,9 +3,6 @@
|
|||
[Value sanitization algorithm should strip line breaks for text]
|
||||
expected: FAIL
|
||||
|
||||
[files attribute must return null for text]
|
||||
expected: FAIL
|
||||
|
||||
[valueAsDate attribute must return null for text]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -24,9 +21,6 @@
|
|||
[Value sanitization algorithm should strip line breaks for search]
|
||||
expected: FAIL
|
||||
|
||||
[files attribute must return null for search]
|
||||
expected: FAIL
|
||||
|
||||
[valueAsDate attribute must return null for search]
|
||||
expected: FAIL
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue