Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upAdd ability to WPT-test file uploads and fetches, fixes #12322 #12344
Conversation
highfive
commented
Jul 8, 2016
|
Heads up! This PR modifies the following files:
|
|
r? @Manishearth |
| @@ -70,6 +70,11 @@ interface HTMLInputElement : HTMLElement { | |||
| void setSelectionRange(unsigned long start, unsigned long end, optional DOMString direction); | |||
|
|
|||
| // also has obsolete members | |||
|
|
|||
| // Select with file-system paths for testing purpose | |||
| [Pref="dom.htmlinputelement.select_files.enabled"] | |||
This comment has been minimized.
This comment has been minimized.
| let opt_v = match opt_test_paths { | ||
| Some(v) => Some(v), | ||
| None => self.ui.open_file_dialog_multi("", patterns), | ||
| }; |
This comment has been minimized.
This comment has been minimized.
Manishearth
Jul 8, 2016
Member
This isn't process safe -- we should assert that the pref is enabled if opt_test_paths is nonempty here.
|
Okay, this passed the CI as well |
| let select_files_enabled = PREFS.get("dom.testing.htmlinputelement.select_files.enabled").as_boolean(); | ||
|
|
||
| let opt_s = match (opt_test_path, select_files_enabled) { | ||
| (Some(s), Some(true)) => Some(s), |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
|
0b221ff
to
cff79d3
| opt_test_path | ||
| } else { | ||
| self.ui.open_file_dialog("", patterns) | ||
| }; |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Manishearth
Jul 9, 2016
Member
Yep. Leave a comment here though mentioning that while this pref check is redundant, it's in place to ensure that a compromised script thread cannot request arbitrary files. r=me
| match self.ui.open_file_dialog_multi("", patterns) { | ||
| origin: FileOrigin, opt_test_paths: Option<Vec<String>>) { | ||
| // Check if the select_files preference is enabled, | ||
| // if so applying opt_test_paths for testing convenience |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
@bors-servo r+ |
|
|
Add ability to WPT-test file uploads and fetches, fixes #12322 Using `inputElem.selectFiles(["path1", "path2"])` in JavaScript with pref `dom.htmlinputelement.select_files.enabled` = `true` will simulate the effect of `inputElem.click()`. See #12322 for more, also related to #12343. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/12344) <!-- Reviewable:end -->
|
|
izgzhen commentedJul 8, 2016
•
edited
Using
inputElem.selectFiles(["path1", "path2"])in JavaScript with prefdom.htmlinputelement.select_files.enabled=truewill simulate the effect ofinputElem.click().See #12322 for more, also related to #12343, #11131.
This change is