[epiphany/pgriffis/web-extension/menus: 11/12] WebExtensions: Delay adding user scripts until script world is initialized
- From: Patrick Griffis <pgriffis src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany/pgriffis/web-extension/menus: 11/12] WebExtensions: Delay adding user scripts until script world is initialized
- Date: Mon, 27 Jun 2022 19:52:00 +0000 (UTC)
commit 0284ca00e67417608ad0d14051a41d3f57a5730b
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
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]