[epiphany/pgriffis/web-extension/data-manager] WebExtensions: Set WebSiteDataManager




commit bfa5a614541145cbe427e580170701da444acc2a
Author: Patrick Griffis <pgriffis igalia com>
Date:   Sun Jul 10 16:58:37 2022 -0500

    WebExtensions: Set WebSiteDataManager
    
    Previously it used WebKit's default which isn't wanted.

 src/webextension/ephy-web-extension-manager.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
---
diff --git a/src/webextension/ephy-web-extension-manager.c b/src/webextension/ephy-web-extension-manager.c
index 4d37b2f80..d9c00d5dc 100644
--- a/src/webextension/ephy-web-extension-manager.c
+++ b/src/webextension/ephy-web-extension-manager.c
@@ -984,6 +984,7 @@ GtkWidget *
 ephy_web_extensions_manager_create_web_extensions_webview (EphyWebExtension *web_extension)
 {
   EphyWebExtensionManager *manager = ephy_web_extension_manager_get_default ();
+  g_autoptr (WebKitWebsiteDataManager) data_manager = NULL;
   g_autoptr (WebKitSettings) settings = NULL;
   WebKitWebContext *web_context;
   GtkWidget *web_view;
@@ -1001,7 +1002,16 @@ ephy_web_extensions_manager_create_web_extensions_webview (EphyWebExtension *web
   else
     webkit_settings_set_user_agent_with_application_details (settings, "Epiphany", EPHY_VERSION);
 
-  web_context = webkit_web_context_new ();
+  if (ephy_embed_shell_get_mode (ephy_embed_shell_get_default ()) == EPHY_EMBED_SHELL_MODE_INCOGNITO)
+    data_manager = webkit_website_data_manager_new_ephemeral ();
+  else {
+    data_manager = webkit_website_data_manager_new ("base-data-directory", ephy_profile_dir (),
+                                                    "base-cache-directory", ephy_cache_dir (),
+                                                    NULL);
+    webkit_website_data_manager_set_persistent_credential_storage_enabled (data_manager, FALSE);
+  }
+
+  web_context = webkit_web_context_new_with_website_data_manager (data_manager);
 
   webkit_web_context_register_uri_scheme (web_context, "ephy-webextension", ephy_webextension_scheme_cb, 
web_extension, NULL);
   webkit_security_manager_register_uri_scheme_as_secure (webkit_web_context_get_security_manager 
(web_context),


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