Title: [227773] trunk/Source
- Revision
- 227773
- Author
- carlo...@webkit.org
- Date
- 2018-01-29 22:32:38 -0800 (Mon, 29 Jan 2018)
Log Message
WebDriver: evaluateJavaScriptFunction should return null when return value is undefined
https://bugs.webkit.org/show_bug.cgi?id=180350
Reviewed by Carlos Alberto Lopez Perez.
Source/WebDriver:
Stop handling the empty string as a special case of evaluateJavaScriptFunction result.
* Session.cpp:
(WebDriver::Session::executeScript):
Source/WebKit:
undefined can't be converted to JSON string, in which case JSON.stringify() returns undefined and we handle that
case to return an empty string. We currently handle this case for execute script commands, but not in all other
cases where we use evaluateJavaScriptFunction. It would be simpler if evaluateJavaScriptFunction returned null,
because in that case we wouldn't need to handle it as a special case.
15.2 Executing Script
https://w3c.github.io/webdriver/webdriver-spec.html#dfn-json-clone
Fixes: imported/w3c/webdriver/tests/state/get_element_property.py::test_element_non_existent
* WebProcess/Automation/WebAutomationSessionProxy.js:
(let.AutomationSessionProxy.prototype._jsonStringify): Return "null" instead of "" when undefined is given.
Modified Paths
Diff
Modified: trunk/Source/WebDriver/ChangeLog (227772 => 227773)
--- trunk/Source/WebDriver/ChangeLog 2018-01-30 05:56:36 UTC (rev 227772)
+++ trunk/Source/WebDriver/ChangeLog 2018-01-30 06:32:38 UTC (rev 227773)
@@ -1,3 +1,15 @@
+2018-01-29 Carlos Garcia Campos <cgar...@igalia.com>
+
+ WebDriver: evaluateJavaScriptFunction should return null when return value is undefined
+ https://bugs.webkit.org/show_bug.cgi?id=180350
+
+ Reviewed by Carlos Alberto Lopez Perez.
+
+ Stop handling the empty string as a special case of evaluateJavaScriptFunction result.
+
+ * Session.cpp:
+ (WebDriver::Session::executeScript):
+
2018-01-26 Carlos Garcia Campos <cgar...@igalia.com>
WebDriver: service hangs after a browser crash
Modified: trunk/Source/WebDriver/Session.cpp (227772 => 227773)
--- trunk/Source/WebDriver/Session.cpp 2018-01-30 05:56:36 UTC (rev 227772)
+++ trunk/Source/WebDriver/Session.cpp 2018-01-30 06:32:38 UTC (rev 227773)
@@ -1800,10 +1800,6 @@
completionHandler(CommandResult::fail(CommandResult::ErrorCode::UnknownError));
return;
}
- if (valueString.isEmpty()) {
- completionHandler(CommandResult::success());
- return;
- }
RefPtr<JSON::Value> resultValue;
if (!JSON::Value::parseJSON(valueString, resultValue)) {
completionHandler(CommandResult::fail(CommandResult::ErrorCode::UnknownError));
Modified: trunk/Source/WebKit/ChangeLog (227772 => 227773)
--- trunk/Source/WebKit/ChangeLog 2018-01-30 05:56:36 UTC (rev 227772)
+++ trunk/Source/WebKit/ChangeLog 2018-01-30 06:32:38 UTC (rev 227773)
@@ -1,3 +1,23 @@
+2018-01-29 Carlos Garcia Campos <cgar...@igalia.com>
+
+ WebDriver: evaluateJavaScriptFunction should return null when return value is undefined
+ https://bugs.webkit.org/show_bug.cgi?id=180350
+
+ Reviewed by Carlos Alberto Lopez Perez.
+
+ undefined can't be converted to JSON string, in which case JSON.stringify() returns undefined and we handle that
+ case to return an empty string. We currently handle this case for execute script commands, but not in all other
+ cases where we use evaluateJavaScriptFunction. It would be simpler if evaluateJavaScriptFunction returned null,
+ because in that case we wouldn't need to handle it as a special case.
+
+ 15.2 Executing Script
+ https://w3c.github.io/webdriver/webdriver-spec.html#dfn-json-clone
+
+ Fixes: imported/w3c/webdriver/tests/state/get_element_property.py::test_element_non_existent
+
+ * WebProcess/Automation/WebAutomationSessionProxy.js:
+ (let.AutomationSessionProxy.prototype._jsonStringify): Return "null" instead of "" when undefined is given.
+
2018-01-29 Ryosuke Niwa <rn...@webkit.org>
Release assert in updateLayout while waiting for sync reply to WebPageProxy::HasInsecureContent
Modified: trunk/Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.js (227772 => 227773)
--- trunk/Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.js 2018-01-30 05:56:36 UTC (rev 227772)
+++ trunk/Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.js 2018-01-30 06:32:38 UTC (rev 227773)
@@ -88,7 +88,7 @@
_jsonStringify(original)
{
- return JSON.stringify(original, (key, value) => this._replaceJSONValue(key, value)) || "";
+ return JSON.stringify(original, (key, value) => this._replaceJSONValue(key, value)) || "null";
}
_reviveJSONValue(key, value)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes