[epiphany/pgriffis/web-extension/runtime-send-message: 22/29] WebExtensions: Load background page as URI instead of data




commit 0f046ddc7516f4d443c8443ba388c849b4df85cc
Author: Patrick Griffis <pgriffis igalia com>
Date:   Tue May 31 15:38:53 2022 -0500

    WebExtensions: Load background page as URI instead of data

 src/webextension/ephy-web-extension-manager.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
---
diff --git a/src/webextension/ephy-web-extension-manager.c b/src/webextension/ephy-web-extension-manager.c
index e95c7bce4..2adcb6853 100644
--- a/src/webextension/ephy-web-extension-manager.c
+++ b/src/webextension/ephy-web-extension-manager.c
@@ -1024,7 +1024,6 @@ run_background_script (EphyWebExtensionManager *self,
 {
   WebKitUserContentManager *ucm;
   GtkWidget *background;
-  g_autofree char *base_uri = NULL;
   const char *page;
 
   if (!ephy_web_extension_has_background_web_view (web_extension) || 
ephy_web_extension_manager_get_background_web_view (self, web_extension))
@@ -1036,14 +1035,13 @@ run_background_script (EphyWebExtensionManager *self,
   background = create_web_extensions_webview (web_extension);
   ephy_web_extension_manager_set_background_web_view (self, web_extension, WEBKIT_WEB_VIEW (background));
 
-  base_uri = create_base_uri_for_resource_path (web_extension, page);
-
   if (page) {
-    g_autofree char *data = ephy_web_extension_get_resource_as_string (web_extension, page);
-    if (data)
-      webkit_web_view_load_html (WEBKIT_WEB_VIEW (background), (char *)data, base_uri);
+    g_autofree char *page_uri = g_strdup_printf ("ephy-webextension://%s/%s", ephy_web_extension_get_guid 
(web_extension), page);
+    webkit_web_view_load_uri (WEBKIT_WEB_VIEW (background), page_uri);
+    return;
   } else {
     GPtrArray *scripts = ephy_web_extension_background_web_view_get_scripts (web_extension);
+    g_autofree char *base_uri = create_base_uri_for_resource_path (web_extension, page);
 
     ucm = webkit_web_view_get_user_content_manager (WEBKIT_WEB_VIEW (background));
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]