From 8d55d093f29008b268569cdec28b700a8c42d761 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Mon, 6 Feb 2017 20:37:29 +0100 Subject: [PATCH] Add a workaround to save cookies on exit Fixes #2263 --- CHANGELOG.asciidoc | 2 ++ qutebrowser/browser/webengine/webenginesettings.py | 8 ++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index 27b68a318..cce6265ad 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -57,6 +57,8 @@ Fixed - Crash reports are now re-enabled when using QtWebEngine - Fixed crashes when closing tabs while hinting - Fixed starting on newer PyQt/sip versions with LibreSSL +- Worked around a Qt bug which caused cookies newer than 30s not to be saved on + exit with QtWebEngine. v0.9.1 ------ diff --git a/qutebrowser/browser/webengine/webenginesettings.py b/qutebrowser/browser/webengine/webenginesettings.py index 2be642b17..d76898378 100644 --- a/qutebrowser/browser/webengine/webenginesettings.py +++ b/qutebrowser/browser/webengine/webenginesettings.py @@ -26,6 +26,7 @@ Module attributes: import os +from PyQt5.QtNetwork import QNetworkCookie # pylint: disable=no-name-in-module,import-error,useless-suppression from PyQt5.QtWebEngineWidgets import (QWebEngineSettings, QWebEngineProfile, QWebEngineScript) @@ -171,8 +172,11 @@ def init(args): def shutdown(): - # FIXME:qtwebengine do we need to do something for a clean shutdown here? - pass + # WORKAROUND for https://bugreports.qt.io/browse/QTBUG-58675 + # This forces Chromium to flush its cookie store but doesn't actually + # delete anything. + cookie = QNetworkCookie() + QWebEngineProfile.defaultProfile().cookieStore().deleteCookie(cookie) # Missing QtWebEngine attributes: