Changeset 267078 in webkit
- Timestamp:
- Sep 14, 2020 11:25:04 PM (4 years ago)
- Location:
- trunk/Source/WebDriver
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebDriver/ChangeLog
r266889 r267078 1 2020-09-14 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 REGRESSION(r266885): WebDriver is broken since r266885 4 https://bugs.webkit.org/show_bug.cgi?id=216477 5 6 Reviewed by Devin Rousso. 7 8 There are several issues introduced in r266885, most of them related to JSValue::get methods now returning an 9 optional. In some cases of boolean values, the optional is checked instead of the contained bool or the logic is 10 inverted. JSONValue::getString() is problematic too because it doesn't use optional, when you call getString() 11 and null is returned it could be because the property is not present in the object or because the property is 12 not a string. In several cases we need to know that so we need to first get the value and then call asString(9 13 instead of calling getString() directly. 14 15 * Session.cpp: 16 (WebDriver::Session::handleUserPrompts): Check the value of isShowingJavaScriptDialog, not the optional. 17 (WebDriver::parseAutomationCookie): Check also the value of the session optional bool, not only the optional. 18 * SessionHost.cpp: 19 (WebDriver::SessionHost::dispatchMessage): Only set the responseObject if the object is not empty. 20 * WebDriverService.cpp: 21 (WebDriver::WebDriverService::newWindow): Unknown values of type hint are not an error. 22 (WebDriver::WebDriverService::deleteCookie): Fix indentation. 23 (WebDriver::processKeyAction): Empty key value is an error, not the opposite. 24 * gtk/WebDriverServiceGtk.cpp: 25 (WebDriver::WebDriverService::platformValidateCapability const): Only fail if optional values are wrong type, 26 not if they are not present. 27 * wpe/WebDriverServiceWPE.cpp: 28 (WebDriver::WebDriverService::platformValidateCapability const): Ditto. 29 1 30 2020-09-10 Fujii Hironori <Hironori.Fujii@sony.com> 2 31 -
trunk/Source/WebDriver/Session.cpp
r266889 r267078 215 215 } 216 216 217 if (!isShowingJavaScriptDialog ) {217 if (!isShowingJavaScriptDialog.value()) { 218 218 completionHandler(CommandResult::success()); 219 219 return; … … 2369 2369 2370 2370 auto session = cookieObject.getBoolean("session"_s); 2371 if (!session ) {2371 if (!session || !*session) { 2372 2372 if (auto expiry = cookieObject.getDouble("expires"_s)) 2373 2373 cookie.expiry = *expiry; -
trunk/Source/WebDriver/SessionHost.cpp
r266885 r267078 82 82 response.responseObject = WTFMove(errorObject); 83 83 response.isError = true; 84 } else if (auto resultObject = messageObject->getObject("result"_s)) 85 response.responseObject = WTFMove(resultObject); 84 } else if (auto resultObject = messageObject->getObject("result"_s)) { 85 if (resultObject->size()) 86 response.responseObject = WTFMove(resultObject); 87 } 86 88 87 89 responseHandler(WTFMove(response)); -
trunk/Source/WebDriver/WebDriverService.cpp
r266885 r267078 1182 1182 if (auto value = parameters->getValue("type"_s)) { 1183 1183 auto valueString = value->asString(); 1184 if (valueString == "window" || valueString == "tab") 1185 typeHint = valueString; 1186 else if (!value->isNull()) { 1184 if (!!valueString) { 1185 if (valueString == "window" || valueString == "tab") 1186 typeHint = valueString; 1187 } else if (!value->isNull()) { 1187 1188 completionHandler(CommandResult::fail(CommandResult::ErrorCode::InvalidArgument)); 1188 1189 return; … … 1762 1763 return; 1763 1764 1764 auto name = parameters->getString("name"_s);1765 auto name = parameters->getString("name"_s); 1765 1766 if (!name) { 1766 1767 completionHandler(CommandResult::fail(CommandResult::ErrorCode::InvalidArgument)); … … 1854 1855 } 1855 1856 auto key = keyValue->asString(); 1856 if ( !key.isEmpty()) {1857 if (key.isEmpty()) { 1857 1858 errorMessage = String("The paramater 'value' is invalid for key up/down action"); 1858 1859 return WTF::nullopt; -
trunk/Source/WebDriver/gtk/WebDriverServiceGtk.cpp
r266885 r267078 53 53 return true; 54 54 55 auto binary = browserOptions->getString("binary"_s); 56 if (!binary) 57 return false; 55 if (auto binaryValue = browserOptions->getValue("binary"_s)) { 56 if (!binaryValue->asString()) 57 return false; 58 } 58 59 59 auto useOverlayScrollbars = browserOptions->getBoolean("useOverlayScrollbars"_s); 60 if (!useOverlayScrollbars) 61 return false; 60 if (auto useOverlayScrollbarsValue = browserOptions->getValue("useOverlayScrollbars"_s)) { 61 if (!useOverlayScrollbarsValue->asBoolean()) 62 return false; 63 } 62 64 63 if (auto browserArguments = browserOptions->getArray("args"_s)) { 65 if (auto browserArgumentsValue = browserOptions->getValue("args"_s)) { 66 auto browserArguments = browserArgumentsValue->asArray(); 67 if (!browserArguments) 68 return false; 69 64 70 unsigned browserArgumentsLength = browserArguments->length(); 65 71 for (unsigned i = 0; i < browserArgumentsLength; ++i) { … … 70 76 } 71 77 72 if (auto certificates = browserOptions->getArray("certificates"_s)) { 78 if (auto certificatesValue = browserOptions->getValue("certificates"_s)) { 79 auto certificates = certificatesValue->asArray(); 80 if (!certificates) 81 return false; 82 73 83 unsigned certificatesLength = certificates->length(); 74 84 for (unsigned i = 0; i < certificatesLength; ++i) { -
trunk/Source/WebDriver/wpe/WebDriverServiceWPE.cpp
r266885 r267078 58 58 return false; 59 59 60 auto browserArguments = browserOptions->getArray("args"_s); 61 if (!browserArguments) 62 return false; 60 if (auto browserArgumentsValue = browserOptions->getValue("args"_s)) { 61 auto browserArguments = browserArgumentsValue->asArray(); 62 if (!browserArguments) 63 return false; 63 64 64 unsigned browserArgumentsLength = browserArguments->length(); 65 for (unsigned i = 0; i < browserArgumentsLength; ++i) { 66 auto argument = browserArguments->get(i)->asString(); 67 if (!argument) 68 return false; 65 unsigned browserArgumentsLength = browserArguments->length(); 66 for (unsigned i = 0; i < browserArgumentsLength; ++i) { 67 auto argument = browserArguments->get(i)->asString(); 68 if (!argument) 69 return false; 70 } 69 71 } 70 72 71 if (auto certificates = browserOptions->getArray("certificates"_s)) { 73 if (auto certificatesValue = browserOptions->getValue("certificates"_s)) { 74 auto certificates = certificatesValue->asArray(); 75 if (!certificates) 76 return false; 77 72 78 unsigned certificatesLength = certificates->length(); 73 79 for (unsigned i = 0; i < certificatesLength; ++i) {
Note: See TracChangeset
for help on using the changeset viewer.