[epiphany/pgriffis/web-extension/runtime-send-message: 6/15] WebExtension: Load popup as URI instead of data




commit d4aaffed53d5d2d27eb12ade12b202578702c19d
Author: Patrick Griffis <pgriffis igalia com>
Date:   Tue May 31 15:34:39 2022 -0500

    WebExtension: Load popup as URI instead of data
    
    Part-of: <https://gitlab.gnome.org/GNOME/epiphany/-/merge_requests/1122>

 src/webextension/ephy-web-extension-manager.c | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)
---
diff --git a/src/webextension/ephy-web-extension-manager.c b/src/webextension/ephy-web-extension-manager.c
index baadab97b..f9e2bd5f1 100644
--- a/src/webextension/ephy-web-extension-manager.c
+++ b/src/webextension/ephy-web-extension-manager.c
@@ -833,24 +833,18 @@ create_browser_popup (EphyWebExtension *web_extension)
 {
   EphyWebExtensionManager *manager = ephy_web_extension_manager_get_default ();
   GtkWidget *web_view;
-  g_autofree char *data = NULL;
-  g_autofree char *base_uri = NULL;
+  g_autofree char *popup_uri = NULL;
   const char *popup;
 
-  popup = ephy_web_extension_get_browser_popup (web_extension);
-  data = ephy_web_extension_get_resource_as_string (web_extension, popup);
-  if (!data)
-    return NULL;
   web_view = create_web_extensions_webview (web_extension);
   gtk_widget_hide (web_view); /* Shown in on_popup_load_changed. */
-
   ephy_web_extension_manager_register_popup_view (manager, web_extension, web_view);
 
-  base_uri = create_base_uri_for_resource_path (web_extension, popup);
-  webkit_web_view_load_html (WEBKIT_WEB_VIEW (web_view), (char *)data, base_uri);
+  popup = ephy_web_extension_get_browser_popup (web_extension);
+  popup_uri = g_strdup_printf ("ephy-webextension://%s/%s", ephy_web_extension_get_guid (web_extension), 
popup);
+  webkit_web_view_load_uri (WEBKIT_WEB_VIEW (web_view), popup_uri);
   g_signal_connect (web_view, "load-changed", G_CALLBACK (on_popup_load_changed), NULL);
 
-
   return web_view;
 }
 


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