summaryrefslogtreecommitdiffstats
path: root/src/core/net
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/net')
-rw-r--r--src/core/net/cookie_monster_delegate_qt.cpp4
-rw-r--r--src/core/net/custom_url_loader_factory.cpp64
-rw-r--r--src/core/net/plugin_response_interceptor_url_loader_throttle.cpp1
-rw-r--r--src/core/net/proxy_config_service_qt.cpp4
-rw-r--r--src/core/net/proxying_restricted_cookie_manager_qt.cpp17
-rw-r--r--src/core/net/proxying_restricted_cookie_manager_qt.h14
-rw-r--r--src/core/net/proxying_url_loader_factory_qt.cpp46
-rw-r--r--src/core/net/proxying_url_loader_factory_qt.h1
-rw-r--r--src/core/net/ssl_host_state_delegate_qt.cpp6
-rw-r--r--src/core/net/ssl_host_state_delegate_qt.h6
-rw-r--r--src/core/net/url_request_custom_job_proxy.h6
11 files changed, 107 insertions, 62 deletions
diff --git a/src/core/net/cookie_monster_delegate_qt.cpp b/src/core/net/cookie_monster_delegate_qt.cpp
index 263973684..a7a3a9348 100644
--- a/src/core/net/cookie_monster_delegate_qt.cpp
+++ b/src/core/net/cookie_monster_delegate_qt.cpp
@@ -78,9 +78,9 @@ public:
CookieAccessFilter(CookieMonsterDelegateQt *delegate) : m_delegate(delegate) { }
~CookieAccessFilter() override = default;
- void AllowedAccess(const GURL& url, const GURL& site_for_cookies, AllowedAccessCallback callback) override
+ void AllowedAccess(const GURL &url, const net::SiteForCookies &site_for_cookies, AllowedAccessCallback callback) override
{
- bool allow = m_delegate->canGetCookies(toQt(site_for_cookies), toQt(url));
+ bool allow = m_delegate->canGetCookies(toQt(site_for_cookies.RepresentativeUrl()), toQt(url));
std::move(callback).Run(allow);
}
diff --git a/src/core/net/custom_url_loader_factory.cpp b/src/core/net/custom_url_loader_factory.cpp
index e5f580536..709e4451b 100644
--- a/src/core/net/custom_url_loader_factory.cpp
+++ b/src/core/net/custom_url_loader_factory.cpp
@@ -51,9 +51,10 @@
#include "net/base/net_errors.h"
#include "net/http/http_status_code.h"
#include "net/http/http_util.h"
-#include "services/network/public/cpp/resource_response.h"
+#include "services/network/public/cpp/cors/cors.h"
#include "services/network/public/mojom/url_loader.mojom.h"
#include "services/network/public/mojom/url_loader_factory.mojom.h"
+#include "services/network/public/mojom/url_response_head.mojom.h"
#include "api/qwebengineurlscheme.h"
#include "net/url_request_custom_job_proxy.h"
@@ -140,7 +141,19 @@ private:
void Start()
{
DCHECK(m_taskRunner->RunsTasksInCurrentSequence());
- m_head.request_start = base::TimeTicks::Now();
+
+ if (network::cors::IsCorsEnabledRequestMode(m_request.mode)) {
+ // CORS mode requires a valid request_initiator.
+ if (!m_request.request_initiator)
+ return CompleteWithFailure(net::ERR_INVALID_ARGUMENT);
+
+ // Custom schemes are not covered by CorsURLLoader, so we need to reject CORS requests manually.
+ if (!m_corsEnabled && !m_request.request_initiator->IsSameOriginWith(url::Origin::Create(m_request.url)))
+ return CompleteWithFailure(network::CorsErrorStatus(network::mojom::CorsError::kCorsDisabledScheme));
+ }
+
+ m_head = network::mojom::URLResponseHead::New();
+ m_head->request_start = base::TimeTicks::Now();
if (!m_pipe.consumer_handle.is_valid())
return CompleteWithFailure(net::ERR_FAILED);
@@ -162,6 +175,13 @@ private:
m_request.url, m_request.method, m_request.request_initiator, std::move(headers)));
}
+ void CompleteWithFailure(network::CorsErrorStatus cors_error)
+ {
+ DCHECK(m_taskRunner->RunsTasksInCurrentSequence());
+ m_client->OnComplete(network::URLLoaderCompletionStatus(cors_error));
+ ClearProxyAndClient(false);
+ }
+
void CompleteWithFailure(net::Error net_error)
{
DCHECK(m_taskRunner->RunsTasksInCurrentSequence());
@@ -184,7 +204,7 @@ private:
DCHECK(m_taskRunner->RunsTasksInCurrentSequence());
if (result == MOJO_RESULT_OK) {
network::URLLoaderCompletionStatus status(net::OK);
- status.encoded_data_length = m_totalBytesRead + m_head.headers->raw_headers().length();
+ status.encoded_data_length = m_totalBytesRead + m_headerBytesRead;
status.encoded_body_length = m_totalBytesRead;
status.decoded_body_length = m_totalBytesRead;
m_client->OnComplete(status);
@@ -219,17 +239,17 @@ private:
CompleteWithFailure(net::ERR_REQUEST_RANGE_NOT_SATISFIABLE);
} else {
m_maxBytesToRead = m_byteRange.last_byte_position() - m_byteRange.first_byte_position() + 1;
- m_head.content_length = m_maxBytesToRead;
+ m_head->content_length = m_maxBytesToRead;
}
} else {
- m_head.content_length = size;
+ m_head->content_length = size;
}
}
void notifyHeadersComplete() override
{
DCHECK(m_taskRunner->RunsTasksInCurrentSequence());
DCHECK(!m_error);
- m_head.response_start = base::TimeTicks::Now();
+ m_head->response_start = base::TimeTicks::Now();
std::string headers;
if (!m_redirect.is_empty()) {
@@ -262,11 +282,11 @@ private:
headers += "Access-Control-Allow-Credentials: true\n";
}
}
- m_head.headers = base::MakeRefCounted<net::HttpResponseHeaders>(net::HttpUtil::AssembleRawHeaders(headers));
- m_head.encoded_data_length = m_head.headers->raw_headers().length();
+ m_head->headers = base::MakeRefCounted<net::HttpResponseHeaders>(net::HttpUtil::AssembleRawHeaders(headers));
+ m_head->encoded_data_length = m_head->headers->raw_headers().length();
if (!m_redirect.is_empty()) {
- m_head.content_length = m_head.encoded_body_length = -1;
+ m_head->content_length = m_head->encoded_body_length = -1;
net::URLRequest::FirstPartyURLPolicy first_party_url_policy =
m_request.update_first_party_url_on_redirect ? net::URLRequest::UPDATE_FIRST_PARTY_URL_ON_REDIRECT
: net::URLRequest::NEVER_CHANGE_FIRST_PARTY_URL;
@@ -276,15 +296,18 @@ private:
first_party_url_policy, m_request.referrer_policy,
m_request.referrer.spec(), net::HTTP_SEE_OTHER,
m_redirect, base::nullopt, false /*insecure_scheme_was_upgraded*/);
- m_client->OnReceiveRedirect(redirectInfo, m_head);
+ m_client->OnReceiveRedirect(redirectInfo, std::move(m_head));
+ m_head = nullptr;
// ### should m_request be updated with RedirectInfo? (see FollowRedirect)
return;
}
DCHECK(m_device);
- m_head.mime_type = m_mimeType;
- m_head.charset = m_charset;
- m_client->OnReceiveResponse(m_head);
+ m_head->mime_type = m_mimeType;
+ m_head->charset = m_charset;
+ m_headerBytesRead = m_head->headers->raw_headers().length();
+ m_client->OnReceiveResponse(std::move(m_head));
m_client->OnStartLoadingResponseBody(std::move(m_pipe.consumer_handle));
+ m_head = nullptr;
if (readAvailableData()) // May delete this
return;
@@ -309,7 +332,7 @@ private:
void notifyStartFailure(int error) override
{
DCHECK(m_taskRunner->RunsTasksInCurrentSequence());
- m_head.response_start = base::TimeTicks::Now();
+ m_head->response_start = base::TimeTicks::Now();
std::string headers;
switch (error) {
case net::ERR_INVALID_URL:
@@ -331,10 +354,10 @@ private:
headers = "HTTP/1.1 500 Internal Error\n";
break;
}
- m_head.headers = base::MakeRefCounted<net::HttpResponseHeaders>(net::HttpUtil::AssembleRawHeaders(headers));
- m_head.encoded_data_length = m_head.headers->raw_headers().length();
- m_head.content_length = m_head.encoded_body_length = -1;
- m_client->OnReceiveResponse(m_head);
+ m_head->headers = base::MakeRefCounted<net::HttpResponseHeaders>(net::HttpUtil::AssembleRawHeaders(headers));
+ m_head->encoded_data_length = m_head->headers->raw_headers().length();
+ m_head->content_length = m_head->encoded_body_length = -1;
+ m_client->OnReceiveResponse(std::move(m_head));
CompleteWithFailure(net::Error(error));
}
void notifyReadyRead() override
@@ -404,7 +427,7 @@ private:
}
return false;
}
- base::TaskRunner *taskRunner() override
+ base::SequencedTaskRunner *taskRunner() override
{
DCHECK(m_taskRunner->RunsTasksInCurrentSequence());
return m_taskRunner.get();
@@ -422,7 +445,8 @@ private:
int64_t m_totalSize = 0;
int64_t m_maxBytesToRead = -1;
network::ResourceRequest m_request;
- network::ResourceResponseHead m_head;
+ network::mojom::URLResponseHeadPtr m_head;
+ qint64 m_headerBytesRead = 0;
qint64 m_totalBytesRead = 0;
bool m_corsEnabled;
diff --git a/src/core/net/plugin_response_interceptor_url_loader_throttle.cpp b/src/core/net/plugin_response_interceptor_url_loader_throttle.cpp
index e75900822..f6bddd7b2 100644
--- a/src/core/net/plugin_response_interceptor_url_loader_throttle.cpp
+++ b/src/core/net/plugin_response_interceptor_url_loader_throttle.cpp
@@ -46,7 +46,6 @@
#include "content/public/browser/download_manager.h"
#include "content/public/browser/download_request_utils.h"
#include "content/public/browser/download_utils.h"
-#include "content/public/common/resource_type.h"
#include "extensions/common/constants.h"
#include "extensions/common/extension.h"
diff --git a/src/core/net/proxy_config_service_qt.cpp b/src/core/net/proxy_config_service_qt.cpp
index 59884961d..bc934c960 100644
--- a/src/core/net/proxy_config_service_qt.cpp
+++ b/src/core/net/proxy_config_service_qt.cpp
@@ -48,7 +48,7 @@
#include "base/bind.h"
#include "components/proxy_config/pref_proxy_config_tracker_impl.h"
#include "content/public/browser/browser_thread.h"
-#include "net/proxy_resolution/proxy_resolution_service.h"
+#include "net/proxy_resolution/configured_proxy_resolution_service.h"
using content::BrowserThread;
@@ -72,7 +72,7 @@ net::ProxyServer ProxyConfigServiceQt::fromQNetworkProxy(const QNetworkProxy &qt
ProxyConfigServiceQt::ProxyConfigServiceQt(PrefService *prefService,
const scoped_refptr<base::SingleThreadTaskRunner> &taskRunner)
- : m_baseService(net::ProxyResolutionService::CreateSystemProxyConfigService(taskRunner))
+ : m_baseService(net::ConfiguredProxyResolutionService::CreateSystemProxyConfigService(taskRunner))
, m_usesSystemConfiguration(false)
, m_registeredObserver(false)
, m_prefState(prefService
diff --git a/src/core/net/proxying_restricted_cookie_manager_qt.cpp b/src/core/net/proxying_restricted_cookie_manager_qt.cpp
index 331b55e62..b0b46c817 100644
--- a/src/core/net/proxying_restricted_cookie_manager_qt.cpp
+++ b/src/core/net/proxying_restricted_cookie_manager_qt.cpp
@@ -116,7 +116,7 @@ ProxyingRestrictedCookieManagerQt::~ProxyingRestrictedCookieManagerQt()
}
void ProxyingRestrictedCookieManagerQt::GetAllForUrl(const GURL &url,
- const GURL &site_for_cookies,
+ const net::SiteForCookies &site_for_cookies,
const url::Origin &top_frame_origin,
network::mojom::CookieManagerGetOptionsPtr options,
GetAllForUrlCallback callback)
@@ -132,7 +132,8 @@ void ProxyingRestrictedCookieManagerQt::GetAllForUrl(const GURL &url,
void ProxyingRestrictedCookieManagerQt::SetCanonicalCookie(const net::CanonicalCookie &cookie,
const GURL &url,
- const GURL &site_for_cookies, const url::Origin &top_frame_origin,
+ const net::SiteForCookies &site_for_cookies,
+ const url::Origin &top_frame_origin,
SetCanonicalCookieCallback callback)
{
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
@@ -145,7 +146,7 @@ void ProxyingRestrictedCookieManagerQt::SetCanonicalCookie(const net::CanonicalC
}
void ProxyingRestrictedCookieManagerQt::AddChangeListener(const GURL &url,
- const GURL &site_for_cookies,
+ const net::SiteForCookies &site_for_cookies,
const url::Origin &top_frame_origin,
mojo::PendingRemote<network::mojom::CookieChangeListener> listener,
AddChangeListenerCallback callback)
@@ -155,7 +156,7 @@ void ProxyingRestrictedCookieManagerQt::AddChangeListener(const GURL &url,
}
void ProxyingRestrictedCookieManagerQt::SetCookieFromString(const GURL &url,
- const GURL &site_for_cookies,
+ const net::SiteForCookies &site_for_cookies,
const url::Origin &top_frame_origin,
const std::string &cookie,
SetCookieFromStringCallback callback)
@@ -170,7 +171,7 @@ void ProxyingRestrictedCookieManagerQt::SetCookieFromString(const GURL &url,
}
void ProxyingRestrictedCookieManagerQt::GetCookiesString(const GURL &url,
- const GURL &site_for_cookies,
+ const net::SiteForCookies &site_for_cookies,
const url::Origin &top_frame_origin,
GetCookiesStringCallback callback)
{
@@ -184,7 +185,7 @@ void ProxyingRestrictedCookieManagerQt::GetCookiesString(const GURL &url,
}
void ProxyingRestrictedCookieManagerQt::CookiesEnabledFor(const GURL &url,
- const GURL &site_for_cookies,
+ const net::SiteForCookies &site_for_cookies,
const url::Origin & /*top_frame_origin*/,
CookiesEnabledForCallback callback)
{
@@ -192,11 +193,11 @@ void ProxyingRestrictedCookieManagerQt::CookiesEnabledFor(const GURL &url,
std::move(callback).Run(allowCookies(url, site_for_cookies));
}
-bool ProxyingRestrictedCookieManagerQt::allowCookies(const GURL &url, const GURL &site_for_cookies) const
+bool ProxyingRestrictedCookieManagerQt::allowCookies(const GURL &url, const net::SiteForCookies &site_for_cookies) const
{
if (!m_profileIoData)
return false;
- return m_profileIoData->canGetCookies(toQt(site_for_cookies), toQt(url));
+ return m_profileIoData->canGetCookies(toQt(site_for_cookies.RepresentativeUrl()), toQt(url));
}
} // namespace QtWebEngineCore
diff --git a/src/core/net/proxying_restricted_cookie_manager_qt.h b/src/core/net/proxying_restricted_cookie_manager_qt.h
index b682075ed..3d4765b3b 100644
--- a/src/core/net/proxying_restricted_cookie_manager_qt.h
+++ b/src/core/net/proxying_restricted_cookie_manager_qt.h
@@ -65,36 +65,36 @@ public:
// network::mojom::RestrictedCookieManager interface:
void GetAllForUrl(const GURL &url,
- const GURL &site_for_cookies,
+ const net::SiteForCookies &site_for_cookies,
const url::Origin &top_frame_origin,
network::mojom::CookieManagerGetOptionsPtr options,
GetAllForUrlCallback callback) override;
void SetCanonicalCookie(const net::CanonicalCookie& cookie,
const GURL &url,
- const GURL &site_for_cookies,
+ const net::SiteForCookies &site_for_cookies,
const url::Origin &top_frame_origin,
SetCanonicalCookieCallback callback) override;
void AddChangeListener(const GURL &url,
- const GURL &site_for_cookies,
+ const net::SiteForCookies &site_for_cookies,
const url::Origin &top_frame_origin,
mojo::PendingRemote<network::mojom::CookieChangeListener> listener,
AddChangeListenerCallback callback) override;
void SetCookieFromString(const GURL &url,
- const GURL &site_for_cookies,
+ const net::SiteForCookies &site_for_cookies,
const url::Origin &top_frame_origin,
const std::string &cookie,
SetCookieFromStringCallback callback) override;
void GetCookiesString(const GURL &url,
- const GURL &site_for_cookies,
+ const net::SiteForCookies &site_for_cookies,
const url::Origin &top_frame_origin,
GetCookiesStringCallback callback) override;
void CookiesEnabledFor(const GURL &url,
- const GURL &site_for_cookies,
+ const net::SiteForCookies &site_for_cookies,
const url::Origin &top_frame_origin,
CookiesEnabledForCallback callback) override;
// Internal:
- bool allowCookies(const GURL &url, const GURL &site_for_cookies) const;
+ bool allowCookies(const GURL &url, const net::SiteForCookies &site_for_cookies) const;
private:
ProxyingRestrictedCookieManagerQt(base::WeakPtr<ProfileIODataQt> profileIoData,
diff --git a/src/core/net/proxying_url_loader_factory_qt.cpp b/src/core/net/proxying_url_loader_factory_qt.cpp
index b42aa64bb..d63659d2d 100644
--- a/src/core/net/proxying_url_loader_factory_qt.cpp
+++ b/src/core/net/proxying_url_loader_factory_qt.cpp
@@ -45,7 +45,6 @@
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
#include "base/task/post_task.h"
-#include "components/safe_browsing/common/safebrowsing_constants.h"
#include "content/browser/web_contents/web_contents_impl.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
@@ -73,11 +72,33 @@
namespace QtWebEngineCore {
+ASSERT_ENUMS_MATCH(QWebEngineUrlRequestInfo::ResourceTypeMainFrame, blink::mojom::ResourceType::kMainFrame)
+ASSERT_ENUMS_MATCH(QWebEngineUrlRequestInfo::ResourceTypeSubFrame, blink::mojom::ResourceType::kSubFrame)
+ASSERT_ENUMS_MATCH(QWebEngineUrlRequestInfo::ResourceTypeStylesheet, blink::mojom::ResourceType::kStylesheet)
+ASSERT_ENUMS_MATCH(QWebEngineUrlRequestInfo::ResourceTypeScript, blink::mojom::ResourceType::kScript)
+ASSERT_ENUMS_MATCH(QWebEngineUrlRequestInfo::ResourceTypeImage, blink::mojom::ResourceType::kImage)
+ASSERT_ENUMS_MATCH(QWebEngineUrlRequestInfo::ResourceTypeFontResource, blink::mojom::ResourceType::kFontResource)
+ASSERT_ENUMS_MATCH(QWebEngineUrlRequestInfo::ResourceTypeSubResource, blink::mojom::ResourceType::kSubResource)
+ASSERT_ENUMS_MATCH(QWebEngineUrlRequestInfo::ResourceTypeObject, blink::mojom::ResourceType::kObject)
+ASSERT_ENUMS_MATCH(QWebEngineUrlRequestInfo::ResourceTypeMedia, blink::mojom::ResourceType::kMedia)
+ASSERT_ENUMS_MATCH(QWebEngineUrlRequestInfo::ResourceTypeWorker, blink::mojom::ResourceType::kWorker)
+ASSERT_ENUMS_MATCH(QWebEngineUrlRequestInfo::ResourceTypeSharedWorker, blink::mojom::ResourceType::kSharedWorker)
+ASSERT_ENUMS_MATCH(QWebEngineUrlRequestInfo::ResourceTypePrefetch, blink::mojom::ResourceType::kPrefetch)
+ASSERT_ENUMS_MATCH(QWebEngineUrlRequestInfo::ResourceTypeFavicon, blink::mojom::ResourceType::kFavicon)
+ASSERT_ENUMS_MATCH(QWebEngineUrlRequestInfo::ResourceTypeXhr, blink::mojom::ResourceType::kXhr)
+ASSERT_ENUMS_MATCH(QWebEngineUrlRequestInfo::ResourceTypePing, blink::mojom::ResourceType::kPing)
+ASSERT_ENUMS_MATCH(QWebEngineUrlRequestInfo::ResourceTypeServiceWorker, blink::mojom::ResourceType::kServiceWorker)
+ASSERT_ENUMS_MATCH(QWebEngineUrlRequestInfo::ResourceTypeCspReport, blink::mojom::ResourceType::kCspReport)
+ASSERT_ENUMS_MATCH(QWebEngineUrlRequestInfo::ResourceTypePluginResource, blink::mojom::ResourceType::kPluginResource)
+ASSERT_ENUMS_MATCH(QWebEngineUrlRequestInfo::ResourceTypeNavigationPreloadMainFrame, blink::mojom::ResourceType::kNavigationPreloadMainFrame)
+ASSERT_ENUMS_MATCH(QWebEngineUrlRequestInfo::ResourceTypeNavigationPreloadSubFrame, blink::mojom::ResourceType::kNavigationPreloadSubFrame)
+ASSERT_ENUMS_MATCH(QWebEngineUrlRequestInfo::ResourceTypeLast, blink::mojom::ResourceType::kMaxValue)
+
extern WebContentsAdapterClient::NavigationType pageTransitionToNavigationType(ui::PageTransition transition);
-static QWebEngineUrlRequestInfo::ResourceType toQt(content::ResourceType resourceType)
+static QWebEngineUrlRequestInfo::ResourceType toQt(blink::mojom::ResourceType resourceType)
{
- if (resourceType >= content::ResourceType::kMainFrame && resourceType <= content::ResourceType::kMaxValue)
+ if (resourceType >= blink::mojom::ResourceType::kMinValue && resourceType <= blink::mojom::ResourceType::kMaxValue)
return static_cast<QWebEngineUrlRequestInfo::ResourceType>(resourceType);
return QWebEngineUrlRequestInfo::ResourceTypeUnknown;
}
@@ -151,7 +172,7 @@ private:
// error didn't occur.
int error_status_ = net::OK;
network::ResourceRequest request_;
- network::ResourceResponseHead current_response_;
+ network::mojom::URLResponseHeadPtr current_response_;
const net::MutableNetworkTrafficAnnotationTag traffic_annotation_;
@@ -189,6 +210,7 @@ InterceptedRequest::InterceptedRequest(int process_id, uint64_t request_id, int3
, target_factory_(std::move(target_factory))
, weak_factory_(this)
{
+ current_response_ = network::mojom::URLResponseHead::New();
// If there is a client error, clean up the request.
target_client_.set_disconnect_handler(
base::BindOnce(&InterceptedRequest::OnURLLoaderClientError, weak_factory_.GetWeakPtr()));
@@ -204,7 +226,7 @@ InterceptedRequest::~InterceptedRequest()
void InterceptedRequest::Restart()
{
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
- content::ResourceType resourceType = content::ResourceType(request_.resource_type);
+ blink::mojom::ResourceType resourceType = blink::mojom::ResourceType(request_.resource_type);
WebContentsAdapterClient::NavigationType navigationType =
pageTransitionToNavigationType(ui::PageTransition(request_.transition_type));
@@ -219,12 +241,12 @@ void InterceptedRequest::Restart()
webContents = content::WebContents::FromFrameTreeNodeId(request_.render_frame_id);
}
- GURL top_document_url = webContents ? webContents->GetLastCommittedURL() : GURL();
+ GURL top_document_url = webContents ? webContents->GetVisibleURL() : GURL();
QUrl firstPartyUrl;
if (!top_document_url.is_empty())
firstPartyUrl = toQt(top_document_url);
else
- firstPartyUrl = toQt(request_.site_for_cookies); // m_topDocumentUrl can be empty for the main-frame.
+ firstPartyUrl = toQt(request_.site_for_cookies.RepresentativeUrl()); // m_topDocumentUrl can be empty for the main-frame.
QWebEngineUrlRequestInfoPrivate *infoPrivate =
new QWebEngineUrlRequestInfoPrivate(toQt(resourceType), toQt(navigationType), originalUrl, firstPartyUrl,
@@ -258,7 +280,7 @@ void InterceptedRequest::InterceptOnIOThread(base::WaitableEvent *event)
void InterceptedRequest::InterceptOnUIThread()
{
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
- if (profile_request_interceptor_)
+ if (profile_request_interceptor_ && !profile_request_interceptor_->property("deprecated").toBool())
profile_request_interceptor_->interceptRequest(request_info_);
if (!request_info_.changed() && page_request_interceptor_)
@@ -283,7 +305,7 @@ void InterceptedRequest::ContinueAfterIntercept()
false /*insecure_scheme_was_upgraded*/);
// FIXME: Should probably create a new header.
- current_response_.encoded_data_length = 0;
+ current_response_->encoded_data_length = 0;
request_.method = redirectInfo.new_method;
request_.url = redirectInfo.new_url;
request_.site_for_cookies = redirectInfo.new_site_for_cookies;
@@ -291,7 +313,7 @@ void InterceptedRequest::ContinueAfterIntercept()
request_.referrer_policy = redirectInfo.new_referrer_policy;
if (request_.method == net::HttpRequestHeaders::kGetMethod)
request_.request_body = nullptr;
- target_client_->OnReceiveRedirect(redirectInfo, current_response_);
+ target_client_->OnReceiveRedirect(redirectInfo, std::move(current_response_));
return;
}
@@ -319,7 +341,7 @@ void InterceptedRequest::ContinueAfterIntercept()
void InterceptedRequest::OnReceiveResponse(network::mojom::URLResponseHeadPtr head)
{
- current_response_ = head;
+ current_response_ = head.Clone();
target_client_->OnReceiveResponse(std::move(head));
}
@@ -328,7 +350,7 @@ void InterceptedRequest::OnReceiveRedirect(const net::RedirectInfo &redirect_inf
{
// TODO(timvolodine): handle redirect override.
request_was_redirected_ = true;
- current_response_ = head;
+ current_response_ = head.Clone();
target_client_->OnReceiveRedirect(redirect_info, std::move(head));
request_.url = redirect_info.new_url;
request_.method = redirect_info.new_method;
diff --git a/src/core/net/proxying_url_loader_factory_qt.h b/src/core/net/proxying_url_loader_factory_qt.h
index 3d77856cc..e1bcc276c 100644
--- a/src/core/net/proxying_url_loader_factory_qt.h
+++ b/src/core/net/proxying_url_loader_factory_qt.h
@@ -49,7 +49,6 @@
#include "mojo/public/cpp/bindings/receiver_set.h"
#include "net/traffic_annotation/network_traffic_annotation.h"
#include "services/network/public/cpp/resource_request.h"
-#include "services/network/public/cpp/resource_response.h"
#include "services/network/public/mojom/url_loader.mojom.h"
#include "services/network/public/mojom/url_loader_factory.mojom.h"
#include "url/gurl.h"
diff --git a/src/core/net/ssl_host_state_delegate_qt.cpp b/src/core/net/ssl_host_state_delegate_qt.cpp
index 3f3f95c83..3390c092a 100644
--- a/src/core/net/ssl_host_state_delegate_qt.cpp
+++ b/src/core/net/ssl_host_state_delegate_qt.cpp
@@ -77,7 +77,7 @@ SSLHostStateDelegateQt::SSLHostStateDelegateQt() {}
SSLHostStateDelegateQt::~SSLHostStateDelegateQt() {}
-void SSLHostStateDelegateQt::AllowCert(const std::string &host, const net::X509Certificate &cert, int error)
+void SSLHostStateDelegateQt::AllowCert(const std::string &host, const net::X509Certificate &cert, int error, content::WebContents *)
{
m_certPolicyforHost[host].Allow(cert, error);
}
@@ -105,7 +105,7 @@ void SSLHostStateDelegateQt::Clear(base::RepeatingCallback<bool(const std::strin
// prior to this query, otherwise false.
content::SSLHostStateDelegate::CertJudgment SSLHostStateDelegateQt::QueryPolicy(const std::string &host,
const net::X509Certificate &cert,
- int error)
+ int error, content::WebContents *)
{
return m_certPolicyforHost[host].Check(cert, error) ? SSLHostStateDelegate::ALLOWED : SSLHostStateDelegate::DENIED;
}
@@ -132,7 +132,7 @@ void SSLHostStateDelegateQt::RevokeUserAllowExceptions(const std::string &host)
// |host|. This does not mean that *all* certificate errors are allowed, just
// that there exists an exception. To see if a particular certificate and
// error combination exception is allowed, use QueryPolicy().
-bool SSLHostStateDelegateQt::HasAllowException(const std::string &host)
+bool SSLHostStateDelegateQt::HasAllowException(const std::string &host, content::WebContents *)
{
auto policy_iterator = m_certPolicyforHost.find(host);
return policy_iterator != m_certPolicyforHost.end() &&
diff --git a/src/core/net/ssl_host_state_delegate_qt.h b/src/core/net/ssl_host_state_delegate_qt.h
index 26e503eb5..6b407353a 100644
--- a/src/core/net/ssl_host_state_delegate_qt.h
+++ b/src/core/net/ssl_host_state_delegate_qt.h
@@ -66,13 +66,13 @@ public:
~SSLHostStateDelegateQt();
// content::SSLHostStateDelegate implementation:
- void AllowCert(const std::string &, const net::X509Certificate &cert, int error) override;
+ void AllowCert(const std::string &, const net::X509Certificate &cert, int error, content::WebContents *web_contents) override;
void Clear(base::RepeatingCallback<bool(const std::string&)> host_filter) override;
- CertJudgment QueryPolicy(const std::string &host, const net::X509Certificate &cert, int error) override;
+ CertJudgment QueryPolicy(const std::string &host, const net::X509Certificate &cert, int error, content::WebContents *web_contents) override;
void HostRanInsecureContent(const std::string &host, int child_id, InsecureContentType content_type) override;
bool DidHostRunInsecureContent(const std::string &host, int child_id, InsecureContentType content_type) override;
void RevokeUserAllowExceptions(const std::string &host) override;
- bool HasAllowException(const std::string &host) override;
+ bool HasAllowException(const std::string &host, content::WebContents *web_contents) override;
private:
std::map<std::string, CertPolicy> m_certPolicyforHost;
diff --git a/src/core/net/url_request_custom_job_proxy.h b/src/core/net/url_request_custom_job_proxy.h
index db38083dd..b14322f91 100644
--- a/src/core/net/url_request_custom_job_proxy.h
+++ b/src/core/net/url_request_custom_job_proxy.h
@@ -42,7 +42,7 @@
#include "base/memory/weak_ptr.h"
#include "base/optional.h"
-#include "base/task_runner.h"
+#include "base/sequenced_task_runner.h"
#include "url/gurl.h"
#include "url/origin.h"
#include <QtCore/QPointer>
@@ -75,7 +75,7 @@ public:
virtual void notifyAborted() = 0;
virtual void notifyStartFailure(int) = 0;
virtual void notifyReadyRead() = 0;
- virtual base::TaskRunner *taskRunner() = 0;
+ virtual base::SequencedTaskRunner *taskRunner() = 0;
};
URLRequestCustomJobProxy(Client *client,
@@ -101,7 +101,7 @@ public:
std::string m_scheme;
URLRequestCustomJobDelegate *m_delegate;
QPointer<ProfileAdapter> m_profileAdapter;
- scoped_refptr<base::TaskRunner> m_ioTaskRunner;
+ scoped_refptr<base::SequencedTaskRunner> m_ioTaskRunner;
};
} // namespace QtWebEngineCore