aivaturi/Selenium-Remote-Driver — pull request #81 by gempesaw (2013-09-19 04:36:14+00:00)
Title: Async script callback docs are inaccurate

`execute_async_script` doesn't ever call this Perl callback. Even
though it's passed in as the last argument to our
execute_async_script, the Perl callback isn't actually the last argument in the
context of the executed javascript. The callback that gets executed in
the async script is generated by Selenium and appended to the argument
list. So, previously the argument list in the context of the executed javascript
in the browser looked something like:

["myid", "return arguments[0];", $automatic_callback]

But, the example in the docs happened to work as written because the
automatic Javascript callback just returns its argument, and that
happens to be the same thing that the Perl callback was trying to do.

The chromium implementation of [execute_async_script.js][1] can
probably explain it better than I can.

[1]: https://code.google.com/p/chromium/codesearch#chromium/src/chrome/test/chromedriver/js/execute_async_script.js&q=reportValue&sq=package:chromium&l=65