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
Created attachment 328341 [details] Patch
Brian, could you check if this affects safari driver? Maybe you need to adapt the driver implementation, like I did.
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'
(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'
Committed r227773: <https://trac.webkit.org/changeset/227773>
<rdar://problem/37016996>