[webkit-gtk] Q: How to synchronise UI process and web process extension?
albrecht.dress at netcologne.de
Fri Jul 30 12:17:29 PDT 2021
I want to implement content blocking for external material loaded from HTML messages in a MUA (balsa). Unfortunately, webkit_settings_set_auto_load_images() is not a solution, as I still want to display embedded images in the email, but I also want to suppress loading external styles, etc. The blocking shall work on a per-message basis, e.g. it shall always be allowed for some senders, but only after user permission for others.
From  I understand that I have to use the WebKitWebPage::send-request signal in an extension. So I wrote an extension which
(1) connects the page "page-created" signal in webkit_web_extension_initialize();
(2) the callback for (1)
(a) sends a message using webkit_web_page_send_message_to_view() to get the blocking settings for the particular message, and
(b) connects to the "send-request" signal.
This seems to work just fine, but I feel that I need some synchronisation between the main UI and the web process:
When the callback for (2b), i.e. for "send-request", is called, I must ensure that the reply from the main UI process with the decision if external material shall be loaded for the particular instance (email) has already been received, i.e. the callback registered in step (2a) has already been called. IOW, the callback (2b) must not be called before the callback (2a) has been processed, or I have to somehow "delay" the web process until this reply has been received.
Is this possible? How?
Thanks in advance for any insight,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 488 bytes
Desc: not available
More information about the webkit-gtk