From a790b1b5d9b18f385ebbdf84e5845a40b2089d5c Mon Sep 17 00:00:00 2001 From: Soren Stoutner Date: Mon, 11 Apr 2022 15:07:58 -0700 Subject: [PATCH] Use an off-the-record profile. https://redmine.stoutner.com/issues/825 --- src/views/BrowserView.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/views/BrowserView.cpp b/src/views/BrowserView.cpp index edcd26c..fb2473a 100644 --- a/src/views/BrowserView.cpp +++ b/src/views/BrowserView.cpp @@ -43,10 +43,17 @@ BrowserView::BrowserView(QWidget *parent) : QWidget(parent) // Get handles for the views. webEngineViewPointer = browserViewUi.webEngineView; + // Create an off-the-record profile (the default when no profile name is specified). + webEngineProfilePointer = new QWebEngineProfile(QStringLiteral("")); + + // Create a WebEngine page. + QWebEnginePage *webEnginePagePointer = new QWebEnginePage(webEngineProfilePointer); + + // Set the WebEngine page. + webEngineViewPointer->setPage(webEnginePagePointer); + // Get handles for the aspects of the WebEngine. - QWebEnginePage *webEnginePagePointer = webEngineViewPointer->page(); webEngineHistoryPointer = webEnginePagePointer->history(); - webEngineProfilePointer = webEnginePagePointer->profile(); webEngineSettingsPointer = webEngineViewPointer->settings(); // Update the URL line edit when the URL changes. @@ -75,9 +82,6 @@ BrowserView::BrowserView(QWidget *parent) : QWidget(parent) // Reapply the domain settings when the host changes. connect(urlRequestInterceptorPointer, SIGNAL(applyDomainSettings(QString)), this, SLOT(applyDomainSettingsWithoutReloading(QString))); - // Disable the cache. - webEngineProfilePointer->setHttpCacheType(QWebEngineProfile::NoCache); - // Don't allow JavaScript to open windows. webEngineSettingsPointer->setAttribute(QWebEngineSettings::JavascriptCanOpenWindows, false); -- 2.45.2