Enable QtWebEngine to store its cache on disk

In the past, QtWebEngine stored the cache on disk automatically. But apparently due to a recent
change to Qt, this has changed: a Web Engine Profile that is constructed without a Storage Name is placed
in "Off the Record" mode, which means that the cache is stored only in memory. Therefore, we must assign
a Storage Name and disable "Off the Record" mode.
This commit is contained in:
Oren Hurvitz 2019-07-26 15:25:24 +03:00
parent dbd9299e85
commit ef163c836d
2 changed files with 4 additions and 0 deletions

View file

@ -24,6 +24,9 @@ FileTypeProfile::FileTypeProfile(QQmlContext* parent) :
static const QString WEB_ENGINE_USER_AGENT = "Chrome/48.0 (HighFidelityInterface)";
setHttpUserAgent(WEB_ENGINE_USER_AGENT);
setStorageName(QML_WEB_ENGINE_STORAGE_NAME);
setOffTheRecord(false);
auto requestInterceptor = new RequestInterceptor(this);
setRequestInterceptor(requestInterceptor);
}

View file

@ -22,6 +22,7 @@ static const QString QML_WEB_ENGINE_STORAGE_NAME = "qmlWebEngine";
HFWebEngineProfile::HFWebEngineProfile(QQmlContext* parent) : Parent(parent)
{
setStorageName(QML_WEB_ENGINE_STORAGE_NAME);
setOffTheRecord(false);
// we use the HFWebEngineRequestInterceptor to make sure that web requests are authenticated for the interface user
setRequestInterceptor(new RequestInterceptor(this));