Package org.gnome.webkit
Interface WebView.ScriptDialogCallback
- All Superinterfaces:
FunctionPointer
- Enclosing class:
WebView
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Functional interface declaration of the
ScriptDialogCallback
callback.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionboolean
run
(ScriptDialog dialog) Emitted when JavaScript code calls <function>window.alert</function>, <function>window.confirm</function> or <function>window.prompt</function>, or when <function>onbeforeunload</function> event is fired.default MemorySegment
toCallback
(Arena arena) Creates a native function pointer to theupcall(java.lang.foreign.MemorySegment, java.lang.foreign.MemorySegment)
method.default int
upcall
(MemorySegment sourceWebView, MemorySegment dialog) Theupcall
method is called from native code.
-
Method Details
-
run
Emitted when JavaScript code calls <function>window.alert</function>, <function>window.confirm</function> or <function>window.prompt</function>, or when <function>onbeforeunload</function> event is fired. Thedialog
parameter should be used to build the dialog. If the signal is not handled a different dialog will be built and shown depending on the dialog type: <itemizedlist> <listitem><para>ScriptDialogType.ALERT
: message dialog with a single Close button. </para></listitem> <listitem><para>ScriptDialogType.CONFIRM
: message dialog with OK and Cancel buttons. </para></listitem> <listitem><para>ScriptDialogType.PROMPT
: message dialog with OK and Cancel buttons and a text entry with the default text. </para></listitem> <listitem><para>ScriptDialogType.BEFORE_UNLOAD_CONFIRM
: message dialog with Stay and Leave buttons. </para></listitem> </itemizedlist>It is possible to handle the script dialog request asynchronously, by simply caling webkit_script_dialog_ref() on the
dialog
argument and calling webkit_script_dialog_close() when done. If the last reference is removed on aWebKitScriptDialog
and the dialog has not been closed, webkit_script_dialog_close() will be called. -
upcall
Theupcall
method is called from native code. The parameters are marshaled andrun(org.gnome.webkit.ScriptDialog)
is executed. -
toCallback
Creates a native function pointer to theupcall(java.lang.foreign.MemorySegment, java.lang.foreign.MemorySegment)
method.- Specified by:
toCallback
in interfaceFunctionPointer
- Parameters:
arena
- the function pointer will be allocated in this arena- Returns:
- the native function pointer
-