about summary refs log tree commit diff
diff options
context:
space:
mode:
authorQuentin Rameau <quinq@fifth.space>2018-03-25 12:07:41 +0200
committerQuentin Rameau <quinq@fifth.space>2018-10-08 11:38:03 +0200
commit0bd553a078cc8ec1d197fd7af96b07b1921049e2 (patch)
tree33b6ae7fc2bfbf1dae13344db7058f609a407d94
parentExit more gracefully on web process crash. (diff)
downloadsurf-0bd553a078cc8ec1d197fd7af96b07b1921049e2.tar.gz
surf-0bd553a078cc8ec1d197fd7af96b07b1921049e2.tar.bz2
surf-0bd553a078cc8ec1d197fd7af96b07b1921049e2.zip
Request cookiemanager only once at creation
-rw-r--r--surf.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/surf.c b/surf.c
index eab314a..6950dc5 100644
--- a/surf.c
+++ b/surf.c
@@ -1079,6 +1079,7 @@ newview(Client *c, WebKitWebView *rv)
 	WebKitSettings *settings;
 	WebKitUserContentManager *contentmanager;
 	WebKitWebContext *context;
+	WebKitCookieManager *cookiemanager;
 
 	/* Webview */
 	if (rv) {
@@ -1125,6 +1126,8 @@ newview(Client *c, WebKitWebView *rv)
 		          "base-data-directory", cachedir,
 		          NULL));
 
+		cookiemanager = webkit_web_context_get_cookie_manager(context);
+
 		/* rendering process model, can be a shared unique one
 		 * or one for each view */
 		webkit_web_context_set_process_model(context,
@@ -1139,12 +1142,10 @@ newview(Client *c, WebKitWebView *rv)
 		    WEBKIT_CACHE_MODEL_DOCUMENT_VIEWER);
 
 		/* Currently only works with text file to be compatible with curl */
-		webkit_cookie_manager_set_persistent_storage(
-		    webkit_web_context_get_cookie_manager(context), cookiefile,
-		    WEBKIT_COOKIE_PERSISTENT_STORAGE_TEXT);
+		webkit_cookie_manager_set_persistent_storage(cookiemanager,
+		    cookiefile, WEBKIT_COOKIE_PERSISTENT_STORAGE_TEXT);
 		/* cookie policy */
-		webkit_cookie_manager_set_accept_policy(
-		    webkit_web_context_get_cookie_manager(context),
+		webkit_cookie_manager_set_accept_policy(cookiemanager,
 		    cookiepolicy_get());
 		/* languages */
 		webkit_web_context_set_preferred_languages(context,