puppeteer/docs
Andrey Lushnikov 5c92ba222a fix(page.evaluate): jsonValue should ignore toJSON property (#1098)
Currently, JSHandle.jsonValue() is implemented as in-page JSON.stringify
call and consequent JSON.parse in node. This approach proved to be
unfortunate for automation purposes: if page author overrode the
Object.prototype.toJSON method, then it's harder for puppeteer to
interact with the page.

This patch switches JSHandle.jsonValue to use protocol serialization
that ignores toJSON property. THis also changes the `page.evaluate`
behavior since it is based on JSHandle.jsonValue().

Fixes #1003.

BREAKING CHANGE:
`page.evaluate` no longer calls toJSON when generating return value.
For the old behavior, do JSON.parse/JSON.stringify manually:

```js
const json = JSON.parse(await page.evaluate(() => JSON.stringify(obj)));
```
2017-10-20 10:45:49 -07:00
..
api.md fix(page.evaluate): jsonValue should ignore toJSON property (#1098) 2017-10-20 10:45:49 -07:00
issue_template.md Better issue template (#712) 2017-09-07 12:34:52 -07:00
troubleshooting.md Remove --no-sandbox from Docker example (#838) 2017-09-21 09:18:35 -07:00