From ef163c836da400ba131a1525c296c2572deaa353 Mon Sep 17 00:00:00 2001 From: Oren Hurvitz Date: Fri, 26 Jul 2019 15:25:24 +0300 Subject: [PATCH] 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. --- libraries/ui/src/ui/types/FileTypeProfile.cpp | 3 +++ libraries/ui/src/ui/types/HFWebEngineProfile.cpp | 1 + 2 files changed, 4 insertions(+) diff --git a/libraries/ui/src/ui/types/FileTypeProfile.cpp b/libraries/ui/src/ui/types/FileTypeProfile.cpp index 073460903e..d8d977f00a 100644 --- a/libraries/ui/src/ui/types/FileTypeProfile.cpp +++ b/libraries/ui/src/ui/types/FileTypeProfile.cpp @@ -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); } diff --git a/libraries/ui/src/ui/types/HFWebEngineProfile.cpp b/libraries/ui/src/ui/types/HFWebEngineProfile.cpp index ef1d009f09..c2c1007527 100644 --- a/libraries/ui/src/ui/types/HFWebEngineProfile.cpp +++ b/libraries/ui/src/ui/types/HFWebEngineProfile.cpp @@ -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));