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))); ``` |
||
---|---|---|
.. | ||
.eslintrc.js | ||
Browser.js | ||
Connection.js | ||
Dialog.js | ||
ElementHandle.js | ||
EmulationManager.js | ||
ExecutionContext.js | ||
externs.d.ts | ||
FrameManager.js | ||
helper.js | ||
Input.js | ||
Launcher.js | ||
Multimap.js | ||
NavigatorWatcher.js | ||
NetworkManager.js | ||
Page.js | ||
Puppeteer.js | ||
Tracing.js |