fix(Page): fix Page.evaluate with Symbols in arrays (#2340)
Fixes #2295.
This commit is contained in:
parent
5d106f79d8
commit
c5902de5d8
@ -47,6 +47,8 @@ class ExecutionContext {
|
|||||||
const result = await handle.jsonValue().catch(error => {
|
const result = await handle.jsonValue().catch(error => {
|
||||||
if (error.message.includes('Object reference chain is too long'))
|
if (error.message.includes('Object reference chain is too long'))
|
||||||
return;
|
return;
|
||||||
|
if (error.message.includes('Object couldn\'t be returned by value'))
|
||||||
|
return;
|
||||||
throw error;
|
throw error;
|
||||||
});
|
});
|
||||||
await handle.dispose();
|
await handle.dispose();
|
||||||
|
@ -124,9 +124,9 @@ module.exports.addTests = function({testRunner, expect, puppeteer, DeviceDescrip
|
|||||||
it('should properly serialize null fields', async({page}) => {
|
it('should properly serialize null fields', async({page}) => {
|
||||||
expect(await page.evaluate(() => ({a: undefined}))).toEqual({});
|
expect(await page.evaluate(() => ({a: undefined}))).toEqual({});
|
||||||
});
|
});
|
||||||
it('should fail for window object', async({page, server}) => {
|
it('should return undefined for non-serializable objects', async({page, server}) => {
|
||||||
const result = await page.evaluate(() => window);
|
expect(await page.evaluate(() => window)).toBe(undefined);
|
||||||
expect(result).toBe(undefined);
|
expect(await page.evaluate(() => [Symbol('foo4')])).toBe(undefined);
|
||||||
});
|
});
|
||||||
it('should fail for circular object', async({page, server}) => {
|
it('should fail for circular object', async({page, server}) => {
|
||||||
const result = await page.evaluate(() => {
|
const result = await page.evaluate(() => {
|
||||||
|
Loading…
Reference in New Issue
Block a user