summaryrefslogtreecommitdiffstats
path: root/src/core/net/url_request_notification.cpp
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2019-11-25 09:47:18 +0100
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2019-11-25 09:47:18 +0100
commitcda76002257d56ffedbf8d28211cfd66a7226e73 (patch)
tree03e8a7fcdfa389771d6ade5afbe5d2536328eef2 /src/core/net/url_request_notification.cpp
parentb97f0eb87b6e6a6726b805c9de2159c6ad983f7d (diff)
parent631f1dd72027207cf6c49a380671c58f096a37a5 (diff)
Merge remote-tracking branch 'origin/5.15' into dev
Conflicts: src/core/api/qtbug-60565.cpp Change-Id: Iaad05aa248fb57a69033013161e10e3acddd48f6
Diffstat (limited to 'src/core/net/url_request_notification.cpp')
-rw-r--r--src/core/net/url_request_notification.cpp21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/core/net/url_request_notification.cpp b/src/core/net/url_request_notification.cpp
index e37ad35bc..fa6d61f65 100644
--- a/src/core/net/url_request_notification.cpp
+++ b/src/core/net/url_request_notification.cpp
@@ -53,11 +53,13 @@
namespace QtWebEngineCore {
// Calls cancel() when the URLRequest is destroyed.
-class UserData : public base::SupportsUserData::Data {
+class UserData : public base::SupportsUserData::Data
+{
public:
UserData(URLRequestNotification *ptr) : m_ptr(ptr) {}
~UserData() { m_ptr->cancel(); }
static const char key[];
+
private:
URLRequestNotification *m_ptr;
};
@@ -69,13 +71,10 @@ static content::ResourceType fromQt(QWebEngineUrlRequestInfo::ResourceType resou
return static_cast<content::ResourceType>(resourceType);
}
-URLRequestNotification::URLRequestNotification(net::URLRequest *request,
- bool isMainFrameRequest,
- GURL *newUrl,
- QWebEngineUrlRequestInfo &&requestInfo,
- content::ResourceRequestInfo::WebContentsGetter webContentsGetter,
- net::CompletionOnceCallback callback,
- QPointer<ProfileAdapter> adapter)
+URLRequestNotification::URLRequestNotification(net::URLRequest *request, bool isMainFrameRequest, GURL *newUrl,
+ QWebEngineUrlRequestInfo &&requestInfo,
+ content::ResourceRequestInfo::WebContentsGetter webContentsGetter,
+ net::CompletionOnceCallback callback, QPointer<ProfileAdapter> adapter)
: m_request(request)
, m_isMainFrameRequest(isMainFrameRequest)
, m_newUrl(newUrl)
@@ -107,8 +106,8 @@ void URLRequestNotification::notify()
if (webContents) {
- if (m_profileAdapter) {
- QWebEngineUrlRequestInterceptor* interceptor = m_profileAdapter->requestInterceptor();
+ if (m_profileAdapter && m_profileAdapter->requestInterceptor()) {
+ QWebEngineUrlRequestInterceptor *interceptor = m_profileAdapter->requestInterceptor();
if (!interceptor->property("deprecated").toBool())
interceptor->interceptRequest(m_requestInfo);
}
@@ -152,7 +151,7 @@ void URLRequestNotification::notify()
base::BindOnce(&URLRequestNotification::complete, base::Unretained(this), result));
}
-void URLRequestNotification::cancel()
+void URLRequestNotification::cancel()
{
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);