@@ -21,7 +21,7 @@ import * as dom from '../dom';
21
21
import * as network from '../network' ;
22
22
import { WKSession } from './wkConnection' ;
23
23
import { Events } from '../events' ;
24
- import { WKExecutionContext , EVALUATION_SCRIPT_URL } from './wkExecutionContext' ;
24
+ import { WKExecutionContext } from './wkExecutionContext' ;
25
25
import { WKInterceptableRequest } from './wkInterceptableRequest' ;
26
26
import { WKWorkers } from './wkWorkers' ;
27
27
import { Page , PageDelegate , Coverage } from '../page' ;
@@ -101,7 +101,7 @@ export class WKPage implements PageDelegate {
101
101
session . send ( 'Page.getResourceTree' ) . then ( resourceTreeHandler ) ,
102
102
// Resource tree should be received before first execution context.
103
103
session . send ( 'Runtime.enable' ) ,
104
- session . send ( 'Page.createIsolatedWorld ' , { name : UTILITY_WORLD_NAME , source : `//# sourceURL= ${ EVALUATION_SCRIPT_URL } ` } ) ,
104
+ session . send ( 'Page.createUserWorld ' , { name : UTILITY_WORLD_NAME } ) . catch ( _ => { } ) , // Worlds are per-process
105
105
session . send ( 'Console.enable' ) ,
106
106
session . send ( 'Page.setInterceptFileChooserDialog' , { enabled : true } ) ,
107
107
session . send ( 'Network.enable' ) ,
@@ -295,11 +295,11 @@ export class WKPage implements PageDelegate {
295
295
return ;
296
296
const delegate = new WKExecutionContext ( this . _session , contextPayload . id ) ;
297
297
const context = new dom . FrameExecutionContext ( delegate , frame ) ;
298
- if ( contextPayload . isPageContext )
298
+ if ( contextPayload . type === 'normal' )
299
299
frame . _contextCreated ( 'main' , context ) ;
300
- else if ( contextPayload . name === UTILITY_WORLD_NAME )
300
+ else if ( contextPayload . type === 'user' && contextPayload . name === UTILITY_WORLD_NAME )
301
301
frame . _contextCreated ( 'utility' , context ) ;
302
- if ( contextPayload . isPageContext && frame === this . _page . mainFrame ( ) )
302
+ if ( contextPayload . type === 'normal' && frame === this . _page . mainFrame ( ) )
303
303
this . _mainFrameContextId = contextPayload . id ;
304
304
this . _contextIdToContext . set ( contextPayload . id , context ) ;
305
305
}
0 commit comments