WebKit2WebExtension.WebPage¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r |
Signals¶
- Inherited:
Name |
Short Description |
---|---|
Emitted when a message is sent to the console. |
|
Emitted before a context menu is displayed in the UI Process to give the application a chance to customize the proposed menu, build its own context menu or pass user data to the UI Process. |
|
This signal is emitted when the DOM document of a |
|
Emitted after form elements (or form associated elements) are associated to a particular web page. |
|
Emitted after form elements (or form associated elements) are associated to a particular web page. |
|
This signal is emitted when request is about to be sent to the server. |
|
This signal is emitted when a |
|
This signal is emitted to indicate various points during form submission. |
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
---|---|---|---|
parent |
r |
Class Details¶
- class WebKit2WebExtension.WebPage(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
A loaded web page.
- get_dom_document()¶
- Returns:
the
WebKit2WebExtension.DOMDocument
currently loaded, orNone
if no document is currently loaded.- Return type:
Get the
WebKit2WebExtension.DOMDocument
currently loaded in selfDeprecated since version 2.40.: Use JavaScriptCore API instead.
- get_editor()¶
- Returns:
- Return type:
Gets the
WebKit2WebExtension.WebEditor
of aWebKit2WebExtension.WebPage
.New in version 2.10.
- get_form_manager(world)¶
- Parameters:
world (
WebKit2WebExtension.ScriptWorld
orNone
) – aWebKit2WebExtension.ScriptWorld
- Returns:
- Return type:
Get the
WebKit2WebExtension.WebFormManager
of self in world.New in version 2.40.
- get_id()¶
- Returns:
the identifier of self
- Return type:
Get the identifier of the
WebKit2WebExtension.WebPage
- get_main_frame()¶
- Returns:
the
WebKit2WebExtension.Frame
that is the main frame of self- Return type:
Returns the main frame of a
WebKit2WebExtension.WebPage
.New in version 2.2.
- get_uri()¶
- Returns:
the current active URI of web_view or
None
if nothing has been loaded yet.- Return type:
Returns the current active URI of self.
You can monitor the active URI by connecting to the notify::uri signal of self.
- send_message_to_view(message, cancellable, callback, *user_data)¶
- Parameters:
message (
WebKit2WebExtension.UserMessage
) – aWebKit2WebExtension.UserMessage
cancellable (
Gio.Cancellable
orNone
) – aGio.Cancellable
orNone
to ignorecallback (
Gio.AsyncReadyCallback
orNone
) – AGio.AsyncReadyCallback
to call when the request is satisfied orNone
user_data (
object
orNone
) – the data to pass to callback function
Send message to the #WebKitWebView corresponding to self. If message is floating, it’s consumed.
If you don’t expect any reply, or you simply want to ignore it, you can pass
None
as callback. When the operation is finished, callback will be called. You can then callWebKit2WebExtension.WebPage.send_message_to_view_finish
() to get the message reply.New in version 2.28.
- send_message_to_view_finish(result)¶
- Parameters:
result (
Gio.AsyncResult
) – aGio.AsyncResult
- Raises:
- Returns:
a
WebKit2WebExtension.UserMessage
with the reply orNone
in case of error.- Return type:
Finish an asynchronous operation started with
WebKit2WebExtension.WebPage.send_message_to_view
().New in version 2.28.
Signal Details¶
- WebKit2WebExtension.WebPage.signals.console_message_sent(web_page, console_message)¶
- Signal Name:
console-message-sent
- Flags:
- Parameters:
web_page (
WebKit2WebExtension.WebPage
) – The object which received the signalconsole_message (
WebKit2WebExtension.ConsoleMessage
) – theWebKit2WebExtension.ConsoleMessage
Emitted when a message is sent to the console. This can be a message produced by the use of JavaScript console API, a JavaScript exception, a security error or other errors, warnings, debug or log messages. The console_message contains information of the message.
New in version 2.12.
Deprecated since version 2.40.
- Signal Name:
context-menu
- Flags:
- Parameters:
web_page (
WebKit2WebExtension.WebPage
) – The object which received the signalcontext_menu (
WebKit2WebExtension.ContextMenu
) – the proposedWebKit2WebExtension.ContextMenu
hit_test_result (
WebKit2WebExtension.WebHitTestResult
) – aWebKit2WebExtension.WebHitTestResult
- Returns:
True
if the proposed context_menu has been modified, orFalse
otherwise.- Return type:
Emitted before a context menu is displayed in the UI Process to give the application a chance to customize the proposed menu, build its own context menu or pass user data to the UI Process. This signal is useful when the information available in the UI Process is not enough to build or customize the context menu, for example, to add menu entries depending on the node at the coordinates of the hit_test_result. Otherwise, it’s recommended to use #WebKitWebView::context-menu signal instead.
New in version 2.8.
- WebKit2WebExtension.WebPage.signals.document_loaded(web_page)¶
- Signal Name:
document-loaded
- Flags:
- Parameters:
web_page (
WebKit2WebExtension.WebPage
) – The object which received the signal
This signal is emitted when the DOM document of a
WebKit2WebExtension.WebPage
has been loaded.You can wait for this signal to get the DOM document
- WebKit2WebExtension.WebPage.signals.form_controls_associated(web_page, elements)¶
- Signal Name:
form-controls-associated
- Flags:
- Parameters:
web_page (
WebKit2WebExtension.WebPage
) – The object which received the signalelements ([
WebKit2WebExtension.DOMElement
]) – aGLib.PtrArray
ofWebKit2WebExtension.DOMElement
with the list of forms in the page
Emitted after form elements (or form associated elements) are associated to a particular web page. This is useful to implement form auto filling for web pages where form fields are added dynamically. This signal might be emitted multiple times for the same web page.
Note that this signal could be also emitted when form controls are moved between forms. In that case, the elements array carries the list of those elements which have moved.
Clients should take a reference to the members of the elements array if it is desired to keep them alive after the signal handler returns.
New in version 2.16.
Deprecated since version 2.26: , use
WebKit2WebExtension.WebPage
::form-controls-associated-for-frame
instead.
- WebKit2WebExtension.WebPage.signals.form_controls_associated_for_frame(web_page, elements, frame)¶
- Signal Name:
form-controls-associated-for-frame
- Flags:
- Parameters:
web_page (
WebKit2WebExtension.WebPage
) – The object which received the signalelements ([
WebKit2WebExtension.DOMElement
]) – aGLib.PtrArray
ofWebKit2WebExtension.DOMElement
with the list of forms in the pageframe (
WebKit2WebExtension.Frame
) – theWebKit2WebExtension.Frame
Emitted after form elements (or form associated elements) are associated to a particular web page. This is useful to implement form auto filling for web pages where form fields are added dynamically. This signal might be emitted multiple times for the same web page.
Note that this signal could be also emitted when form controls are moved between forms. In that case, the elements array carries the list of those elements which have moved.
Clients should take a reference to the members of the elements array if it is desired to keep them alive after the signal handler returns.
New in version 2.26.
Deprecated since version 2.40: Use
WebKit2WebExtension.WebFormManager
::form-controls-associated
instead.
- WebKit2WebExtension.WebPage.signals.send_request(web_page, request, redirected_response)¶
- Signal Name:
send-request
- Flags:
- Parameters:
web_page (
WebKit2WebExtension.WebPage
) – The object which received the signalrequest (
WebKit2WebExtension.URIRequest
) – aWebKit2WebExtension.URIRequest
redirected_response (
WebKit2WebExtension.URIResponse
) – aWebKit2WebExtension.URIResponse
, orNone
- Returns:
True
to stop other handlers from being invoked for the event.False
to continue emission of the event.- Return type:
This signal is emitted when request is about to be sent to the server. This signal can be used to modify the
WebKit2WebExtension.URIRequest
that will be sent to the server. You can also cancel the resource load operation by connecting to this signal and returningTrue
.In case of a server redirection this signal is emitted again with the request argument containing the new request to be sent to the server due to the redirection and the redirected_response parameter containing the response received by the server for the initial request.
Modifications to the
WebKit2WebExtension.URIRequest
and its associatedSoup.MessageHeaders
will be taken into account when the request is sent over the network.
- WebKit2WebExtension.WebPage.signals.user_message_received(web_page, message)¶
- Signal Name:
user-message-received
- Flags:
- Parameters:
web_page (
WebKit2WebExtension.WebPage
) – The object which received the signalmessage (
WebKit2WebExtension.UserMessage
) – theWebKit2WebExtension.UserMessage
received
- Returns:
- Return type:
This signal is emitted when a
WebKit2WebExtension.UserMessage
is received from the #WebKitWebView corresponding to web_page. You can reply to the message usingWebKit2WebExtension.UserMessage.send_reply
().You can handle the user message asynchronously by calling
GObject.Object.ref
() on message and returningTrue
. If the last reference of message is removed and the message has been replied, the operation in the #WebKitWebView will finish with errorWebKit2WebExtension.UserMessageError.USER_MESSAGE_UNHANDLED_MESSAGE
.New in version 2.28.
- WebKit2WebExtension.WebPage.signals.will_submit_form(web_page, form, step, source_frame, target_frame, text_field_names, text_field_values)¶
- Signal Name:
will-submit-form
- Flags:
- Parameters:
web_page (
WebKit2WebExtension.WebPage
) – The object which received the signalform (
WebKit2WebExtension.DOMElement
) – theWebKit2WebExtension.DOMElement
to be submitted, which will always correspond to an HTMLFormElementstep (
WebKit2WebExtension.FormSubmissionStep
) – a #WebKitFormSubmissionEventType indicating the current stage of form submissionsource_frame (
WebKit2WebExtension.Frame
) – theWebKit2WebExtension.Frame
containing the form to be submittedtarget_frame (
WebKit2WebExtension.Frame
) – theWebKit2WebExtension.Frame
containing the form’s target, which may be the same as source_frame if no target was specifiedtext_field_names ([
str
]) – names of the form’s text fieldstext_field_values ([
str
]) – values of the form’s text fields
This signal is emitted to indicate various points during form submission. step indicates the current stage of form submission.
If this signal is emitted with
WebKit2WebExtension.FormSubmissionStep.SEND_DOM_EVENT
, then the DOM submit event is about to be emitted. JavaScript code may rely on the submit event to detect that the user has clicked on a submit button, and to possibly cancel the form submission beforeWebKit2WebExtension.FormSubmissionStep.COMPLETE
. However, beware that, for historical reasons, the submit event is not emitted at all if the form submission is triggered by JavaScript. For these reasons,WebKit2WebExtension.FormSubmissionStep.SEND_DOM_EVENT
may not be used to reliably detect whether a form will be submitted. Instead, use it to detect if a user has clicked on a form’s submit button even if JavaScript later cancels the form submission, or to read the values of the form’s fields even if JavaScript later clears certain fields before submitting. This may be needed, for example, to implement a robust browser password manager, as some misguided websites may use such techniques to attempt to thwart password managers.If this signal is emitted with
WebKit2WebExtension.FormSubmissionStep.COMPLETE
, the form will imminently be submitted. It can no longer be cancelled. This event always occurs immediately before a form is submitted to its target, so use this event to reliably detect when a form is submitted. This event occurs afterWebKit2WebExtension.FormSubmissionStep.SEND_DOM_EVENT
if that event is emitted.New in version 2.20.
Deprecated since version 2.40: Use
WebKit2WebExtension.WebFormManager
::will-send-submit-event
andWebKit2WebExtension.WebFormManager
::will-submit-form
instead.
Property Details¶
- WebKit2WebExtension.WebPage.props.uri¶
-
The current active URI of the
WebKit2WebExtension.WebPage
.