[epiphany/pgriffis/web-extension-fixes-2: 6/16] Assert WebProcessExtensions are created with a guid



commit d337e5d0ce15c785985b584246e5cf694eb2e9ec
Author: Patrick Griffis <pgriffis igalia com>
Date:   Sun May 15 12:25:18 2022 -0500

    Assert WebProcessExtensions are created with a guid

 embed/web-process-extension/ephy-web-process-extension.c | 8 +++-----
 embed/web-process-extension/ephy-webextension-api.c      | 7 +++----
 2 files changed, 6 insertions(+), 9 deletions(-)
---
diff --git a/embed/web-process-extension/ephy-web-process-extension.c 
b/embed/web-process-extension/ephy-web-process-extension.c
index 54ecdfa0a..f739c1236 100644
--- a/embed/web-process-extension/ephy-web-process-extension.c
+++ b/embed/web-process-extension/ephy-web-process-extension.c
@@ -781,11 +781,9 @@ ephy_web_process_extension_initialize (EphyWebProcessExtension *extension,
 
   extension->initialized = TRUE;
 
-  /* Note: An empty guid is used ONLY for WebExtensions which do have an own initialization function */
-  if (strlen (guid) > 0)
-    extension->script_world = webkit_script_world_new_with_name (guid);
-  else
-    extension->script_world = webkit_script_world_get_default ();
+  g_assert (guid && *guid);
+
+  extension->script_world = webkit_script_world_new_with_name (guid);
 
   g_signal_connect (extension->script_world,
                     "window-object-cleared",
diff --git a/embed/web-process-extension/ephy-webextension-api.c 
b/embed/web-process-extension/ephy-webextension-api.c
index 05f81be8e..1830da161 100644
--- a/embed/web-process-extension/ephy-webextension-api.c
+++ b/embed/web-process-extension/ephy-webextension-api.c
@@ -300,10 +300,9 @@ ephy_web_extension_extension_initialize (EphyWebExtensionExtension *extension,
 
   extension->initialized = TRUE;
 
-  if (!guid || strlen (guid) == 0)
-    extension->script_world = webkit_script_world_get_default ();
-  else
-    extension->script_world = webkit_script_world_new_with_name (guid);
+  g_assert (guid && *guid);
+
+  extension->script_world = webkit_script_world_new_with_name (guid);
 
   g_signal_connect (extension->script_world,
                     "window-object-cleared",


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