puppeteer/lib
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
..
.eslintrc.js Introduce Eslint to validate style 2017-06-11 01:32:59 -07:00
Browser.js feat(Browser): introduce Browser.pages() (#554) 2017-10-17 19:14:57 -07:00
Connection.js fix(page): page.close() assert that connection is not closed (#1038) 2017-10-17 19:24:34 -07:00
Dialog.js chore: Use Typescript to lint JSDoc annotations (#986) 2017-10-09 22:31:40 -07:00
ElementHandle.js fix(ElementHandle.boundingBox): account for margin, padding, and border in element.boxModel (#1017) 2017-10-12 17:53:59 -07:00
EmulationManager.js chore: Use Typescript to lint JSDoc annotations (#986) 2017-10-09 22:31:40 -07:00
ExecutionContext.js fix(page.evaluate): jsonValue should ignore toJSON property (#1098) 2017-10-20 10:45:49 -07:00
externs.d.ts chore: Use Typescript to lint JSDoc annotations (#986) 2017-10-09 22:31:40 -07:00
FrameManager.js feat(Browser): introduce Browser.pages() (#554) 2017-10-17 19:14:57 -07:00
helper.js fix: Remove synchronous operation with file system. (#879) 2017-10-11 00:55:48 -07:00
Input.js feat(keyboard): make keyboard.down generate input event by default (#1016) 2017-10-13 15:22:55 -07:00
Launcher.js feat(Browser): introduce Browser.pages() (#554) 2017-10-17 19:14:57 -07:00
Multimap.js chore: Use Typescript to lint JSDoc annotations (#986) 2017-10-09 22:31:40 -07:00
NavigatorWatcher.js chore: Use Typescript to lint JSDoc annotations (#986) 2017-10-09 22:31:40 -07:00
NetworkManager.js feat(Request): allow aborting intercepted requests with custom reasons (#1080) 2017-10-18 00:26:48 -07:00
Page.js feat(Browser): introduce Browser.pages() (#554) 2017-10-17 19:14:57 -07:00
Puppeteer.js chore: Use Typescript to lint JSDoc annotations (#986) 2017-10-09 22:31:40 -07:00
Tracing.js fix: Remove synchronous operation with file system. (#879) 2017-10-11 00:55:48 -07:00