[epiphany/pgriffis/web-extension/runtime-send-message: 23/29] WebExtensions: Support <all_urls> in allow lists




commit de1cf1508a388823f6171d28a38d8b9b88179c7d
Author: Patrick Griffis <pgriffis igalia com>
Date:   Thu Jun 2 06:40:40 2022 -0500

    WebExtensions: Support <all_urls> in allow lists

 src/webextension/ephy-web-extension.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
---
diff --git a/src/webextension/ephy-web-extension.c b/src/webextension/ephy-web-extension.c
index 7d2496c7c..189279737 100644
--- a/src/webextension/ephy-web-extension.c
+++ b/src/webextension/ephy-web-extension.c
@@ -387,8 +387,15 @@ web_extension_add_allow_list (JsonArray *array,
                               gpointer   user_data)
 {
   WebExtensionContentScript *content_script = user_data;
+  const char *match = json_node_get_string (element_node);
 
-  g_ptr_array_add (content_script->allow_list, g_strdup (json_node_get_string (element_node)));
+  if (g_strcmp0 (match, "<all_urls>") == 0) {
+    g_ptr_array_add (content_script->allow_list, g_strdup ("https://*/*";));
+    g_ptr_array_add (content_script->allow_list, g_strdup ("http://*/*";));
+    return;
+  }
+
+  g_ptr_array_add (content_script->allow_list, g_strdup (match));
 }
 
 static void


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