@@ -352,9 +352,10 @@ module.exports.describe = function({testRunner, expect, FFOX, CHROMIUM, WEBKIT})
352
352
await page . goto ( server . CROSS_PROCESS_PREFIX + '/empty.html' ) ;
353
353
expect ( await mainFrame . evaluate ( ( ) => window . location . href ) ) . toContain ( '127' ) ;
354
354
} ) ;
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.
358
359
await page . goto ( server . PREFIX + '/frames/one-frame.html' ) ;
359
360
const handle = await page . evaluateHandle ( ( ) => {
360
361
const iframe = document . querySelector ( 'iframe' ) ;
@@ -365,8 +366,8 @@ module.exports.describe = function({testRunner, expect, FFOX, CHROMIUM, WEBKIT})
365
366
const childFrame = page . mainFrame ( ) . childFrames ( ) [ 0 ] ;
366
367
const childResult = await childFrame . evaluate ( ( ) => window . __foo ) ;
367
368
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! ' ) ;
370
371
} ) ;
371
372
it ( 'should allow cross-frame element handles' , async ( { page, server} ) => {
372
373
await page . goto ( server . PREFIX + '/frames/one-frame.html' ) ;
0 commit comments