Changeset 253883 in webkit
- Timestamp:
- Dec 23, 2019 2:42:26 AM (4 years ago)
- Location:
- trunk/Source
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r253870 r253883 1 2019-12-23 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 WebDriver: fix handling of session timeouts for values higher than MAX_INT 4 https://bugs.webkit.org/show_bug.cgi?id=204114 5 6 Reviewed by Brian Burg. 7 8 Fix generation of code with optional number in stack variable. 9 10 * inspector/scripts/codegen/cpp_generator.py: 11 (CppGenerator.cpp_type_for_stack_in_parameter): Do not use Optional for numbers either. 12 * inspector/scripts/tests/generic/expected/commands-with-optional-call-return-parameters.json-result: 13 1 14 2019-12-22 Yusuke Suzuki <ysuzuki@apple.com> 2 15 -
trunk/Source/JavaScriptCore/inspector/scripts/codegen/cpp_generator.py
r239846 r253883 276 276 if _type.qualified_name() in ['any', 'object']: 277 277 return "RefPtr<%s>" % CppGenerator.cpp_name_for_primitive_type(_type) 278 elif parameter.is_optional and _type.qualified_name() not in ['boolean', 'string', 'integer' ]:278 elif parameter.is_optional and _type.qualified_name() not in ['boolean', 'string', 'integer', 'number']: 279 279 return "Optional<%s>" % cpp_name 280 280 else: -
trunk/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/commands-with-optional-call-return-parameters.json-result
r251395 r253883 262 262 String opt_in_notes = m_backendDispatcher->getString(parameters.get(), "notes"_s, &opt_in_notes_valueFound); 263 263 bool opt_in_timestamp_valueFound = false; 264 Optional<double>opt_in_timestamp = m_backendDispatcher->getDouble(parameters.get(), "timestamp"_s, &opt_in_timestamp_valueFound);264 double opt_in_timestamp = m_backendDispatcher->getDouble(parameters.get(), "timestamp"_s, &opt_in_timestamp_valueFound); 265 265 bool opt_in_values_valueFound = false; 266 266 RefPtr<JSON::Object> opt_in_values = m_backendDispatcher->getObject(parameters.get(), "values"_s, &opt_in_values_valueFound); -
trunk/Source/WebDriver/Capabilities.h
r253030 r253883 28 28 #include <utility> 29 29 #include <wtf/Forward.h> 30 #include <wtf/Seconds.h>31 30 #include <wtf/URL.h> 32 31 #include <wtf/Vector.h> … … 36 35 37 36 struct Timeouts { 38 Optional< Seconds> script;39 Optional< Seconds> pageLoad;40 Optional< Seconds> implicit;37 Optional<double> script; 38 Optional<double> pageLoad; 39 Optional<double> implicit; 41 40 }; 42 41 -
trunk/Source/WebDriver/ChangeLog
r253475 r253883 1 2019-12-23 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 WebDriver: fix handling of session timeouts for values higher than MAX_INT 4 https://bugs.webkit.org/show_bug.cgi?id=204114 5 6 Reviewed by Brian Burg. 7 8 Use double instead of Seconds for handling timeouts. 9 10 * Capabilities.h: 11 * Session.cpp: 12 (WebDriver::Session::getTimeouts): Handle the case of script timeout being null. 13 (WebDriver::Session::go): 14 (WebDriver::Session::back): 15 (WebDriver::Session::forward): 16 (WebDriver::Session::refresh): 17 (WebDriver::Session::findElements): 18 (WebDriver::Session::waitForNavigationToComplete): 19 (WebDriver::Session::executeScript): Do not pass a timeout when it's null. 20 * Session.h: 21 (WebDriver::Session::scriptTimeout const): 22 (WebDriver::Session::pageLoadTimeout const): 23 (WebDriver::Session::implicitWaitTimeout const): 24 * WebDriverService.cpp: 25 (WebDriver::deserializeTimeouts): Add IgnoreUnknownTimeout, since we should only fail when processing 26 capabilities, but not when setting new timeouts. Also handle the case of script timeout being null. 27 (WebDriver::WebDriverService::parseCapabilities const): Pass IgnoreUnknownTimeout::No to deserializeTimeouts. 28 (WebDriver::WebDriverService::validatedCapabilities const): Ditto. 29 (WebDriver::WebDriverService::createSession): Handle the case of script timeout being null. 30 (WebDriver::WebDriverService::setTimeouts): Pass IgnoreUnknownTimeout::Yes to deserializeTimeouts. 31 1 32 2019-12-13 Jim Mason <jmason@ibinx.com> 2 33 -
trunk/Source/WebDriver/Session.cpp
r253425 r253883 39 39 40 40 // https://w3c.github.io/webdriver/webdriver-spec.html#dfn-session-script-timeout 41 static const Seconds defaultScriptTimeout = 30_s;41 static const double defaultScriptTimeout = 30000; 42 42 // https://w3c.github.io/webdriver/webdriver-spec.html#dfn-session-page-load-timeout 43 static const Seconds defaultPageLoadTimeout = 300_s;43 static const double defaultPageLoadTimeout = 300000; 44 44 // https://w3c.github.io/webdriver/webdriver-spec.html#dfn-session-implicit-wait-timeout 45 static const Seconds defaultImplicitWaitTimeout = 0_s;45 static const double defaultImplicitWaitTimeout = 0; 46 46 47 47 const String& Session::webElementIdentifier() … … 128 128 { 129 129 RefPtr<JSON::Object> parameters = JSON::Object::create(); 130 parameters->setInteger("script"_s, m_scriptTimeout.millisecondsAs<int>()); 131 parameters->setInteger("pageLoad"_s, m_pageLoadTimeout.millisecondsAs<int>()); 132 parameters->setInteger("implicit"_s, m_implicitWaitTimeout.millisecondsAs<int>()); 130 if (m_scriptTimeout == std::numeric_limits<double>::infinity()) 131 parameters->setValue("script"_s, JSON::Value::null()); 132 else 133 parameters->setDouble("script"_s, m_scriptTimeout); 134 parameters->setDouble("pageLoad"_s, m_pageLoadTimeout); 135 parameters->setDouble("implicit"_s, m_implicitWaitTimeout); 133 136 completionHandler(CommandResult::success(WTFMove(parameters))); 134 137 } … … 301 304 parameters->setString("handle"_s, m_toplevelBrowsingContext.value()); 302 305 parameters->setString("url"_s, url); 303 parameters->set Integer("pageLoadTimeout"_s, m_pageLoadTimeout.millisecondsAs<int>());306 parameters->setDouble("pageLoadTimeout"_s, m_pageLoadTimeout); 304 307 if (auto pageLoadStrategy = pageLoadStrategyString()) 305 308 parameters->setString("pageLoadStrategy"_s, pageLoadStrategy.value()); … … 364 367 RefPtr<JSON::Object> parameters = JSON::Object::create(); 365 368 parameters->setString("handle"_s, m_toplevelBrowsingContext.value()); 366 parameters->set Integer("pageLoadTimeout"_s, m_pageLoadTimeout.millisecondsAs<int>());369 parameters->setDouble("pageLoadTimeout"_s, m_pageLoadTimeout); 367 370 if (auto pageLoadStrategy = pageLoadStrategyString()) 368 371 parameters->setString("pageLoadStrategy"_s, pageLoadStrategy.value()); … … 392 395 RefPtr<JSON::Object> parameters = JSON::Object::create(); 393 396 parameters->setString("handle"_s, m_toplevelBrowsingContext.value()); 394 parameters->set Integer("pageLoadTimeout"_s, m_pageLoadTimeout.millisecondsAs<int>());397 parameters->setDouble("pageLoadTimeout"_s, m_pageLoadTimeout); 395 398 if (auto pageLoadStrategy = pageLoadStrategyString()) 396 399 parameters->setString("pageLoadStrategy"_s, pageLoadStrategy.value()); … … 420 423 RefPtr<JSON::Object> parameters = JSON::Object::create(); 421 424 parameters->setString("handle"_s, m_toplevelBrowsingContext.value()); 422 parameters->set Integer("pageLoadTimeout"_s, m_pageLoadTimeout.millisecondsAs<int>());425 parameters->setDouble("pageLoadTimeout"_s, m_pageLoadTimeout); 423 426 if (auto pageLoadStrategy = pageLoadStrategyString()) 424 427 parameters->setString("pageLoadStrategy"_s, pageLoadStrategy.value()); … … 1028 1031 arguments->pushString(JSON::Value::create(selector)->toJSONString()); 1029 1032 arguments->pushString(JSON::Value::create(mode == FindElementsMode::Single)->toJSONString()); 1030 arguments->pushString(JSON::Value::create(m_implicitWaitTimeout .milliseconds())->toJSONString());1033 arguments->pushString(JSON::Value::create(m_implicitWaitTimeout)->toJSONString()); 1031 1034 1032 1035 RefPtr<JSON::Object> parameters = JSON::Object::create(); … … 1039 1042 // If there's an implicit wait, use one second more as callback timeout. 1040 1043 if (m_implicitWaitTimeout) 1041 parameters->set Integer("callbackTimeout"_s, Seconds(m_implicitWaitTimeout + 1_s).millisecondsAs<int>());1044 parameters->setDouble("callbackTimeout"_s, m_implicitWaitTimeout + 1000); 1042 1045 1043 1046 m_host->sendCommandToBackend("evaluateJavaScriptFunction"_s, WTFMove(parameters), [this, protectedThis = protectedThis.copyRef(), mode, completionHandler = WTFMove(completionHandler)](SessionHost::CommandResponse&& response) { … … 1506 1509 if (m_currentBrowsingContext) 1507 1510 parameters->setString("frameHandle"_s, m_currentBrowsingContext.value()); 1508 parameters->set Integer("pageLoadTimeout"_s, m_pageLoadTimeout.millisecondsAs<int>());1511 parameters->setDouble("pageLoadTimeout"_s, m_pageLoadTimeout); 1509 1512 if (auto pageLoadStrategy = pageLoadStrategyString()) 1510 1513 parameters->setString("pageLoadStrategy"_s, pageLoadStrategy.value()); … … 2135 2138 if (mode == ExecuteScriptMode::Async) { 2136 2139 parameters->setBoolean("expectsImplicitCallbackArgument"_s, true); 2137 if (m_scriptTimeout )2138 parameters->set Integer("callbackTimeout"_s, m_scriptTimeout.millisecondsAs<int>());2140 if (m_scriptTimeout != std::numeric_limits<double>::infinity()) 2141 parameters->setDouble("callbackTimeout"_s, m_scriptTimeout); 2139 2142 } 2140 2143 m_host->sendCommandToBackend("evaluateJavaScriptFunction"_s, WTFMove(parameters), [this, protectedThis = protectedThis.copyRef(), completionHandler = WTFMove(completionHandler)](SessionHost::CommandResponse&& response) mutable { -
trunk/Source/WebDriver/Session.h
r253030 r253883 51 51 const Capabilities& capabilities() const; 52 52 bool isConnected() const; 53 SecondsscriptTimeout() const { return m_scriptTimeout; }54 SecondspageLoadTimeout() const { return m_pageLoadTimeout; }55 SecondsimplicitWaitTimeout() const { return m_implicitWaitTimeout; }53 double scriptTimeout() const { return m_scriptTimeout; } 54 double pageLoadTimeout() const { return m_pageLoadTimeout; } 55 double implicitWaitTimeout() const { return m_implicitWaitTimeout; } 56 56 static const String& webElementIdentifier(); 57 57 … … 208 208 209 209 std::unique_ptr<SessionHost> m_host; 210 Secondsm_scriptTimeout;211 Secondsm_pageLoadTimeout;212 Secondsm_implicitWaitTimeout;210 double m_scriptTimeout; 211 double m_pageLoadTimeout; 212 double m_implicitWaitTimeout; 213 213 Optional<String> m_toplevelBrowsingContext; 214 214 Optional<String> m_currentBrowsingContext; -
trunk/Source/WebDriver/WebDriverService.cpp
r253030 r253883 321 321 } 322 322 323 static Optional<Timeouts> deserializeTimeouts(JSON::Object& timeoutsObject) 323 enum class IgnoreUnknownTimeout { No, Yes }; 324 325 static Optional<Timeouts> deserializeTimeouts(JSON::Object& timeoutsObject, IgnoreUnknownTimeout ignoreUnknownTimeout) 324 326 { 325 327 // §8.5 Set Timeouts. … … 331 333 continue; 332 334 335 if (it->key == "script" && it->value->isNull()) { 336 timeouts.script = std::numeric_limits<double>::infinity(); 337 continue; 338 } 339 333 340 // 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. 334 341 auto timeoutMS = unsignedValue(*it->value); … … 337 344 338 345 if (it->key == "script") 339 timeouts.script = Seconds::fromMilliseconds(timeoutMS.value());346 timeouts.script = timeoutMS.value(); 340 347 else if (it->key == "pageLoad") 341 timeouts.pageLoad = Seconds::fromMilliseconds(timeoutMS.value());348 timeouts.pageLoad = timeoutMS.value(); 342 349 else if (it->key == "implicit") 343 timeouts.implicit = Seconds::fromMilliseconds(timeoutMS.value());344 else 350 timeouts.implicit = timeoutMS.value(); 351 else if (ignoreUnknownTimeout == IgnoreUnknownTimeout::No) 345 352 return WTF::nullopt; 346 353 } … … 488 495 RefPtr<JSON::Object> timeouts; 489 496 if (matchedCapabilities.getObject("timeouts"_s, timeouts)) 490 capabilities.timeouts = deserializeTimeouts(*timeouts );497 capabilities.timeouts = deserializeTimeouts(*timeouts, IgnoreUnknownTimeout::No); 491 498 String pageLoadStrategy; 492 499 if (matchedCapabilities.getString("pageLoadStrategy"_s, pageLoadStrategy)) … … 550 557 } else if (it->key == "timeouts") { 551 558 RefPtr<JSON::Object> timeouts; 552 if (!it->value->asObject(timeouts) || !deserializeTimeouts(*timeouts ))559 if (!it->value->asObject(timeouts) || !deserializeTimeouts(*timeouts, IgnoreUnknownTimeout::No)) 553 560 return nullptr; 554 561 result->setValue(it->key, RefPtr<JSON::Value>(it->value)); … … 844 851 capabilitiesObject->setObject("proxy"_s, JSON::Object::create()); 845 852 RefPtr<JSON::Object> timeoutsObject = JSON::Object::create(); 846 timeoutsObject->setInteger("script"_s, m_session->scriptTimeout().millisecondsAs<int>()); 847 timeoutsObject->setInteger("pageLoad"_s, m_session->pageLoadTimeout().millisecondsAs<int>()); 848 timeoutsObject->setInteger("implicit"_s, m_session->implicitWaitTimeout().millisecondsAs<int>()); 853 if (m_session->scriptTimeout() == std::numeric_limits<double>::infinity()) 854 timeoutsObject->setValue("script"_s, JSON::Value::null()); 855 else 856 timeoutsObject->setDouble("script"_s, m_session->scriptTimeout()); 857 timeoutsObject->setDouble("pageLoad"_s, m_session->pageLoadTimeout()); 858 timeoutsObject->setDouble("implicit"_s, m_session->implicitWaitTimeout()); 849 859 capabilitiesObject->setObject("timeouts"_s, WTFMove(timeoutsObject)); 850 860 … … 907 917 return; 908 918 909 auto timeouts = deserializeTimeouts(*parameters );919 auto timeouts = deserializeTimeouts(*parameters, IgnoreUnknownTimeout::Yes); 910 920 if (!timeouts) { 911 921 completionHandler(CommandResult::fail(CommandResult::ErrorCode::InvalidArgument)); -
trunk/Source/WebKit/ChangeLog
r253882 r253883 1 2019-12-23 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 WebDriver: fix handling of session timeouts for values higher than MAX_INT 4 https://bugs.webkit.org/show_bug.cgi?id=204114 5 6 Reviewed by Brian Burg. 7 8 Use number instead of integer for all optional timeout parameters. In the case of script timeout, not passing a 9 value means a timeout should not be used, so use Optional<double> also for the IPC message and handle the 10 optional value in the web process to not set any timeout in that case. 11 12 * UIProcess/Automation/Automation.json: 13 * UIProcess/Automation/WebAutomationSession.cpp: 14 (WebKit::WebAutomationSession::waitForNavigationToComplete): 15 (WebKit::WebAutomationSession::navigateBrowsingContext): 16 (WebKit::WebAutomationSession::goBackInBrowsingContext): 17 (WebKit::WebAutomationSession::goForwardInBrowsingContext): 18 (WebKit::WebAutomationSession::reloadBrowsingContext): 19 (WebKit::WebAutomationSession::evaluateJavaScriptFunction): 20 * UIProcess/Automation/WebAutomationSession.h: 21 * WebProcess/Automation/WebAutomationSessionProxy.cpp: 22 (WebKit::WebAutomationSessionProxy::evaluateJavaScriptFunction): 23 * WebProcess/Automation/WebAutomationSessionProxy.h: 24 * WebProcess/Automation/WebAutomationSessionProxy.js: 25 (let.AutomationSessionProxy.prototype.evaluateJavaScriptFunction): 26 * WebProcess/Automation/WebAutomationSessionProxy.messages.in: 27 1 28 2019-12-23 Carlos Garcia Campos <cgarcia@igalia.com> 2 29 -
trunk/Source/WebKit/UIProcess/Automation/Automation.json
r253030 r253883 389 389 { "name": "url", "type": "string", "description": "The URL to load in the browsing context." }, 390 390 { "name": "pageLoadStrategy", "$ref": "PageLoadStrategy", "optional": true, "description": "The page load strategy to use when determining when navigation is complete." }, 391 { "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." }391 { "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." } 392 392 ], 393 393 "async": true … … 399 399 { "name": "handle", "$ref": "BrowsingContextHandle", "description": "The handle for the browsing context that should be navigated." }, 400 400 { "name": "pageLoadStrategy", "$ref": "PageLoadStrategy", "optional": true, "description": "The page load strategy to use when determining when navigation is complete." }, 401 { "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." }401 { "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." } 402 402 ], 403 403 "async": true … … 409 409 { "name": "handle", "$ref": "BrowsingContextHandle", "description": "The handle for the browsing context that should be navigated." }, 410 410 { "name": "pageLoadStrategy", "$ref": "PageLoadStrategy", "optional": true, "description": "The page load strategy to use when determining when navigation is complete." }, 411 { "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." }411 { "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." } 412 412 ], 413 413 "async": true … … 419 419 { "name": "handle", "$ref": "BrowsingContextHandle", "description": "The handle for the browsing context that should be reloaded." }, 420 420 { "name": "pageLoadStrategy", "$ref": "PageLoadStrategy", "optional": true, "description": "The page load strategy to use when determining when navigation is complete." }, 421 { "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." }421 { "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." } 422 422 ], 423 423 "async": true … … 430 430 { "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." }, 431 431 { "name": "pageLoadStrategy", "$ref": "PageLoadStrategy", "optional": true, "description": "The page load strategy to use when determining when navigation is complete." }, 432 { "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." }432 { "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." } 433 433 ], 434 434 "async": true … … 453 453 { "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." }, 454 454 { "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." }, 455 { "name": "callbackTimeout", "type": " integer", "optional": true, "description": "The timeout in milliseconds that the implicit callback is expected to be called in, otherwise a <code>JavaScriptTimeout</code> error is returned." }455 { "name": "callbackTimeout", "type": "number", "optional": true, "description": "The timeout in milliseconds that the implicit callback is expected to be called in, otherwise a <code>JavaScriptTimeout</code> error is returned." } 456 456 ], 457 457 "returns": [ -
trunk/Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp
r253346 r253883 443 443 } 444 444 445 void WebAutomationSession::waitForNavigationToComplete(const String& browsingContextHandle, const String* optionalFrameHandle, const String* optionalPageLoadStrategyString, const int* optionalPageLoadTimeout, Ref<WaitForNavigationToCompleteCallback>&& callback)445 void WebAutomationSession::waitForNavigationToComplete(const String& browsingContextHandle, const String* optionalFrameHandle, const String* optionalPageLoadStrategyString, const double* optionalPageLoadTimeout, Ref<WaitForNavigationToCompleteCallback>&& callback) 446 446 { 447 447 WebPageProxy* page = webPageProxyForHandle(browsingContextHandle); … … 697 697 } 698 698 699 void WebAutomationSession::navigateBrowsingContext(const String& handle, const String& url, const String* optionalPageLoadStrategyString, const int* optionalPageLoadTimeout, Ref<NavigateBrowsingContextCallback>&& callback)699 void WebAutomationSession::navigateBrowsingContext(const String& handle, const String& url, const String* optionalPageLoadStrategyString, const double* optionalPageLoadTimeout, Ref<NavigateBrowsingContextCallback>&& callback) 700 700 { 701 701 WebPageProxy* page = webPageProxyForHandle(handle); … … 712 712 } 713 713 714 void WebAutomationSession::goBackInBrowsingContext(const String& handle, const String* optionalPageLoadStrategyString, const int* optionalPageLoadTimeout, Ref<GoBackInBrowsingContextCallback>&& callback)714 void WebAutomationSession::goBackInBrowsingContext(const String& handle, const String* optionalPageLoadStrategyString, const double* optionalPageLoadTimeout, Ref<GoBackInBrowsingContextCallback>&& callback) 715 715 { 716 716 WebPageProxy* page = webPageProxyForHandle(handle); … … 727 727 } 728 728 729 void WebAutomationSession::goForwardInBrowsingContext(const String& handle, const String* optionalPageLoadStrategyString, const int* optionalPageLoadTimeout, Ref<GoForwardInBrowsingContextCallback>&& callback)729 void WebAutomationSession::goForwardInBrowsingContext(const String& handle, const String* optionalPageLoadStrategyString, const double* optionalPageLoadTimeout, Ref<GoForwardInBrowsingContextCallback>&& callback) 730 730 { 731 731 WebPageProxy* page = webPageProxyForHandle(handle); … … 742 742 } 743 743 744 void WebAutomationSession::reloadBrowsingContext(const String& handle, const String* optionalPageLoadStrategyString, const int* optionalPageLoadTimeout, Ref<ReloadBrowsingContextCallback>&& callback)744 void WebAutomationSession::reloadBrowsingContext(const String& handle, const String* optionalPageLoadStrategyString, const double* optionalPageLoadTimeout, Ref<ReloadBrowsingContextCallback>&& callback) 745 745 { 746 746 WebPageProxy* page = webPageProxyForHandle(handle); … … 923 923 } 924 924 925 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)925 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) 926 926 { 927 927 WebPageProxy* page = webPageProxyForHandle(browsingContextHandle); … … 944 944 945 945 bool expectsImplicitCallbackArgument = optionalExpectsImplicitCallbackArgument ? *optionalExpectsImplicitCallbackArgument : false; 946 int callbackTimeout = optionalCallbackTimeout ? *optionalCallbackTimeout : 0; 946 Optional<double> callbackTimeout; 947 if (optionalCallbackTimeout) 948 callbackTimeout = *optionalCallbackTimeout; 947 949 948 950 uint64_t callbackID = m_nextEvaluateJavaScriptCallbackID++; -
trunk/Source/WebKit/UIProcess/Automation/WebAutomationSession.h
r253030 r253883 171 171 void maximizeWindowOfBrowsingContext(const String& handle, Ref<MaximizeWindowOfBrowsingContextCallback>&&) final; 172 172 void hideWindowOfBrowsingContext(const String& handle, Ref<HideWindowOfBrowsingContextCallback>&&) final; 173 void navigateBrowsingContext(const String& handle, const String& url, const String* optionalPageLoadStrategyString, const int* optionalPageLoadTimeout, Ref<NavigateBrowsingContextCallback>&&) override;174 void goBackInBrowsingContext(const String&, const String* optionalPageLoadStrategyString, const int* optionalPageLoadTimeout, Ref<GoBackInBrowsingContextCallback>&&) override;175 void goForwardInBrowsingContext(const String&, const String* optionalPageLoadStrategyString, const int* optionalPageLoadTimeout, Ref<GoForwardInBrowsingContextCallback>&&) override;176 void reloadBrowsingContext(const String&, const String* optionalPageLoadStrategyString, const int* optionalPageLoadTimeout, Ref<ReloadBrowsingContextCallback>&&) override;177 void waitForNavigationToComplete(const String& browsingContextHandle, const String* optionalFrameHandle, const String* optionalPageLoadStrategyString, const int* optionalPageLoadTimeout, Ref<WaitForNavigationToCompleteCallback>&&) override;178 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;173 void navigateBrowsingContext(const String& handle, const String& url, const String* optionalPageLoadStrategyString, const double* optionalPageLoadTimeout, Ref<NavigateBrowsingContextCallback>&&) override; 174 void goBackInBrowsingContext(const String&, const String* optionalPageLoadStrategyString, const double* optionalPageLoadTimeout, Ref<GoBackInBrowsingContextCallback>&&) override; 175 void goForwardInBrowsingContext(const String&, const String* optionalPageLoadStrategyString, const double* optionalPageLoadTimeout, Ref<GoForwardInBrowsingContextCallback>&&) override; 176 void reloadBrowsingContext(const String&, const String* optionalPageLoadStrategyString, const double* optionalPageLoadTimeout, Ref<ReloadBrowsingContextCallback>&&) override; 177 void waitForNavigationToComplete(const String& browsingContextHandle, const String* optionalFrameHandle, const String* optionalPageLoadStrategyString, const double* optionalPageLoadTimeout, Ref<WaitForNavigationToCompleteCallback>&&) override; 178 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; 179 179 void performMouseInteraction(const String& handle, const JSON::Object& requestedPosition, const String& mouseButton, const String& mouseInteraction, const JSON::Array& keyModifiers, Ref<PerformMouseInteractionCallback>&&) final; 180 180 void performKeyboardInteractions(const String& handle, const JSON::Array& interactions, Ref<PerformKeyboardInteractionsCallback>&&) override; -
trunk/Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.cpp
r253538 r253883 236 236 } 237 237 238 void WebAutomationSessionProxy::evaluateJavaScriptFunction(WebCore::PageIdentifier pageID, Optional<WebCore::FrameIdentifier> optionalFrameID, const String& function, Vector<String> arguments, bool expectsImplicitCallbackArgument, intcallbackTimeout, uint64_t callbackID)238 void WebAutomationSessionProxy::evaluateJavaScriptFunction(WebCore::PageIdentifier pageID, Optional<WebCore::FrameIdentifier> optionalFrameID, const String& function, Vector<String> arguments, bool expectsImplicitCallbackArgument, Optional<double> callbackTimeout, uint64_t callbackID) 239 239 { 240 240 WebPage* page = WebProcess::singleton().webPage(pageID); … … 270 270 JSValueMakeNumber(context, callbackID), 271 271 JSObjectMakeFunctionWithCallback(context, nullptr, evaluateJavaScriptCallback), 272 JSValueMakeNumber(context, callbackTimeout )272 JSValueMakeNumber(context, callbackTimeout.valueOr(-1)) 273 273 }; 274 274 -
trunk/Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.h
r253030 r253883 64 64 65 65 // Called by WebAutomationSessionProxy messages 66 void evaluateJavaScriptFunction(WebCore::PageIdentifier, Optional<WebCore::FrameIdentifier>, const String& function, Vector<String> arguments, bool expectsImplicitCallbackArgument, intcallbackTimeout, uint64_t callbackID);66 void evaluateJavaScriptFunction(WebCore::PageIdentifier, Optional<WebCore::FrameIdentifier>, const String& function, Vector<String> arguments, bool expectsImplicitCallbackArgument, Optional<double> callbackTimeout, uint64_t callbackID); 67 67 void resolveChildFrameWithOrdinal(WebCore::PageIdentifier, Optional<WebCore::FrameIdentifier>, uint32_t ordinal, CompletionHandler<void(Optional<String>, Optional<WebCore::FrameIdentifier>)>&&); 68 68 void resolveChildFrameWithNodeHandle(WebCore::PageIdentifier, Optional<WebCore::FrameIdentifier>, const String& nodeHandle, CompletionHandler<void(Optional<String>, Optional<WebCore::FrameIdentifier>)>&&); -
trunk/Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.js
r229210 r253883 65 65 argumentValues.push(reportResult); 66 66 functionValue.apply(null, argumentValues); 67 if (!resultReported )67 if (!resultReported && callbackTimeout >= 0) 68 68 timeoutIdentifier = setTimeout(reportTimeoutError, callbackTimeout); 69 69 } else -
trunk/Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.messages.in
r253030 r253883 22 22 23 23 messages -> WebAutomationSessionProxy NotRefCounted { 24 EvaluateJavaScriptFunction(WebCore::PageIdentifier pageID, Optional<WebCore::FrameIdentifier> frameID, String function, Vector<String> arguments, bool expectsImplicitCallbackArgument, intcallbackTimeout, uint64_t callbackID)24 EvaluateJavaScriptFunction(WebCore::PageIdentifier pageID, Optional<WebCore::FrameIdentifier> frameID, String function, Vector<String> arguments, bool expectsImplicitCallbackArgument, Optional<double> callbackTimeout, uint64_t callbackID) 25 25 26 26 ResolveChildFrameWithOrdinal(WebCore::PageIdentifier pageID, Optional<WebCore::FrameIdentifier> frameID, uint32_t ordinal) -> (Optional<String> errorType, Optional<WebCore::FrameIdentifier> frameID) Async
Note: See TracChangeset
for help on using the changeset viewer.