summaryrefslogtreecommitdiffstats
path: root/src/core/content_browser_client_qt.cpp
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2021-02-18 11:47:24 +0100
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2021-02-18 18:04:30 +0100
commit0b5f110234256eabaa264189d9117069f2a2d144 (patch)
treea3b15d3ac8361d4d0418b2b025e5ad68320a4bb5 /src/core/content_browser_client_qt.cpp
parent50524f176b6ecd812f413f85703c7f410c7e71a3 (diff)
Avoid accessing profileAdapter when profile is shutting down
Pick-to: 5.15.3 Task-number: QTBUG-91187 Change-Id: Icaef781025791a94c0e5dd85039c33b8ae45de99 Reviewed-by: Michal Klocek <michal.klocek@qt.io>
Diffstat (limited to 'src/core/content_browser_client_qt.cpp')
-rw-r--r--src/core/content_browser_client_qt.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/core/content_browser_client_qt.cpp b/src/core/content_browser_client_qt.cpp
index fbc57999e..690c4f43e 100644
--- a/src/core/content_browser_client_qt.cpp
+++ b/src/core/content_browser_client_qt.cpp
@@ -780,6 +780,8 @@ bool ContentBrowserClientQt::AllowAppCache(const GURL &manifest_url,
content::BrowserContext *context)
{
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
+ if (!context || context->ShutdownStarted())
+ return false;
return static_cast<ProfileQt *>(context)->profileAdapter()->cookieStore()->d_func()->canAccessCookies(toQt(first_party), toQt(manifest_url));
}
@@ -806,6 +808,8 @@ ContentBrowserClientQt::AllowServiceWorkerOnUI(const GURL &scope,
content::BrowserContext *context)
{
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
+ if (!context || context->ShutdownStarted())
+ return content::AllowServiceWorkerResult::No();
// FIXME: Chrome also checks if javascript is enabled here to check if has been disabled since the service worker
// was started.
return static_cast<ProfileQt *>(context)->profileAdapter()->cookieStore()->d_func()->canAccessCookies(toQt(site_for_cookies), toQt(scope))
@@ -820,6 +824,8 @@ void ContentBrowserClientQt::AllowWorkerFileSystem(const GURL &url,
base::OnceCallback<void(bool)> callback)
{
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
+ if (!context || context->ShutdownStarted())
+ return std::move(callback).Run(false);
std::move(callback).Run(
static_cast<ProfileQt *>(context)->profileAdapter()->cookieStore()->d_func()->canAccessCookies(toQt(url), toQt(url)));
}
@@ -830,6 +836,8 @@ bool ContentBrowserClientQt::AllowWorkerIndexedDB(const GURL &url,
const std::vector<content::GlobalFrameRoutingId> &/*render_frames*/)
{
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
+ if (!context || context->ShutdownStarted())
+ return false;
return static_cast<ProfileQt *>(context)->profileAdapter()->cookieStore()->d_func()->canAccessCookies(toQt(url), toQt(url));
}