createIsolatedWorld method
Creates an isolated world for the given frame.
frameId Id of the frame in which the isolated world should be created.
worldName An optional name which is reported in the Execution Context.
grantUniveralAccess Whether or not universal access should be granted to the isolated world. This is a powerful
option, use with caution.
contentSecurityPolicy An optional content security policy to set for the isolated world.
If omitted, any existing CSP for the world will be cleared.
Note that clearing or updating the CSP does not immediately affect the active
context in the same document because LocalDOMWindow caches the
ContentSecurityPolicy object. The change takes effect on subsequent
navigations when a new window context is created.
Returns: Execution context of the isolated world.
Implementation
Future<runtime.ExecutionContextId> createIsolatedWorld(
FrameId frameId, {
String? worldName,
bool? grantUniveralAccess,
String? contentSecurityPolicy,
}) async {
var result = await _client.send('Page.createIsolatedWorld', {
'frameId': frameId,
'worldName': ?worldName,
'grantUniveralAccess': ?grantUniveralAccess,
'contentSecurityPolicy': ?contentSecurityPolicy,
});
return runtime.ExecutionContextId.fromJson(
result['executionContextId'] as int,
);
}