Class ScriptWorld

All Implemented Interfaces:
Proxy

@Generated("org.javagi.JavaGI") public final class ScriptWorld extends GObject
  • Constructor Details

    • ScriptWorld

      public ScriptWorld(MemorySegment address)
      Create a ScriptWorld instance for the provided memory address.
      Parameters:
      address - the memory address of the native object
    • ScriptWorld

      public ScriptWorld()
      Create a new ScriptWorld.
  • Method Details

    • getType

      public static @Nullable Type getType()
      Get the GType of the ScriptWorld class.
      Returns:
      the GType
    • getMemoryLayout

      public static MemoryLayout getMemoryLayout()
      The memory layout of the native struct.
      Returns:
      the memory layout
    • asParent

      protected ScriptWorld asParent()
      Return this instance as if it were its parent type. Comparable to the Java super keyword, but ensures the parent typeclass is also used in native code.
      Overrides:
      asParent in class GObject
      Returns:
      the instance as if it were its parent type
    • withName

      public static ScriptWorld withName(String name)
      Creates a new isolated WebKitScriptWorld 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 a WebKitScriptWorld for a given WebKitFrame with webkit_frame_get_javascript_context_for_script_world().
      Parameters:
      name - a name for the script world
      Returns:
      a new isolated WebKitScriptWorld
      Since:
      2.22
    • getDefault

      public static ScriptWorld getDefault()
      Get the default WebKitScriptWorld. This is the normal script world where all scripts are executed by default. You can get the JavaScript execution context of a WebKitScriptWorld for a given WebKitFrame with webkit_frame_get_javascript_context_for_script_world().
      Returns:
      the default WebKitScriptWorld
      Since:
      2.2
    • getName

      public String getName()
      Get the name of a WebKitScriptWorld.
      Returns:
      the name of this ScriptWorld
      Since:
      2.22
    • onWindowObjectCleared

      Emitted when the JavaScript window object in a WebKitScriptWorld 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 of frame from the JavaScript execution context of world that is returned by webkit_frame_get_js_context_for_script_world().
      Parameters:
      handler - the signal handler
      Returns:
      a signal handler ID to keep track of the signal connection
      Since:
      2.2
      See Also:
    • emitWindowObjectCleared

      public void emitWindowObjectCleared(@Nullable WebPage page, @Nullable Frame frame)
      Emits the "window-object-cleared" signal. See onWindowObjectCleared(ScriptWorld.WindowObjectClearedCallback).
    • builder

      public static ScriptWorld.Builder<? extends ScriptWorld.Builder> builder()
      A ScriptWorld.Builder object constructs a ScriptWorld with the specified properties. Use the various set...() methods to set properties, and finish construction with ScriptWorld.Builder.build().
      Returns:
      the builder object