RESOLVED FIXED180350
WebDriver: evaluateJavaScriptFunction should return null when return value is undefined
https://bugs.webkit.org/show_bug.cgi?id=180350
Summary WebDriver: evaluateJavaScriptFunction should return null when return value is...
Carlos Garcia Campos
Reported 2017-12-04 04:21:12 PST
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
Attachments
Patch (3.49 KB, patch)
2017-12-04 04:27 PST, Carlos Garcia Campos
clopez: review+
Carlos Garcia Campos
Comment 1 2017-12-04 04:27:50 PST
Carlos Garcia Campos
Comment 2 2018-01-16 22:41:00 PST
Brian, could you check if this affects safari driver? Maybe you need to adapt the driver implementation, like I did.
Blaze Burg
Comment 3 2018-01-29 15:40:02 PST
Comment on attachment 328341 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=328341&action=review This does not seem to regress any safaridriver tests, feel free to land as you please. > Source/WebDriver/ChangeLog:8 > + Stop handling the empty string a as a special case of evaluateJavaScriptFunction result. Nit: 'a as a'
Carlos Garcia Campos
Comment 4 2018-01-29 22:31:40 PST
(In reply to Brian Burg from comment #3) > Comment on attachment 328341 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=328341&action=review > > This does not seem to regress any safaridriver tests, feel free to land as > you please. Cool, thanks! > > Source/WebDriver/ChangeLog:8 > > + Stop handling the empty string a as a special case of evaluateJavaScriptFunction result. > > Nit: 'a as a'
Carlos Garcia Campos
Comment 5 2018-01-29 22:32:46 PST
Radar WebKit Bug Importer
Comment 6 2018-01-29 22:33:42 PST
Note You need to log in before you can comment on or make changes to this bug.