mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
5c92ba222a
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))); ``` |
||
---|---|---|
.. | ||
assets | ||
golden | ||
server | ||
diffstyle.css | ||
frame-utils.js | ||
golden-utils.js | ||
test.js |