RESOLVED FIXED 174797
Web Automation: add support for uploading files
https://bugs.webkit.org/show_bug.cgi?id=174797
Summary Web Automation: add support for uploading files
Blaze Burg
Reported 2017-07-24 13:58:53 PDT
placeholder text.
Attachments
Patch (40.31 KB, patch)
2017-07-24 15:04 PDT, Blaze Burg
no flags
For Landing (45.87 KB, patch)
2017-07-24 16:51 PDT, Blaze Burg
no flags
For Landing (47.40 KB, patch)
2017-07-24 20:57 PDT, Blaze Burg
no flags
Fix CMake builds (46.78 KB, patch)
2017-07-25 04:59 PDT, Carlos Garcia Campos
commit-queue: commit-queue-
Blaze Burg
Comment 1 2017-07-24 13:59:35 PDT
Blaze Burg
Comment 2 2017-07-24 15:04:46 PDT
Joseph Pecoraro
Comment 3 2017-07-24 15:29:52 PDT
Comment on attachment 316320 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=316320&action=review r=me > Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp:507 > + // Per §14.3.10.5 in the W3C spec, if at least one file no longer exists, the command should fail. "no longer exists" => "does not exist" > Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp:510 > + if (!WebCore::fileExists(filename)) { Did you also want to check that the file is readable by this process? > Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp:517 > + // FIXME: validate filenames against allowed MIME types before choosing them. Bugzilla bug before landing. > Source/WebKit/UIProcess/WebPageProxy.cpp:4125 > + if (m_controlledByAutomation) { > + if (auto* automationSession = process().processPool().automationSession()) { > + automationSession->handleRunOpenPanel(*this, *frame, parameters.get(), *m_openPanelResultListener); > + return; > + } > + } > + > // Since runOpenPanel() can spin a nested run loop we need to turn off the responsiveness timer. > m_process->responsivenessTimer().stop(); Should we always return while controlled by automation even if there was no automation session? Likewise we should probably let the responsiveness timer stop before returning above. > Source/WebKit/WebKit.xcodeproj/project.pbxproj:9981 > + 99249AD51F1F1E5600B62FBB /* AutomationFrontendDispatchers.cpp in Sources */, Nit: You could run `sort-Xcode-project-file WebKit.xcodeproj/project.pbxproj` and only add your new bits, but then they would be in the correct locations.
Blaze Burg
Comment 4 2017-07-24 16:29:03 PDT
(In reply to Joseph Pecoraro from comment #3) > Comment on attachment 316320 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=316320&action=review > > r=me > > > Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp:507 > > + // Per §14.3.10.5 in the W3C spec, if at least one file no longer exists, the command should fail. > > "no longer exists" => "does not exist" > > > Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp:510 > > + if (!WebCore::fileExists(filename)) { > > Did you also want to check that the file is readable by this process? This check will fail if the file is not readable by the process. Additionally, safaridriver will check for world-readable permissions before starting off the command, since that's not easy to do in cross-platform code. Other drivers may want a looser policy, as well. > > Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp:517 > > + // FIXME: validate filenames against allowed MIME types before choosing them. > > Bugzilla bug before landing. Ok. > > Source/WebKit/UIProcess/WebPageProxy.cpp:4125 > > + if (m_controlledByAutomation) { > > + if (auto* automationSession = process().processPool().automationSession()) { > > + automationSession->handleRunOpenPanel(*this, *frame, parameters.get(), *m_openPanelResultListener); > > + return; > > + } > > + } > > + > > // Since runOpenPanel() can spin a nested run loop we need to turn off the responsiveness timer. > > m_process->responsivenessTimer().stop(); > > Should we always return while controlled by automation even if there was no > automation session? I can't see how that would happen, but sure. > Likewise we should probably let the responsiveness timer stop before > returning above. OK. > > Source/WebKit/WebKit.xcodeproj/project.pbxproj:9981 > > + 99249AD51F1F1E5600B62FBB /* AutomationFrontendDispatchers.cpp in Sources */, > > Nit: You could run `sort-Xcode-project-file > WebKit.xcodeproj/project.pbxproj` and only add your new bits, but then they > would be in the correct locations. I will, was waiting to rebase first.
Blaze Burg
Comment 5 2017-07-24 16:32:43 PDT
(In reply to Joseph Pecoraro from comment #3) > Comment on attachment 316320 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=316320&action=review > > r=me > > > Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp:507 > > + // Per §14.3.10.5 in the W3C spec, if at least one file no longer exists, the command should fail. > > "no longer exists" => "does not exist" > > > Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp:510 > > + if (!WebCore::fileExists(filename)) { > > Did you also want to check that the file is readable by this process? > > > Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp:517 > > + // FIXME: validate filenames against allowed MIME types before choosing them. > > Bugzilla bug before landing. > > > Source/WebKit/UIProcess/WebPageProxy.cpp:4125 > > + if (m_controlledByAutomation) { > > + if (auto* automationSession = process().processPool().automationSession()) { > > + automationSession->handleRunOpenPanel(*this, *frame, parameters.get(), *m_openPanelResultListener); > > + return; > > + } > > + } > > + > > // Since runOpenPanel() can spin a nested run loop we need to turn off the responsiveness timer. > > m_process->responsivenessTimer().stop(); > > Should we always return while controlled by automation even if there was no > automation session? > > Likewise we should probably let the responsiveness timer stop before > returning above. Actually, no, this isn't needed because WebAutomationSession::handleRunOpenPanel does not have a nested run loop. It just picks whatever files were set last, if anything. The fact that the completion handler is possibly called asynchronously should not matter.
Blaze Burg
Comment 6 2017-07-24 16:51:08 PDT
Created attachment 316328 [details] For Landing
Build Bot
Comment 7 2017-07-24 16:54:03 PDT
This patch modifies the inspector protocol generator. Please ensure that you have rebaselined any generator test results (i.e., by running `Tools/Scripts/run-inspector-generator-tests --reset-results`)
Build Bot
Comment 8 2017-07-24 16:54:14 PDT
Attachment 316328 [details] did not pass style-queue: ERROR: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py:173: [generate_from_specification] Undefined variable 'CppFrontendDispatcherHeaderGenerator' [pylint/E0602] [5] Total errors found: 1 in 30 files If any of these errors are false positives, please file a bug against check-webkit-style.
Blaze Burg
Comment 9 2017-07-24 20:57:10 PDT
Created attachment 316348 [details] For Landing
Build Bot
Comment 10 2017-07-24 21:00:36 PDT
Attachment 316348 [details] did not pass style-queue: ERROR: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py:173: [generate_from_specification] Undefined variable 'CppFrontendDispatcherHeaderGenerator' [pylint/E0602] [5] Total errors found: 1 in 31 files If any of these errors are false positives, please file a bug against check-webkit-style.
Carlos Garcia Campos
Comment 11 2017-07-25 04:59:41 PDT
Created attachment 316364 [details] Fix CMake builds
Build Bot
Comment 12 2017-07-25 05:01:49 PDT
Attachment 316364 [details] did not pass style-queue: ERROR: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py:173: [generate_from_specification] Undefined variable 'CppFrontendDispatcherHeaderGenerator' [pylint/E0602] [5] Total errors found: 1 in 31 files If any of these errors are false positives, please file a bug against check-webkit-style.
WebKit Commit Bot
Comment 13 2017-07-25 09:32:58 PDT
Comment on attachment 316364 [details] Fix CMake builds Rejecting attachment 316364 [details] from commit-queue. Failed to run "['/Volumes/Data/EWS/WebKit/Tools/Scripts/webkit-patch', '--status-host=webkit-queues.webkit.org', '--bot-id=webkit-cq-03', 'validate-changelog', '--check-oops', '--non-interactive', 316364, '--port=mac']" exit_code: 1 cwd: /Volumes/Data/EWS/WebKit ChangeLog entry in Source/JavaScriptCore/ChangeLog contains OOPS!. Full output: http://webkit-queues.webkit.org/results/4185103
Blaze Burg
Comment 14 2017-07-25 09:38:55 PDT
Commit queue is awful.
Carlos Garcia Campos
Comment 15 2017-07-25 09:42:35 PDT
Reviewer was not filled in the changelog in the patch, I didn't notice it. Joe, could you please r+, cq+ it? That should just work.
Blaze Burg
Comment 16 2017-07-25 09:45:01 PDT
(In reply to Carlos Garcia Campos from comment #15) > Reviewer was not filled in the changelog in the patch, I didn't notice it. > Joe, could you please r+, cq+ it? That should just work. It should have found it from the earlier reviewed patch. In any case, Joe won't be in for an hour or so, I'm going to land it manually.
Blaze Burg
Comment 17 2017-07-25 11:03:09 PDT
Note You need to log in before you can comment on or make changes to this bug.