Request cookiemanager only once at creation

This commit is contained in:
Quentin Rameau 2018-03-25 12:07:41 +02:00
parent c60523a702
commit 0bd553a078
1 changed files with 6 additions and 5 deletions

11
surf.c
View File

@ -1079,6 +1079,7 @@ newview(Client *c, WebKitWebView *rv)
WebKitSettings *settings; WebKitSettings *settings;
WebKitUserContentManager *contentmanager; WebKitUserContentManager *contentmanager;
WebKitWebContext *context; WebKitWebContext *context;
WebKitCookieManager *cookiemanager;
/* Webview */ /* Webview */
if (rv) { if (rv) {
@ -1125,6 +1126,8 @@ newview(Client *c, WebKitWebView *rv)
"base-data-directory", cachedir, "base-data-directory", cachedir,
NULL)); NULL));
cookiemanager = webkit_web_context_get_cookie_manager(context);
/* rendering process model, can be a shared unique one /* rendering process model, can be a shared unique one
* or one for each view */ * or one for each view */
webkit_web_context_set_process_model(context, webkit_web_context_set_process_model(context,
@ -1139,12 +1142,10 @@ newview(Client *c, WebKitWebView *rv)
WEBKIT_CACHE_MODEL_DOCUMENT_VIEWER); WEBKIT_CACHE_MODEL_DOCUMENT_VIEWER);
/* Currently only works with text file to be compatible with curl */ /* Currently only works with text file to be compatible with curl */
webkit_cookie_manager_set_persistent_storage( webkit_cookie_manager_set_persistent_storage(cookiemanager,
webkit_web_context_get_cookie_manager(context), cookiefile, cookiefile, WEBKIT_COOKIE_PERSISTENT_STORAGE_TEXT);
WEBKIT_COOKIE_PERSISTENT_STORAGE_TEXT);
/* cookie policy */ /* cookie policy */
webkit_cookie_manager_set_accept_policy( webkit_cookie_manager_set_accept_policy(cookiemanager,
webkit_web_context_get_cookie_manager(context),
cookiepolicy_get()); cookiepolicy_get());
/* languages */ /* languages */
webkit_web_context_set_preferred_languages(context, webkit_web_context_set_preferred_languages(context,