[epiphany/pgriffis/web-extension-fixes-2: 1/5] web-extensions: Fix assertion when popup HTML is empty




commit 20ac44011a0688c78ca4ca8fdda45b8959ce7402
Author: Patrick Griffis <pgriffis igalia com>
Date:   Mon Apr 25 14:31:13 2022 -0500

    web-extensions: Fix assertion when popup HTML is empty
    
    If there is no data do not create a popup.

 src/webextension/ephy-web-extension-manager.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/src/webextension/ephy-web-extension-manager.c b/src/webextension/ephy-web-extension-manager.c
index 4aaa9f9fe..4294df0ee 100644
--- a/src/webextension/ephy-web-extension-manager.c
+++ b/src/webextension/ephy-web-extension-manager.c
@@ -671,14 +671,17 @@ create_browser_popup (EphyWebExtension *web_extension)
   g_autofree char *dir_name = 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;
+
   popover = gtk_popover_new (NULL);
 
   web_view = create_web_extensions_webview (web_extension, TRUE);
 
-  popup = ephy_web_extension_get_browser_popup (web_extension);
   dir_name = g_path_get_dirname (popup);
   base_uri = g_strdup_printf ("ephy-webextension:///%s/", dir_name);
-  data = ephy_web_extension_get_resource_as_string (web_extension, popup);
   webkit_web_view_load_html (WEBKIT_WEB_VIEW (web_view), (char *)data, base_uri);
   gtk_container_add (GTK_CONTAINER (popover), web_view);
   gtk_widget_show_all (web_view);


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