Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (253882 => 253883)
--- trunk/Source/_javascript_Core/ChangeLog 2019-12-23 10:06:29 UTC (rev 253882)
+++ trunk/Source/_javascript_Core/ChangeLog 2019-12-23 10:42:26 UTC (rev 253883)
@@ -1,3 +1,16 @@
+2019-12-23 Carlos Garcia Campos <[email protected]>
+
+ WebDriver: fix handling of session timeouts for values higher than MAX_INT
+ https://bugs.webkit.org/show_bug.cgi?id=204114
+
+ Reviewed by Brian Burg.
+
+ Fix generation of code with optional number in stack variable.
+
+ * inspector/scripts/codegen/cpp_generator.py:
+ (CppGenerator.cpp_type_for_stack_in_parameter): Do not use Optional for numbers either.
+ * inspector/scripts/tests/generic/expected/commands-with-optional-call-return-parameters.json-result:
+
2019-12-22 Yusuke Suzuki <[email protected]>
Unreviewed, fix incorrect merging
Modified: trunk/Source/_javascript_Core/inspector/scripts/codegen/cpp_generator.py (253882 => 253883)
--- trunk/Source/_javascript_Core/inspector/scripts/codegen/cpp_generator.py 2019-12-23 10:06:29 UTC (rev 253882)
+++ trunk/Source/_javascript_Core/inspector/scripts/codegen/cpp_generator.py 2019-12-23 10:42:26 UTC (rev 253883)
@@ -275,7 +275,7 @@
cpp_name = CppGenerator.cpp_name_for_primitive_type(_type)
if _type.qualified_name() in ['any', 'object']:
return "RefPtr<%s>" % CppGenerator.cpp_name_for_primitive_type(_type)
- elif parameter.is_optional and _type.qualified_name() not in ['boolean', 'string', 'integer']:
+ elif parameter.is_optional and _type.qualified_name() not in ['boolean', 'string', 'integer', 'number']:
return "Optional<%s>" % cpp_name
else:
return cpp_name
Modified: trunk/Source/_javascript_Core/inspector/scripts/tests/generic/expected/commands-with-optional-call-return-parameters.json-result (253882 => 253883)
--- trunk/Source/_javascript_Core/inspector/scripts/tests/generic/expected/commands-with-optional-call-return-parameters.json-result 2019-12-23 10:06:29 UTC (rev 253882)
+++ trunk/Source/_javascript_Core/inspector/scripts/tests/generic/expected/commands-with-optional-call-return-parameters.json-result 2019-12-23 10:42:26 UTC (rev 253883)
@@ -261,7 +261,7 @@
bool opt_in_notes_valueFound = false;
String opt_in_notes = m_backendDispatcher->getString(parameters.get(), "notes"_s, &opt_in_notes_valueFound);
bool opt_in_timestamp_valueFound = false;
- Optional<double> opt_in_timestamp = m_backendDispatcher->getDouble(parameters.get(), "timestamp"_s, &opt_in_timestamp_valueFound);
+ double opt_in_timestamp = m_backendDispatcher->getDouble(parameters.get(), "timestamp"_s, &opt_in_timestamp_valueFound);
bool opt_in_values_valueFound = false;
RefPtr<JSON::Object> opt_in_values = m_backendDispatcher->getObject(parameters.get(), "values"_s, &opt_in_values_valueFound);
bool opt_in_payload_valueFound = false;
Modified: trunk/Source/WebDriver/Capabilities.h (253882 => 253883)
--- trunk/Source/WebDriver/Capabilities.h 2019-12-23 10:06:29 UTC (rev 253882)
+++ trunk/Source/WebDriver/Capabilities.h 2019-12-23 10:42:26 UTC (rev 253883)
@@ -27,7 +27,6 @@
#include <utility>
#include <wtf/Forward.h>
-#include <wtf/Seconds.h>
#include <wtf/URL.h>
#include <wtf/Vector.h>
#include <wtf/text/WTFString.h>
@@ -35,9 +34,9 @@
namespace WebDriver {
struct Timeouts {
- Optional<Seconds> script;
- Optional<Seconds> pageLoad;
- Optional<Seconds> implicit;
+ Optional<double> script;
+ Optional<double> pageLoad;
+ Optional<double> implicit;
};
enum class PageLoadStrategy {
Modified: trunk/Source/WebDriver/ChangeLog (253882 => 253883)
--- trunk/Source/WebDriver/ChangeLog 2019-12-23 10:06:29 UTC (rev 253882)
+++ trunk/Source/WebDriver/ChangeLog 2019-12-23 10:42:26 UTC (rev 253883)
@@ -1,3 +1,34 @@
+2019-12-23 Carlos Garcia Campos <[email protected]>
+
+ WebDriver: fix handling of session timeouts for values higher than MAX_INT
+ https://bugs.webkit.org/show_bug.cgi?id=204114
+
+ Reviewed by Brian Burg.
+
+ Use double instead of Seconds for handling timeouts.
+
+ * Capabilities.h:
+ * Session.cpp:
+ (WebDriver::Session::getTimeouts): Handle the case of script timeout being null.
+ (WebDriver::Session::go):
+ (WebDriver::Session::back):
+ (WebDriver::Session::forward):
+ (WebDriver::Session::refresh):
+ (WebDriver::Session::findElements):
+ (WebDriver::Session::waitForNavigationToComplete):
+ (WebDriver::Session::executeScript): Do not pass a timeout when it's null.
+ * Session.h:
+ (WebDriver::Session::scriptTimeout const):
+ (WebDriver::Session::pageLoadTimeout const):
+ (WebDriver::Session::implicitWaitTimeout const):
+ * WebDriverService.cpp:
+ (WebDriver::deserializeTimeouts): Add IgnoreUnknownTimeout, since we should only fail when processing
+ capabilities, but not when setting new timeouts. Also handle the case of script timeout being null.
+ (WebDriver::WebDriverService::parseCapabilities const): Pass IgnoreUnknownTimeout::No to deserializeTimeouts.
+ (WebDriver::WebDriverService::validatedCapabilities const): Ditto.
+ (WebDriver::WebDriverService::createSession): Handle the case of script timeout being null.
+ (WebDriver::WebDriverService::setTimeouts): Pass IgnoreUnknownTimeout::Yes to deserializeTimeouts.
+
2019-12-13 Jim Mason <[email protected]>
[GTK] WebKitGTK build hangs on g-ir-scanner
Modified: trunk/Source/WebDriver/Session.cpp (253882 => 253883)
--- trunk/Source/WebDriver/Session.cpp 2019-12-23 10:06:29 UTC (rev 253882)
+++ trunk/Source/WebDriver/Session.cpp 2019-12-23 10:42:26 UTC (rev 253883)
@@ -38,11 +38,11 @@
namespace WebDriver {
// https://w3c.github.io/webdriver/webdriver-spec.html#dfn-session-script-timeout
-static const Seconds defaultScriptTimeout = 30_s;
+static const double defaultScriptTimeout = 30000;
// https://w3c.github.io/webdriver/webdriver-spec.html#dfn-session-page-load-timeout
-static const Seconds defaultPageLoadTimeout = 300_s;
+static const double defaultPageLoadTimeout = 300000;
// https://w3c.github.io/webdriver/webdriver-spec.html#dfn-session-implicit-wait-timeout
-static const Seconds defaultImplicitWaitTimeout = 0_s;
+static const double defaultImplicitWaitTimeout = 0;
const String& Session::webElementIdentifier()
{
@@ -127,9 +127,12 @@
void Session::getTimeouts(Function<void (CommandResult&&)>&& completionHandler)
{
RefPtr<JSON::Object> parameters = JSON::Object::create();
- parameters->setInteger("script"_s, m_scriptTimeout.millisecondsAs<int>());
- parameters->setInteger("pageLoad"_s, m_pageLoadTimeout.millisecondsAs<int>());
- parameters->setInteger("implicit"_s, m_implicitWaitTimeout.millisecondsAs<int>());
+ if (m_scriptTimeout == std::numeric_limits<double>::infinity())
+ parameters->setValue("script"_s, JSON::Value::null());
+ else
+ parameters->setDouble("script"_s, m_scriptTimeout);
+ parameters->setDouble("pageLoad"_s, m_pageLoadTimeout);
+ parameters->setDouble("implicit"_s, m_implicitWaitTimeout);
completionHandler(CommandResult::success(WTFMove(parameters)));
}
@@ -300,7 +303,7 @@
RefPtr<JSON::Object> parameters = JSON::Object::create();
parameters->setString("handle"_s, m_toplevelBrowsingContext.value());
parameters->setString("url"_s, url);
- parameters->setInteger("pageLoadTimeout"_s, m_pageLoadTimeout.millisecondsAs<int>());
+ parameters->setDouble("pageLoadTimeout"_s, m_pageLoadTimeout);
if (auto pageLoadStrategy = pageLoadStrategyString())
parameters->setString("pageLoadStrategy"_s, pageLoadStrategy.value());
m_host->sendCommandToBackend("navigateBrowsingContext"_s, WTFMove(parameters), [this, protectedThis = protectedThis.copyRef(), completionHandler = WTFMove(completionHandler)](SessionHost::CommandResponse&& response) {
@@ -363,7 +366,7 @@
}
RefPtr<JSON::Object> parameters = JSON::Object::create();
parameters->setString("handle"_s, m_toplevelBrowsingContext.value());
- parameters->setInteger("pageLoadTimeout"_s, m_pageLoadTimeout.millisecondsAs<int>());
+ parameters->setDouble("pageLoadTimeout"_s, m_pageLoadTimeout);
if (auto pageLoadStrategy = pageLoadStrategyString())
parameters->setString("pageLoadStrategy"_s, pageLoadStrategy.value());
m_host->sendCommandToBackend("goBackInBrowsingContext"_s, WTFMove(parameters), [this, protectedThis = protectedThis.copyRef(), completionHandler = WTFMove(completionHandler)](SessionHost::CommandResponse&& response) {
@@ -391,7 +394,7 @@
}
RefPtr<JSON::Object> parameters = JSON::Object::create();
parameters->setString("handle"_s, m_toplevelBrowsingContext.value());
- parameters->setInteger("pageLoadTimeout"_s, m_pageLoadTimeout.millisecondsAs<int>());
+ parameters->setDouble("pageLoadTimeout"_s, m_pageLoadTimeout);
if (auto pageLoadStrategy = pageLoadStrategyString())
parameters->setString("pageLoadStrategy"_s, pageLoadStrategy.value());
m_host->sendCommandToBackend("goForwardInBrowsingContext"_s, WTFMove(parameters), [this, protectedThis = protectedThis.copyRef(), completionHandler = WTFMove(completionHandler)](SessionHost::CommandResponse&& response) {
@@ -419,7 +422,7 @@
}
RefPtr<JSON::Object> parameters = JSON::Object::create();
parameters->setString("handle"_s, m_toplevelBrowsingContext.value());
- parameters->setInteger("pageLoadTimeout"_s, m_pageLoadTimeout.millisecondsAs<int>());
+ parameters->setDouble("pageLoadTimeout"_s, m_pageLoadTimeout);
if (auto pageLoadStrategy = pageLoadStrategyString())
parameters->setString("pageLoadStrategy"_s, pageLoadStrategy.value());
m_host->sendCommandToBackend("reloadBrowsingContext"_s, WTFMove(parameters), [this, protectedThis = protectedThis.copyRef(), completionHandler = WTFMove(completionHandler)](SessionHost::CommandResponse&& response) {
@@ -1027,7 +1030,7 @@
arguments->pushString(createElement(rootElementID)->toJSONString());
arguments->pushString(JSON::Value::create(selector)->toJSONString());
arguments->pushString(JSON::Value::create(mode == FindElementsMode::Single)->toJSONString());
- arguments->pushString(JSON::Value::create(m_implicitWaitTimeout.milliseconds())->toJSONString());
+ arguments->pushString(JSON::Value::create(m_implicitWaitTimeout)->toJSONString());
RefPtr<JSON::Object> parameters = JSON::Object::create();
parameters->setString("browsingContextHandle"_s, m_toplevelBrowsingContext.value());
@@ -1038,7 +1041,7 @@
parameters->setBoolean("expectsImplicitCallbackArgument"_s, true);
// If there's an implicit wait, use one second more as callback timeout.
if (m_implicitWaitTimeout)
- parameters->setInteger("callbackTimeout"_s, Seconds(m_implicitWaitTimeout + 1_s).millisecondsAs<int>());
+ parameters->setDouble("callbackTimeout"_s, m_implicitWaitTimeout + 1000);
m_host->sendCommandToBackend("evaluateJavaScriptFunction"_s, WTFMove(parameters), [this, protectedThis = protectedThis.copyRef(), mode, completionHandler = WTFMove(completionHandler)](SessionHost::CommandResponse&& response) {
if (response.isError || !response.responseObject) {
@@ -1505,7 +1508,7 @@
parameters->setString("browsingContextHandle"_s, m_toplevelBrowsingContext.value());
if (m_currentBrowsingContext)
parameters->setString("frameHandle"_s, m_currentBrowsingContext.value());
- parameters->setInteger("pageLoadTimeout"_s, m_pageLoadTimeout.millisecondsAs<int>());
+ parameters->setDouble("pageLoadTimeout"_s, m_pageLoadTimeout);
if (auto pageLoadStrategy = pageLoadStrategyString())
parameters->setString("pageLoadStrategy"_s, pageLoadStrategy.value());
m_host->sendCommandToBackend("waitForNavigationToComplete"_s, WTFMove(parameters), [this, protectedThis = makeRef(*this), completionHandler = WTFMove(completionHandler)](SessionHost::CommandResponse&& response) {
@@ -2134,8 +2137,8 @@
parameters->setArray("arguments"_s, WTFMove(arguments));
if (mode == ExecuteScriptMode::Async) {
parameters->setBoolean("expectsImplicitCallbackArgument"_s, true);
- if (m_scriptTimeout)
- parameters->setInteger("callbackTimeout"_s, m_scriptTimeout.millisecondsAs<int>());
+ if (m_scriptTimeout != std::numeric_limits<double>::infinity())
+ parameters->setDouble("callbackTimeout"_s, m_scriptTimeout);
}
m_host->sendCommandToBackend("evaluateJavaScriptFunction"_s, WTFMove(parameters), [this, protectedThis = protectedThis.copyRef(), completionHandler = WTFMove(completionHandler)](SessionHost::CommandResponse&& response) mutable {
if (response.isError || !response.responseObject) {
Modified: trunk/Source/WebDriver/Session.h (253882 => 253883)
--- trunk/Source/WebDriver/Session.h 2019-12-23 10:06:29 UTC (rev 253882)
+++ trunk/Source/WebDriver/Session.h 2019-12-23 10:42:26 UTC (rev 253883)
@@ -50,9 +50,9 @@
const String& id() const;
const Capabilities& capabilities() const;
bool isConnected() const;
- Seconds scriptTimeout() const { return m_scriptTimeout; }
- Seconds pageLoadTimeout() const { return m_pageLoadTimeout; }
- Seconds implicitWaitTimeout() const { return m_implicitWaitTimeout; }
+ double scriptTimeout() const { return m_scriptTimeout; }
+ double pageLoadTimeout() const { return m_pageLoadTimeout; }
+ double implicitWaitTimeout() const { return m_implicitWaitTimeout; }
static const String& webElementIdentifier();
enum class FindElementsMode { Single, Multiple };
@@ -207,9 +207,9 @@
InputSourceState& inputSourceState(const String& id);
std::unique_ptr<SessionHost> m_host;
- Seconds m_scriptTimeout;
- Seconds m_pageLoadTimeout;
- Seconds m_implicitWaitTimeout;
+ double m_scriptTimeout;
+ double m_pageLoadTimeout;
+ double m_implicitWaitTimeout;
Optional<String> m_toplevelBrowsingContext;
Optional<String> m_currentBrowsingContext;
HashMap<String, InputSource> m_activeInputSources;
Modified: trunk/Source/WebDriver/WebDriverService.cpp (253882 => 253883)
--- trunk/Source/WebDriver/WebDriverService.cpp 2019-12-23 10:06:29 UTC (rev 253882)
+++ trunk/Source/WebDriver/WebDriverService.cpp 2019-12-23 10:42:26 UTC (rev 253883)
@@ -320,7 +320,9 @@
return intValue;
}
-static Optional<Timeouts> deserializeTimeouts(JSON::Object& timeoutsObject)
+enum class IgnoreUnknownTimeout { No, Yes };
+
+static Optional<Timeouts> deserializeTimeouts(JSON::Object& timeoutsObject, IgnoreUnknownTimeout ignoreUnknownTimeout)
{
// ยง8.5 Set Timeouts.
// https://w3c.github.io/webdriver/webdriver-spec.html#dfn-deserialize-as-a-timeout
@@ -330,6 +332,11 @@
if (it->key == "sessionId")
continue;
+ if (it->key == "script" && it->value->isNull()) {
+ timeouts.script = std::numeric_limits<double>::infinity();
+ continue;
+ }
+
// If value is not an integer, or it is less than 0 or greater than the maximum safe integer, return error with error code invalid argument.
auto timeoutMS = unsignedValue(*it->value);
if (!timeoutMS)
@@ -336,12 +343,12 @@
return WTF::nullopt;
if (it->key == "script")
- timeouts.script = Seconds::fromMilliseconds(timeoutMS.value());
+ timeouts.script = timeoutMS.value();
else if (it->key == "pageLoad")
- timeouts.pageLoad = Seconds::fromMilliseconds(timeoutMS.value());
+ timeouts.pageLoad = timeoutMS.value();
else if (it->key == "implicit")
- timeouts.implicit = Seconds::fromMilliseconds(timeoutMS.value());
- else
+ timeouts.implicit = timeoutMS.value();
+ else if (ignoreUnknownTimeout == IgnoreUnknownTimeout::No)
return WTF::nullopt;
}
return timeouts;
@@ -487,7 +494,7 @@
capabilities.strictFileInteractability = strictFileInteractability;
RefPtr<JSON::Object> timeouts;
if (matchedCapabilities.getObject("timeouts"_s, timeouts))
- capabilities.timeouts = deserializeTimeouts(*timeouts);
+ capabilities.timeouts = deserializeTimeouts(*timeouts, IgnoreUnknownTimeout::No);
String pageLoadStrategy;
if (matchedCapabilities.getString("pageLoadStrategy"_s, pageLoadStrategy))
capabilities.pageLoadStrategy = deserializePageLoadStrategy(pageLoadStrategy);
@@ -549,7 +556,7 @@
result->setBoolean(it->key, strictFileInteractability);
} else if (it->key == "timeouts") {
RefPtr<JSON::Object> timeouts;
- if (!it->value->asObject(timeouts) || !deserializeTimeouts(*timeouts))
+ if (!it->value->asObject(timeouts) || !deserializeTimeouts(*timeouts, IgnoreUnknownTimeout::No))
return nullptr;
result->setValue(it->key, RefPtr<JSON::Value>(it->value));
} else if (it->key == "unhandledPromptBehavior") {
@@ -843,9 +850,12 @@
if (!capabilities.proxy)
capabilitiesObject->setObject("proxy"_s, JSON::Object::create());
RefPtr<JSON::Object> timeoutsObject = JSON::Object::create();
- timeoutsObject->setInteger("script"_s, m_session->scriptTimeout().millisecondsAs<int>());
- timeoutsObject->setInteger("pageLoad"_s, m_session->pageLoadTimeout().millisecondsAs<int>());
- timeoutsObject->setInteger("implicit"_s, m_session->implicitWaitTimeout().millisecondsAs<int>());
+ if (m_session->scriptTimeout() == std::numeric_limits<double>::infinity())
+ timeoutsObject->setValue("script"_s, JSON::Value::null());
+ else
+ timeoutsObject->setDouble("script"_s, m_session->scriptTimeout());
+ timeoutsObject->setDouble("pageLoad"_s, m_session->pageLoadTimeout());
+ timeoutsObject->setDouble("implicit"_s, m_session->implicitWaitTimeout());
capabilitiesObject->setObject("timeouts"_s, WTFMove(timeoutsObject));
resultObject->setObject("capabilities"_s, WTFMove(capabilitiesObject));
@@ -906,7 +916,7 @@
if (!findSessionOrCompleteWithError(*parameters, completionHandler))
return;
- auto timeouts = deserializeTimeouts(*parameters);
+ auto timeouts = deserializeTimeouts(*parameters, IgnoreUnknownTimeout::Yes);
if (!timeouts) {
completionHandler(CommandResult::fail(CommandResult::ErrorCode::InvalidArgument));
return;
Modified: trunk/Source/WebKit/ChangeLog (253882 => 253883)
--- trunk/Source/WebKit/ChangeLog 2019-12-23 10:06:29 UTC (rev 253882)
+++ trunk/Source/WebKit/ChangeLog 2019-12-23 10:42:26 UTC (rev 253883)
@@ -1,5 +1,32 @@
2019-12-23 Carlos Garcia Campos <[email protected]>
+ WebDriver: fix handling of session timeouts for values higher than MAX_INT
+ https://bugs.webkit.org/show_bug.cgi?id=204114
+
+ Reviewed by Brian Burg.
+
+ Use number instead of integer for all optional timeout parameters. In the case of script timeout, not passing a
+ value means a timeout should not be used, so use Optional<double> also for the IPC message and handle the
+ optional value in the web process to not set any timeout in that case.
+
+ * UIProcess/Automation/Automation.json:
+ * UIProcess/Automation/WebAutomationSession.cpp:
+ (WebKit::WebAutomationSession::waitForNavigationToComplete):
+ (WebKit::WebAutomationSession::navigateBrowsingContext):
+ (WebKit::WebAutomationSession::goBackInBrowsingContext):
+ (WebKit::WebAutomationSession::goForwardInBrowsingContext):
+ (WebKit::WebAutomationSession::reloadBrowsingContext):
+ (WebKit::WebAutomationSession::evaluateJavaScriptFunction):
+ * UIProcess/Automation/WebAutomationSession.h:
+ * WebProcess/Automation/WebAutomationSessionProxy.cpp:
+ (WebKit::WebAutomationSessionProxy::evaluateJavaScriptFunction):
+ * WebProcess/Automation/WebAutomationSessionProxy.h:
+ * WebProcess/Automation/WebAutomationSessionProxy.js:
+ (let.AutomationSessionProxy.prototype.evaluateJavaScriptFunction):
+ * WebProcess/Automation/WebAutomationSessionProxy.messages.in:
+
+2019-12-23 Carlos Garcia Campos <[email protected]>
+
[GTK] InputMethod API unit tests don't work under X11
https://bugs.webkit.org/show_bug.cgi?id=205497
Modified: trunk/Source/WebKit/UIProcess/Automation/Automation.json (253882 => 253883)
--- trunk/Source/WebKit/UIProcess/Automation/Automation.json 2019-12-23 10:06:29 UTC (rev 253882)
+++ trunk/Source/WebKit/UIProcess/Automation/Automation.json 2019-12-23 10:42:26 UTC (rev 253883)
@@ -388,7 +388,7 @@
{ "name": "handle", "$ref": "BrowsingContextHandle", "description": "The handle for the browsing context that should be navigated." },
{ "name": "url", "type": "string", "description": "The URL to load in the browsing context." },
{ "name": "pageLoadStrategy", "$ref": "PageLoadStrategy", "optional": true, "description": "The page load strategy to use when determining when navigation is complete." },
- { "name": "pageLoadTimeout", "type": "integer", "optional": true, "description": "The timeout in milliseconds that the navigation is expected to be completed in, otherwise a <code>Timeout</code> error is returned." }
+ { "name": "pageLoadTimeout", "type": "number", "optional": true, "description": "The timeout in milliseconds that the navigation is expected to be completed in, otherwise a <code>Timeout</code> error is returned." }
],
"async": true
},
@@ -398,7 +398,7 @@
"parameters": [
{ "name": "handle", "$ref": "BrowsingContextHandle", "description": "The handle for the browsing context that should be navigated." },
{ "name": "pageLoadStrategy", "$ref": "PageLoadStrategy", "optional": true, "description": "The page load strategy to use when determining when navigation is complete." },
- { "name": "pageLoadTimeout", "type": "integer", "optional": true, "description": "The timeout in milliseconds that the navigation is expected to be completed in, otherwise a <code>Timeout</code> error is returned." }
+ { "name": "pageLoadTimeout", "type": "number", "optional": true, "description": "The timeout in milliseconds that the navigation is expected to be completed in, otherwise a <code>Timeout</code> error is returned." }
],
"async": true
},
@@ -408,7 +408,7 @@
"parameters": [
{ "name": "handle", "$ref": "BrowsingContextHandle", "description": "The handle for the browsing context that should be navigated." },
{ "name": "pageLoadStrategy", "$ref": "PageLoadStrategy", "optional": true, "description": "The page load strategy to use when determining when navigation is complete." },
- { "name": "pageLoadTimeout", "type": "integer", "optional": true, "description": "The timeout in milliseconds that the navigation is expected to be completed in, otherwise a <code>Timeout</code> error is returned." }
+ { "name": "pageLoadTimeout", "type": "number", "optional": true, "description": "The timeout in milliseconds that the navigation is expected to be completed in, otherwise a <code>Timeout</code> error is returned." }
],
"async": true
},
@@ -418,7 +418,7 @@
"parameters": [
{ "name": "handle", "$ref": "BrowsingContextHandle", "description": "The handle for the browsing context that should be reloaded." },
{ "name": "pageLoadStrategy", "$ref": "PageLoadStrategy", "optional": true, "description": "The page load strategy to use when determining when navigation is complete." },
- { "name": "pageLoadTimeout", "type": "integer", "optional": true, "description": "The timeout in milliseconds that the navigation is expected to be completed in, otherwise a <code>Timeout</code> error is returned." }
+ { "name": "pageLoadTimeout", "type": "number", "optional": true, "description": "The timeout in milliseconds that the navigation is expected to be completed in, otherwise a <code>Timeout</code> error is returned." }
],
"async": true
},
@@ -429,7 +429,7 @@
{ "name": "browsingContextHandle", "$ref": "BrowsingContextHandle", "description": "The handle for the browsing context in which wait for pending navigation to complete." },
{ "name": "frameHandle", "$ref": "FrameHandle", "optional": true, "description": "The handle for the frame in which wait for pending navigation to complete. The main frame is used if this parameter empty string or excluded." },
{ "name": "pageLoadStrategy", "$ref": "PageLoadStrategy", "optional": true, "description": "The page load strategy to use when determining when navigation is complete." },
- { "name": "pageLoadTimeout", "type": "integer", "optional": true, "description": "The timeout in milliseconds that the navigation is expected to be completed in, otherwise a <code>Timeout</code> error is returned." }
+ { "name": "pageLoadTimeout", "type": "number", "optional": true, "description": "The timeout in milliseconds that the navigation is expected to be completed in, otherwise a <code>Timeout</code> error is returned." }
],
"async": true
},
@@ -452,7 +452,7 @@
{ "name": "function", "type": "string", "description": "The script to evaluate in the browsing context. It must be a function result." },
{ "name": "arguments", "type": "array", "items": { "type": "string" }, "description": "The arguments to pass to the function when called. They will be parsed as JSON before calling the function." },
{ "name": "expectsImplicitCallbackArgument", "type": "boolean", "optional": true, "description": "The function expects a callback function as the last argument. It is expected to call this callback with a result." },
- { "name": "callbackTimeout", "type": "integer", "optional": true, "description": "The timeout in milliseconds that the implicit callback is expected to be called in, otherwise a <code>_javascript_Timeout</code> error is returned." }
+ { "name": "callbackTimeout", "type": "number", "optional": true, "description": "The timeout in milliseconds that the implicit callback is expected to be called in, otherwise a <code>_javascript_Timeout</code> error is returned." }
],
"returns": [
{ "name": "result", "type": "string", "description": "The result returned by the called function. It is JSON encoded after the function returns or calls the callback." }
Modified: trunk/Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp (253882 => 253883)
--- trunk/Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp 2019-12-23 10:06:29 UTC (rev 253882)
+++ trunk/Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp 2019-12-23 10:42:26 UTC (rev 253883)
@@ -442,7 +442,7 @@
return parsedPageLoadStrategy;
}
-void WebAutomationSession::waitForNavigationToComplete(const String& browsingContextHandle, const String* optionalFrameHandle, const String* optionalPageLoadStrategyString, const int* optionalPageLoadTimeout, Ref<WaitForNavigationToCompleteCallback>&& callback)
+void WebAutomationSession::waitForNavigationToComplete(const String& browsingContextHandle, const String* optionalFrameHandle, const String* optionalPageLoadStrategyString, const double* optionalPageLoadTimeout, Ref<WaitForNavigationToCompleteCallback>&& callback)
{
WebPageProxy* page = webPageProxyForHandle(browsingContextHandle);
if (!page)
@@ -696,7 +696,7 @@
m_windowStateTransitionCallback(WindowTransitionedToState::Unfullscreen);
}
-void WebAutomationSession::navigateBrowsingContext(const String& handle, const String& url, const String* optionalPageLoadStrategyString, const int* optionalPageLoadTimeout, Ref<NavigateBrowsingContextCallback>&& callback)
+void WebAutomationSession::navigateBrowsingContext(const String& handle, const String& url, const String* optionalPageLoadStrategyString, const double* optionalPageLoadTimeout, Ref<NavigateBrowsingContextCallback>&& callback)
{
WebPageProxy* page = webPageProxyForHandle(handle);
if (!page)
@@ -711,7 +711,7 @@
waitForNavigationToCompleteOnPage(*page, pageLoadStrategy.value(), pageLoadTimeout, WTFMove(callback));
}
-void WebAutomationSession::goBackInBrowsingContext(const String& handle, const String* optionalPageLoadStrategyString, const int* optionalPageLoadTimeout, Ref<GoBackInBrowsingContextCallback>&& callback)
+void WebAutomationSession::goBackInBrowsingContext(const String& handle, const String* optionalPageLoadStrategyString, const double* optionalPageLoadTimeout, Ref<GoBackInBrowsingContextCallback>&& callback)
{
WebPageProxy* page = webPageProxyForHandle(handle);
if (!page)
@@ -726,7 +726,7 @@
waitForNavigationToCompleteOnPage(*page, pageLoadStrategy.value(), pageLoadTimeout, WTFMove(callback));
}
-void WebAutomationSession::goForwardInBrowsingContext(const String& handle, const String* optionalPageLoadStrategyString, const int* optionalPageLoadTimeout, Ref<GoForwardInBrowsingContextCallback>&& callback)
+void WebAutomationSession::goForwardInBrowsingContext(const String& handle, const String* optionalPageLoadStrategyString, const double* optionalPageLoadTimeout, Ref<GoForwardInBrowsingContextCallback>&& callback)
{
WebPageProxy* page = webPageProxyForHandle(handle);
if (!page)
@@ -741,7 +741,7 @@
waitForNavigationToCompleteOnPage(*page, pageLoadStrategy.value(), pageLoadTimeout, WTFMove(callback));
}
-void WebAutomationSession::reloadBrowsingContext(const String& handle, const String* optionalPageLoadStrategyString, const int* optionalPageLoadTimeout, Ref<ReloadBrowsingContextCallback>&& callback)
+void WebAutomationSession::reloadBrowsingContext(const String& handle, const String* optionalPageLoadStrategyString, const double* optionalPageLoadTimeout, Ref<ReloadBrowsingContextCallback>&& callback)
{
WebPageProxy* page = webPageProxyForHandle(handle);
if (!page)
@@ -922,7 +922,7 @@
m_domainNotifier->fileChooserDismissed(browsingContextHandle, false);
}
-void WebAutomationSession::evaluateJavaScriptFunction(const String& browsingContextHandle, const String* optionalFrameHandle, const String& function, const JSON::Array& arguments, const bool* optionalExpectsImplicitCallbackArgument, const int* optionalCallbackTimeout, Ref<EvaluateJavaScriptFunctionCallback>&& callback)
+void WebAutomationSession::evaluateJavaScriptFunction(const String& browsingContextHandle, const String* optionalFrameHandle, const String& function, const JSON::Array& arguments, const bool* optionalExpectsImplicitCallbackArgument, const double* optionalCallbackTimeout, Ref<EvaluateJavaScriptFunctionCallback>&& callback)
{
WebPageProxy* page = webPageProxyForHandle(browsingContextHandle);
if (!page)
@@ -943,7 +943,9 @@
}
bool expectsImplicitCallbackArgument = optionalExpectsImplicitCallbackArgument ? *optionalExpectsImplicitCallbackArgument : false;
- int callbackTimeout = optionalCallbackTimeout ? *optionalCallbackTimeout : 0;
+ Optional<double> callbackTimeout;
+ if (optionalCallbackTimeout)
+ callbackTimeout = *optionalCallbackTimeout;
uint64_t callbackID = m_nextEvaluateJavaScriptCallbackID++;
m_evaluateJavaScriptFunctionCallbacks.set(callbackID, WTFMove(callback));
Modified: trunk/Source/WebKit/UIProcess/Automation/WebAutomationSession.h (253882 => 253883)
--- trunk/Source/WebKit/UIProcess/Automation/WebAutomationSession.h 2019-12-23 10:06:29 UTC (rev 253882)
+++ trunk/Source/WebKit/UIProcess/Automation/WebAutomationSession.h 2019-12-23 10:42:26 UTC (rev 253883)
@@ -170,12 +170,12 @@
void setWindowFrameOfBrowsingContext(const String& handle, const JSON::Object* origin, const JSON::Object* size, Ref<SetWindowFrameOfBrowsingContextCallback>&&) final;
void maximizeWindowOfBrowsingContext(const String& handle, Ref<MaximizeWindowOfBrowsingContextCallback>&&) final;
void hideWindowOfBrowsingContext(const String& handle, Ref<HideWindowOfBrowsingContextCallback>&&) final;
- void navigateBrowsingContext(const String& handle, const String& url, const String* optionalPageLoadStrategyString, const int* optionalPageLoadTimeout, Ref<NavigateBrowsingContextCallback>&&) override;
- void goBackInBrowsingContext(const String&, const String* optionalPageLoadStrategyString, const int* optionalPageLoadTimeout, Ref<GoBackInBrowsingContextCallback>&&) override;
- void goForwardInBrowsingContext(const String&, const String* optionalPageLoadStrategyString, const int* optionalPageLoadTimeout, Ref<GoForwardInBrowsingContextCallback>&&) override;
- void reloadBrowsingContext(const String&, const String* optionalPageLoadStrategyString, const int* optionalPageLoadTimeout, Ref<ReloadBrowsingContextCallback>&&) override;
- void waitForNavigationToComplete(const String& browsingContextHandle, const String* optionalFrameHandle, const String* optionalPageLoadStrategyString, const int* optionalPageLoadTimeout, Ref<WaitForNavigationToCompleteCallback>&&) override;
- void evaluateJavaScriptFunction(const String& browsingContextHandle, const String* optionalFrameHandle, const String& function, const JSON::Array& arguments, const bool* optionalExpectsImplicitCallbackArgument, const int* optionalCallbackTimeout, Ref<Inspector::AutomationBackendDispatcherHandler::EvaluateJavaScriptFunctionCallback>&&) override;
+ void navigateBrowsingContext(const String& handle, const String& url, const String* optionalPageLoadStrategyString, const double* optionalPageLoadTimeout, Ref<NavigateBrowsingContextCallback>&&) override;
+ void goBackInBrowsingContext(const String&, const String* optionalPageLoadStrategyString, const double* optionalPageLoadTimeout, Ref<GoBackInBrowsingContextCallback>&&) override;
+ void goForwardInBrowsingContext(const String&, const String* optionalPageLoadStrategyString, const double* optionalPageLoadTimeout, Ref<GoForwardInBrowsingContextCallback>&&) override;
+ void reloadBrowsingContext(const String&, const String* optionalPageLoadStrategyString, const double* optionalPageLoadTimeout, Ref<ReloadBrowsingContextCallback>&&) override;
+ void waitForNavigationToComplete(const String& browsingContextHandle, const String* optionalFrameHandle, const String* optionalPageLoadStrategyString, const double* optionalPageLoadTimeout, Ref<WaitForNavigationToCompleteCallback>&&) override;
+ void evaluateJavaScriptFunction(const String& browsingContextHandle, const String* optionalFrameHandle, const String& function, const JSON::Array& arguments, const bool* optionalExpectsImplicitCallbackArgument, const double* optionalCallbackTimeout, Ref<Inspector::AutomationBackendDispatcherHandler::EvaluateJavaScriptFunctionCallback>&&) override;
void performMouseInteraction(const String& handle, const JSON::Object& requestedPosition, const String& mouseButton, const String& mouseInteraction, const JSON::Array& keyModifiers, Ref<PerformMouseInteractionCallback>&&) final;
void performKeyboardInteractions(const String& handle, const JSON::Array& interactions, Ref<PerformKeyboardInteractionsCallback>&&) override;
void performInteractionSequence(const String& handle, const String* optionalFrameHandle, const JSON::Array& sources, const JSON::Array& steps, Ref<PerformInteractionSequenceCallback>&&) override;
Modified: trunk/Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.cpp (253882 => 253883)
--- trunk/Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.cpp 2019-12-23 10:06:29 UTC (rev 253882)
+++ trunk/Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.cpp 2019-12-23 10:42:26 UTC (rev 253883)
@@ -235,7 +235,7 @@
WebProcess::singleton().parentProcessConnection()->send(Messages::WebAutomationSession::DidEvaluateJavaScriptFunction(callbackID, errorMessage, errorType), 0);
}
-void WebAutomationSessionProxy::evaluateJavaScriptFunction(WebCore::PageIdentifier pageID, Optional<WebCore::FrameIdentifier> optionalFrameID, const String& function, Vector<String> arguments, bool expectsImplicitCallbackArgument, int callbackTimeout, uint64_t callbackID)
+void WebAutomationSessionProxy::evaluateJavaScriptFunction(WebCore::PageIdentifier pageID, Optional<WebCore::FrameIdentifier> optionalFrameID, const String& function, Vector<String> arguments, bool expectsImplicitCallbackArgument, Optional<double> callbackTimeout, uint64_t callbackID)
{
WebPage* page = WebProcess::singleton().webPage(pageID);
if (!page) {
@@ -269,7 +269,7 @@
JSValueMakeNumber(context, frameID.toUInt64()),
JSValueMakeNumber(context, callbackID),
JSObjectMakeFunctionWithCallback(context, nullptr, evaluateJavaScriptCallback),
- JSValueMakeNumber(context, callbackTimeout)
+ JSValueMakeNumber(context, callbackTimeout.valueOr(-1))
};
{
Modified: trunk/Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.h (253882 => 253883)
--- trunk/Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.h 2019-12-23 10:06:29 UTC (rev 253882)
+++ trunk/Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.h 2019-12-23 10:42:26 UTC (rev 253883)
@@ -63,7 +63,7 @@
void didReceiveMessage(IPC::Connection&, IPC::Decoder&) override;
// Called by WebAutomationSessionProxy messages
- void evaluateJavaScriptFunction(WebCore::PageIdentifier, Optional<WebCore::FrameIdentifier>, const String& function, Vector<String> arguments, bool expectsImplicitCallbackArgument, int callbackTimeout, uint64_t callbackID);
+ void evaluateJavaScriptFunction(WebCore::PageIdentifier, Optional<WebCore::FrameIdentifier>, const String& function, Vector<String> arguments, bool expectsImplicitCallbackArgument, Optional<double> callbackTimeout, uint64_t callbackID);
void resolveChildFrameWithOrdinal(WebCore::PageIdentifier, Optional<WebCore::FrameIdentifier>, uint32_t ordinal, CompletionHandler<void(Optional<String>, Optional<WebCore::FrameIdentifier>)>&&);
void resolveChildFrameWithNodeHandle(WebCore::PageIdentifier, Optional<WebCore::FrameIdentifier>, const String& nodeHandle, CompletionHandler<void(Optional<String>, Optional<WebCore::FrameIdentifier>)>&&);
void resolveChildFrameWithName(WebCore::PageIdentifier, Optional<WebCore::FrameIdentifier>, const String& name, CompletionHandler<void(Optional<String>, Optional<WebCore::FrameIdentifier>)>&&);
Modified: trunk/Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.js (253882 => 253883)
--- trunk/Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.js 2019-12-23 10:06:29 UTC (rev 253882)
+++ trunk/Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.js 2019-12-23 10:42:26 UTC (rev 253883)
@@ -64,7 +64,7 @@
if (expectsImplicitCallbackArgument) {
argumentValues.push(reportResult);
functionValue.apply(null, argumentValues);
- if (!resultReported)
+ if (!resultReported && callbackTimeout >= 0)
timeoutIdentifier = setTimeout(reportTimeoutError, callbackTimeout);
} else
reportResult(functionValue.apply(null, argumentValues));
Modified: trunk/Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.messages.in (253882 => 253883)
--- trunk/Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.messages.in 2019-12-23 10:06:29 UTC (rev 253882)
+++ trunk/Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.messages.in 2019-12-23 10:42:26 UTC (rev 253883)
@@ -21,7 +21,7 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
messages -> WebAutomationSessionProxy NotRefCounted {
- EvaluateJavaScriptFunction(WebCore::PageIdentifier pageID, Optional<WebCore::FrameIdentifier> frameID, String function, Vector<String> arguments, bool expectsImplicitCallbackArgument, int callbackTimeout, uint64_t callbackID)
+ EvaluateJavaScriptFunction(WebCore::PageIdentifier pageID, Optional<WebCore::FrameIdentifier> frameID, String function, Vector<String> arguments, bool expectsImplicitCallbackArgument, Optional<double> callbackTimeout, uint64_t callbackID)
ResolveChildFrameWithOrdinal(WebCore::PageIdentifier pageID, Optional<WebCore::FrameIdentifier> frameID, uint32_t ordinal) -> (Optional<String> errorType, Optional<WebCore::FrameIdentifier> frameID) Async
ResolveChildFrameWithNodeHandle(WebCore::PageIdentifier pageID, Optional<WebCore::FrameIdentifier> frameID, String nodeHandle) -> (Optional<String> errorType, Optional<WebCore::FrameIdentifier> frameID) Async