From 67e6b9e679856975161e85ee8011fac94b59bb22 Mon Sep 17 00:00:00 2001 From: Peter Varga Date: Tue, 17 Jul 2018 16:43:14 +0200 Subject: Update user dir associated to BrowserContext when chaging profile's path Otherwise, setting a WebEngineProfile to non-off-the-record would assert. Therefore, now it is safe to set the quicknanobrowser's defaultProfile to non-off-the-record. Task-number: QTBUG-69416 Change-Id: I5ca2230e12e457dd9963e386708f2394ae4c8cea Reviewed-by: Michal Klocek --- examples/webengine/quicknanobrowser/ApplicationRoot.qml | 1 + src/core/profile_io_data_qt.cpp | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/examples/webengine/quicknanobrowser/ApplicationRoot.qml b/examples/webengine/quicknanobrowser/ApplicationRoot.qml index 014b556a1..67b686541 100644 --- a/examples/webengine/quicknanobrowser/ApplicationRoot.qml +++ b/examples/webengine/quicknanobrowser/ApplicationRoot.qml @@ -56,6 +56,7 @@ QtObject { property QtObject defaultProfile: WebEngineProfile { storageName: "Profile" + offTheRecord: false } property QtObject otrProfile: WebEngineProfile { diff --git a/src/core/profile_io_data_qt.cpp b/src/core/profile_io_data_qt.cpp index a011c2b81..547527e1f 100644 --- a/src/core/profile_io_data_qt.cpp +++ b/src/core/profile_io_data_qt.cpp @@ -70,6 +70,7 @@ #include "net/url_request/url_request_context_storage.h" #include "net/url_request/url_request_job_factory_impl.h" #include "net/url_request/url_request_intercepting_job_factory.h" +#include "services/file/user_id_map.h" #include "services/network/proxy_service_mojo.h" #include "net/cookie_monster_delegate_qt.h" @@ -566,6 +567,12 @@ void ProfileIODataQt::updateStorageSettings() QMutexLocker lock(&m_mutex); setFullConfiguration(); + std::string userId = content::BrowserContext::GetServiceUserIdFor(m_profile); + if (file::GetUserDirForUserId(userId) != toFilePath(m_profileAdapter->dataPath())) { + file::ForgetServiceUserIdUserDirAssociation(userId); + file::AssociateServiceUserIdWithUserDir(userId, toFilePath(m_profileAdapter->dataPath())); + } + if (!m_updateAllStorage) { m_updateAllStorage = true; // We must create the proxy config service on the UI loop on Linux because it -- cgit v1.2.3