[epiphany/pgriffis/web-extension/menus: 1/2] WebExtensions: Delay adding user scripts until script world is initialized
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany/pgriffis/web-extension/menus: 1/2] WebExtensions: Delay adding user scripts until script world is initialized
- Date: Mon, 27 Jun 2022 20:08:42 +0000 (UTC)
commit e8ce21991d78fbc9481d8f77e8605b8d1ba15f41
Author: Patrick Griffis <pgriffis igalia com>
Date: Fri Jun 24 12:38:29 2022 -0500
WebExtensions: Delay adding user scripts until script world is initialized
Part-of: <https://gitlab.gnome.org/GNOME/epiphany/-/merge_requests/1154>
src/webextension/ephy-web-extension-manager.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/src/webextension/ephy-web-extension-manager.c b/src/webextension/ephy-web-extension-manager.c
index 1112e371d..dae10db98 100644
--- a/src/webextension/ephy-web-extension-manager.c
+++ b/src/webextension/ephy-web-extension-manager.c
@@ -768,6 +768,17 @@ update_translations (EphyWebExtension *web_extension)
g_variant_new ("(ss)",
ephy_web_extension_get_guid (web_extension), data)));
}
+static void
+send_to_page_ready_cb (WebKitWebView *web_view,
+ GAsyncResult *result,
+ EphyWebExtension *web_extension)
+{
+ g_autoptr (WebKitUserMessage) response = webkit_web_view_send_message_to_page_finish (web_view, result,
NULL);
+
+ update_translations (web_extension);
+ add_content_scripts (web_extension, EPHY_WEB_VIEW (web_view));
+}
+
static void
ephy_web_extension_manager_add_web_extension_to_webview (EphyWebExtensionManager *self,
EphyWebExtension *web_extension,
@@ -800,10 +811,7 @@ ephy_web_extension_manager_add_web_extension_to_webview (EphyWebExtensionManager
webkit_web_view_send_message_to_page (WEBKIT_WEB_VIEW (web_view),
webkit_user_message_new ("WebExtension.Initialize",
g_variant_new_string (ephy_web_extension_get_guid (web_extension))),
- NULL, NULL, NULL);
-
- update_translations (web_extension);
- add_content_scripts (web_extension, web_view);
+ NULL, (GAsyncReadyCallback)send_to_page_ready_cb, web_extension);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]