Changeset 275050 in webkit
- Timestamp:
- Mar 25, 2021 11:54:45 AM (16 months ago)
- Location:
- trunk/Source/WebKit
- Files:
-
- 3 edited
-
ChangeLog (modified) (1 diff)
-
UIProcess/Automation/Automation.json (modified) (1 diff)
-
UIProcess/Automation/WebAutomationSession.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r275047 r275050 1 2021-03-25 BJ Burg <bburg@apple.com> 2 3 SendKeys on Input of type=file returns element not found in some cases 4 https://bugs.webkit.org/show_bug.cgi?id=223028 5 <rdar://problem/75526126> 6 7 Reviewed by Devin Rousso. 8 9 This bizarre behavior is triggered by removing the <input type=file> element inside an onclick() handler 10 for the input element. This confuses safaridriver, which expects to be able to query the file input's .value 11 via JavaScript after setting the files. 12 13 As part of the fix, provide the list of selected filenames in the Automation.fileChooserDismissed event. 14 On the safaridriver side, just use the list of filenames provided in this event to avoid an extra JS evaluation 15 that may race with page content. 16 17 * UIProcess/Automation/Automation.json: 18 * UIProcess/Automation/WebAutomationSession.cpp: 19 (WebKit::WebAutomationSession::handleRunOpenPanel): 20 1 21 2021-03-25 Alex Christensen <achristensen@webkit.org> 2 22 -
trunk/Source/WebKit/UIProcess/Automation/Automation.json
r270582 r275050 722 722 "parameters": [ 723 723 { "name": "browsingContextHandle", "$ref": "BrowsingContextHandle", "description": "The handle for the browsing context." }, 724 { "name": "selectionCancelled", "type": "boolean", "description": "If true, the chooser was dismissed because file selection was cancelled." } 724 { "name": "selectionCancelled", "type": "boolean", "description": "If true, file selection was cancelled due to an error. For example, this could occur if a file's MIME type cannot be handled by WebKit." }, 725 { "name": "selectedFiles", "type": "array", "items": { "type": "string" }, "optional": true, "description": "A list of file names that were successfully selected for upload." } 725 726 ] 726 727 }, -
trunk/Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp
r274815 r275050 901 901 if (!m_filesToSelectForFileUpload.size()) { 902 902 resultListener.cancel(); 903 m_domainNotifier->fileChooserDismissed(browsingContextHandle, true );903 m_domainNotifier->fileChooserDismissed(browsingContextHandle, true, { }); 904 904 return; 905 905 } … … 907 907 if (m_filesToSelectForFileUpload.size() > 1 && !parameters.allowMultipleFiles()) { 908 908 resultListener.cancel(); 909 m_domainNotifier->fileChooserDismissed(browsingContextHandle, true );909 m_domainNotifier->fileChooserDismissed(browsingContextHandle, true, { }); 910 910 return; 911 911 } … … 926 926 927 927 // Per §14.3.10.5 in the W3C spec, if at least one file cannot be accepted, the command should fail. 928 // The REST API service can tell that this failed by checking the "files" attribute of the input element.929 928 for (const String& filename : m_filesToSelectForFileUpload) { 930 929 if (!fileCanBeAcceptedForUpload(filename, allowedMIMETypes, allowedFileExtensions)) { 931 930 resultListener.cancel(); 932 m_domainNotifier->fileChooserDismissed(browsingContextHandle, true );931 m_domainNotifier->fileChooserDismissed(browsingContextHandle, true, { }); 933 932 return; 934 933 } 935 934 } 936 935 936 // Copy the file list we used before calling out to the open panel listener. 937 Ref<JSON::ArrayOf<String>> selectedFiles = JSON::ArrayOf<String>::create(); 938 for (const String& filename : m_filesToSelectForFileUpload) 939 selectedFiles->addItem(filename); 940 937 941 resultListener.chooseFiles(m_filesToSelectForFileUpload); 938 m_domainNotifier->fileChooserDismissed(browsingContextHandle, false); 942 943 m_domainNotifier->fileChooserDismissed(browsingContextHandle, false, WTFMove(selectedFiles)); 939 944 } 940 945
Note: See TracChangeset
for help on using the changeset viewer.