- Revision
- 225325
- Author
- carlo...@webkit.org
- Date
- 2017-11-30 05:47:19 -0800 (Thu, 30 Nov 2017)
Log Message
WebDriver: remove elementSubmit command
https://bugs.webkit.org/show_bug.cgi?id=180186
Reviewed by Carlos Alberto Lopez Perez.
It's not in the spec, we had it only because selenium used it, but now it uses execute_script with custom code
to implement submit, so we can just remove it.
* Session.cpp:
(WebDriver::Session::elementSubmit): Deleted.
* Session.h:
* WebDriverService.cpp:
(WebDriver::WebDriverService::elementSubmit): Deleted.
* WebDriverService.h:
Modified Paths
Diff
Modified: trunk/Source/WebDriver/ChangeLog (225324 => 225325)
--- trunk/Source/WebDriver/ChangeLog 2017-11-30 12:30:25 UTC (rev 225324)
+++ trunk/Source/WebDriver/ChangeLog 2017-11-30 13:47:19 UTC (rev 225325)
@@ -1,3 +1,20 @@
+2017-11-30 Carlos Garcia Campos <cgar...@igalia.com>
+
+ WebDriver: remove elementSubmit command
+ https://bugs.webkit.org/show_bug.cgi?id=180186
+
+ Reviewed by Carlos Alberto Lopez Perez.
+
+ It's not in the spec, we had it only because selenium used it, but now it uses execute_script with custom code
+ to implement submit, so we can just remove it.
+
+ * Session.cpp:
+ (WebDriver::Session::elementSubmit): Deleted.
+ * Session.h:
+ * WebDriverService.cpp:
+ (WebDriver::WebDriverService::elementSubmit): Deleted.
+ * WebDriverService.h:
+
2017-11-14 Carlos Garcia Campos <cgar...@igalia.com>
Move JSONValues to WTF and convert uses of InspectorValues.h to JSONValues.h
Modified: trunk/Source/WebDriver/Session.cpp (225324 => 225325)
--- trunk/Source/WebDriver/Session.cpp 2017-11-30 12:30:25 UTC (rev 225324)
+++ trunk/Source/WebDriver/Session.cpp 2017-11-30 13:47:19 UTC (rev 225325)
@@ -1603,37 +1603,6 @@
});
}
-void Session::elementSubmit(const String& elementID, Function<void (CommandResult&&)>&& completionHandler)
-{
- if (!m_toplevelBrowsingContext) {
- completionHandler(CommandResult::fail(CommandResult::ErrorCode::NoSuchWindow));
- return;
- }
-
- handleUserPrompts([this, elementID, completionHandler = WTFMove(completionHandler)](CommandResult&& result) mutable {
- if (result.isError()) {
- completionHandler(WTFMove(result));
- return;
- }
- RefPtr<JSON::Array> arguments = JSON::Array::create();
- arguments->pushString(createElement(elementID)->toJSONString());
-
- RefPtr<JSON::Object> parameters = JSON::Object::create();
- parameters->setString(ASCIILiteral("browsingContextHandle"), m_toplevelBrowsingContext.value());
- if (m_currentBrowsingContext)
- parameters->setString(ASCIILiteral("frameHandle"), m_currentBrowsingContext.value());
- parameters->setString(ASCIILiteral("function"), FormSubmitJavaScript);
- parameters->setArray(ASCIILiteral("arguments"), WTFMove(arguments));
- m_host->sendCommandToBackend(ASCIILiteral("evaluateJavaScriptFunction"), WTFMove(parameters), [this, protectedThis = makeRef(*this), completionHandler = WTFMove(completionHandler)](SessionHost::CommandResponse&& response) {
- if (response.isError) {
- completionHandler(CommandResult::fail(WTFMove(response.responseObject)));
- return;
- }
- completionHandler(CommandResult::success());
- });
- });
-}
-
RefPtr<JSON::Value> Session::handleScriptResult(RefPtr<JSON::Value>&& resultValue)
{
RefPtr<JSON::Array> resultArray;
Modified: trunk/Source/WebDriver/Session.h (225324 => 225325)
--- trunk/Source/WebDriver/Session.h 2017-11-30 12:30:25 UTC (rev 225324)
+++ trunk/Source/WebDriver/Session.h 2017-11-30 13:47:19 UTC (rev 225325)
@@ -95,7 +95,6 @@
void elementClick(const String& elementID, Function<void (CommandResult&&)>&&);
void elementClear(const String& elementID, Function<void (CommandResult&&)>&&);
void elementSendKeys(const String& elementID, Vector<String>&& keys, Function<void (CommandResult&&)>&&);
- void elementSubmit(const String& elementID, Function<void (CommandResult&&)>&&);
void executeScript(const String& script, RefPtr<JSON::Array>&& arguments, ExecuteScriptMode, Function<void (CommandResult&&)>&&);
void getAllCookies(Function<void (CommandResult&&)>&&);
void getNamedCookie(const String& name, Function<void (CommandResult&&)>&&);
Modified: trunk/Source/WebDriver/WebDriverService.cpp (225324 => 225325)
--- trunk/Source/WebDriver/WebDriverService.cpp 2017-11-30 12:30:25 UTC (rev 225324)
+++ trunk/Source/WebDriver/WebDriverService.cpp 2017-11-30 13:47:19 UTC (rev 225325)
@@ -135,9 +135,6 @@
{ HTTPMethod::Post, "/session/$sessionId/element/$elementId/clear", &WebDriverService::elementClear },
{ HTTPMethod::Post, "/session/$sessionId/element/$elementId/value", &WebDriverService::elementSendKeys },
- // FIXME: Not in the spec, but still used by Selenium.
- { HTTPMethod::Post, "/session/$sessionId/element/$elementId/submit", &WebDriverService::elementSubmit },
-
{ HTTPMethod::Post, "/session/$sessionId/execute/sync", &WebDriverService::executeScript },
{ HTTPMethod::Post, "/session/$sessionId/execute/async", &WebDriverService::executeAsyncScript },
@@ -1278,19 +1275,6 @@
session->elementSendKeys(elementID.value(), WTFMove(value), WTFMove(completionHandler));
}
-void WebDriverService::elementSubmit(RefPtr<JSON::Object>&& parameters, Function<void (CommandResult&&)>&& completionHandler)
-{
- auto session = findSessionOrCompleteWithError(*parameters, completionHandler);
- if (!session)
- return;
-
- auto elementID = findElementOrCompleteWithError(*parameters, completionHandler);
- if (!elementID)
- return;
-
- session->elementSubmit(elementID.value(), WTFMove(completionHandler));
-}
-
static bool findScriptAndArgumentsOrCompleteWithError(JSON::Object& parameters, Function<void (CommandResult&&)>& completionHandler, String& script, RefPtr<JSON::Array>& arguments)
{
if (!parameters.getString(ASCIILiteral("script"), script)) {
Modified: trunk/Source/WebDriver/WebDriverService.h (225324 => 225325)
--- trunk/Source/WebDriver/WebDriverService.h 2017-11-30 12:30:25 UTC (rev 225324)
+++ trunk/Source/WebDriver/WebDriverService.h 2017-11-30 13:47:19 UTC (rev 225325)
@@ -92,7 +92,6 @@
void elementClick(RefPtr<JSON::Object>&&, Function<void (CommandResult&&)>&&);
void elementClear(RefPtr<JSON::Object>&&, Function<void (CommandResult&&)>&&);
void elementSendKeys(RefPtr<JSON::Object>&&, Function<void (CommandResult&&)>&&);
- void elementSubmit(RefPtr<JSON::Object>&&, Function<void (CommandResult&&)>&&);
void executeScript(RefPtr<JSON::Object>&&, Function<void (CommandResult&&)>&&);
void executeAsyncScript(RefPtr<JSON::Object>&&, Function<void (CommandResult&&)>&&);
void getAllCookies(RefPtr<JSON::Object>&&, Function<void (CommandResult&&)>&&);