Skip to content

Commit 4b761f4

Browse files
authored
test: expect current behavior for cross-frame js handles (#833)
1 parent 6dc88bc commit 4b761f4

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

test/evaluation.spec.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -352,9 +352,10 @@ module.exports.describe = function({testRunner, expect, FFOX, CHROMIUM, WEBKIT})
352352
await page.goto(server.CROSS_PROCESS_PREFIX + '/empty.html');
353353
expect(await mainFrame.evaluate(() => window.location.href)).toContain('127');
354354
});
355-
xit('should allow cross-frame js handles', async({page, server}) => {
356-
// TODO: this should be possible because frames script each other, but
357-
// protocol implementations do not support this.
355+
it('should not allow cross-frame js handles', async({page, server}) => {
356+
// TODO: this should actually be possible because frames script each other,
357+
// but protocol implementations do not support this. For now, assume current
358+
// behavior.
358359
await page.goto(server.PREFIX + '/frames/one-frame.html');
359360
const handle = await page.evaluateHandle(() => {
360361
const iframe = document.querySelector('iframe');
@@ -365,8 +366,8 @@ module.exports.describe = function({testRunner, expect, FFOX, CHROMIUM, WEBKIT})
365366
const childFrame = page.mainFrame().childFrames()[0];
366367
const childResult = await childFrame.evaluate(() => window.__foo);
367368
expect(childResult).toEqual({ bar: 'baz' });
368-
const result = await childFrame.evaluate(foo => foo.bar, handle);
369-
expect(result).toBe('baz');
369+
const error = await childFrame.evaluate(foo => foo.bar, handle).catch(e => e);
370+
expect(error.message).toBe('JSHandles can be evaluated only in the context they were created!');
370371
});
371372
it('should allow cross-frame element handles', async({page, server}) => {
372373
await page.goto(server.PREFIX + '/frames/one-frame.html');

0 commit comments

Comments
 (0)