You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been playing and experimenting with Scala.js and wanted to check out the new Puppeteer API from the chrome guys to automate Chromium. Most of it works as expected, but when I try and call the evaluate function (https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args). I've tried different approaches of providing the js.Function, but all result in the same error.
@sjrd already mentioned in gitter that it is probably because of some serialization magic in puppeteer.
@josdirksen So ... from https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#
pageevaluatepagefunction-args it seems that it indeed does some serialization magic. I'm afraid
that won't be supported by Scala.js as such, because it means puppeteer peeks into the
compiler's internal encoding, which a reasonable library should never do.
If this is really something out of the scope of scala.js feel free to immediately close this :)
The text was updated successfully, but these errors were encountered:
I did some digging, and it is indeed what I was afraid of. After some indirections, evaluate ends up calling evaluationString(fun, ...). That function basically calls fun.toString(), which for a function returns the raw JS source code of the function. It then, I guess, sends that string over the wire and tries to execute it in a completely different environment, where it has lost its lexical scope.
I'm afraid puppeteer is doing something evil here, that cannot be supported by Scala.js. So I'll close this as a won't fix.
I've been playing and experimenting with Scala.js and wanted to check out the new Puppeteer API from the chrome guys to automate Chromium. Most of it works as expected, but when I try and call the
evaluate
function (https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args). I've tried different approaches of providing the js.Function, but all result in the same error.The code for this example can be found in: https://github.com/josdirksen/scalajs-puppeteer
@sjrd already mentioned in gitter that it is probably because of some serialization magic in puppeteer.
If this is really something out of the scope of scala.js feel free to immediately close this :)
The text was updated successfully, but these errors were encountered: