ScriptWorld
Superclasses: Object
- Constructors:
ScriptWorld(**properties)
new() -> WebKitWebProcessExtension.ScriptWorld
new_with_name(name:str) -> WebKitWebProcessExtension.ScriptWorld
Constructors
- class ScriptWorld
- classmethod new() ScriptWorld
Creates a new isolated
ScriptWorld
. Scripts executed in isolated worlds have access to the DOM but not to other variable or functions created by the page. TheScriptWorld
is created with a generated unique name. Usenew_with_name()
if you want to create it with a custom name. You can get the JavaScript execution context of aScriptWorld
for a givenFrame
with webkit_frame_get_javascript_context_for_script_world().Added in version 2.2.
- classmethod new_with_name(name: str) ScriptWorld
Creates a new isolated
ScriptWorld
with a name. Scripts executed in isolated worlds have access to the DOM but not to other variable or functions created by the page. You can get the JavaScript execution context of aScriptWorld
for a givenFrame
with webkit_frame_get_javascript_context_for_script_world().Added in version 2.22.
- Parameters:
name – a name for the script world
Methods
- class ScriptWorld
- get_default() ScriptWorld
Get the default
ScriptWorld
. This is the normal script world where all scripts are executed by default. You can get the JavaScript execution context of aScriptWorld
for a givenFrame
with webkit_frame_get_javascript_context_for_script_world().Added in version 2.2.
- get_name() str
Get the name of a
ScriptWorld
.Added in version 2.22.
Signals
- class ScriptWorld.signals
- window_object_cleared(page: WebPage, frame: Frame) None
Emitted when the JavaScript window object in a
ScriptWorld
has been cleared. This is the preferred place to set custom properties on the window object using the JavaScriptCore API. You can get the window object offrame
from the JavaScript execution context ofworld
that is returned byget_js_context_for_script_world()
.Added in version 2.2.