Update to Chromium version 81.0.4044.0 (#737173)

This commit is contained in:
Marshall Greenblatt
2020-03-03 19:29:39 -05:00
parent a22b670a00
commit 9d9ee8b45f
135 changed files with 2602 additions and 1329 deletions

View File

@ -114,7 +114,7 @@ IPC_STRUCT_BEGIN(CefMsg_LoadRequest_Params)
// lead to undesired cookie blocking. Third-party cookie blocking can be
// bypassed by setting site_for_cookies = url, but this should ideally
// only be done if there really is no way to determine the correct value.
IPC_STRUCT_MEMBER(GURL, site_for_cookies)
IPC_STRUCT_MEMBER(net::SiteForCookies, site_for_cookies)
// Additional HTTP request headers.
IPC_STRUCT_MEMBER(std::string, headers)

View File

@ -23,6 +23,7 @@
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/path_service.h"
#include "base/run_loop.h"
#include "base/stl_util.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"

View File

@ -21,7 +21,6 @@
#include "net/url_request/redirect_util.h"
#include "net/url_request/url_request.h"
#include "services/network/public/cpp/resource_request.h"
#include "services/network/public/cpp/resource_response.h"
namespace net_service {
@ -91,7 +90,7 @@ std::string MakeContentTypeValue(const std::string& mime_type,
return value;
}
net::HttpResponseHeaders* MakeResponseHeaders(
scoped_refptr<net::HttpResponseHeaders> MakeResponseHeaders(
int status_code,
const std::string& status_text,
const std::string& mime_type,
@ -102,8 +101,8 @@ net::HttpResponseHeaders* MakeResponseHeaders(
if (status_code <= 0)
status_code = 200;
auto headers = new net::HttpResponseHeaders(
MakeStatusLine(status_code, status_text, false));
auto headers = WrapRefCounted(new net::HttpResponseHeaders(
MakeStatusLine(status_code, status_text, false)));
// Track the headers that have already been set. Perform all comparisons in
// lowercase.
@ -171,8 +170,8 @@ net::RedirectInfo MakeRedirectInfo(const network::ResourceRequest& request,
: net::URLRequest::NEVER_CHANGE_FIRST_PARTY_URL;
return net::RedirectInfo::ComputeRedirectInfo(
request.method, request.url, request.site_for_cookies,
first_party_url_policy, request.referrer_policy,
request.referrer.spec(), status_code, location,
first_party_url_policy, request.referrer_policy, request.referrer.spec(),
status_code, location,
net::RedirectUtil::GetReferrerPolicyHeader(headers),
insecure_scheme_was_upgraded);
}

View File

@ -10,6 +10,8 @@
#include "include/internal/cef_types_wrappers.h"
#include "base/memory/scoped_refptr.h"
namespace net {
class CanonicalCookie;
class HttpResponseHeaders;
@ -18,7 +20,6 @@ struct RedirectInfo;
namespace network {
struct ResourceRequest;
struct ResourceResponseHead;
} // namespace network
class GURL;
@ -48,7 +49,7 @@ std::string MakeContentTypeValue(const std::string& mime_type,
const std::string& charset);
// Make a new HttpResponseHeaders object.
net::HttpResponseHeaders* MakeResponseHeaders(
scoped_refptr<net::HttpResponseHeaders> MakeResponseHeaders(
int status_code,
const std::string& status_text,
const std::string& mime_type,

View File

@ -102,8 +102,7 @@ CefString CefBase64Encode(const void* data, size_t data_size) {
if (data_size == 0)
return CefString();
base::StringPiece input;
input.set(static_cast<const char*>(data), data_size);
base::StringPiece input(static_cast<const char*>(data), data_size);
std::string output;
base::Base64Encode(input, &output);
return output;

View File

@ -299,13 +299,17 @@ void CefRequestImpl::SetReferrer(const CefString& referrer_url,
base::AutoLock lock_scope(lock_);
CHECK_READONLY_RETURN_VOID();
// Call GetAsReferrer here for consistency since the same logic will later be
// applied by URLRequest::SetReferrer().
const GURL& new_referrer_url = GURL(referrer_url.ToString()).GetAsReferrer();
if (referrer_url_ != new_referrer_url || referrer_policy_ != policy) {
const auto& sanitized_referrer = content::Referrer::SanitizeForRequest(
url_, content::Referrer(GURL(referrer_url.ToString()),
NetReferrerPolicyToBlinkReferrerPolicy(policy)));
const auto sanitized_policy =
BlinkReferrerPolicyToNetReferrerPolicy(sanitized_referrer.policy);
if (referrer_url_ != sanitized_referrer.url ||
referrer_policy_ != sanitized_policy) {
Changed(kChangedReferrer);
referrer_url_ = new_referrer_url;
referrer_policy_ = policy;
referrer_url_ = sanitized_referrer.url;
referrer_policy_ = sanitized_policy;
}
}
@ -425,16 +429,16 @@ void CefRequestImpl::SetFlags(int flags) {
CefString CefRequestImpl::GetFirstPartyForCookies() {
base::AutoLock lock_scope(lock_);
return first_party_for_cookies_.spec();
return site_for_cookies_.RepresentativeUrl().spec();
}
void CefRequestImpl::SetFirstPartyForCookies(const CefString& url) {
base::AutoLock lock_scope(lock_);
CHECK_READONLY_RETURN_VOID();
const GURL& new_url = GURL(url.ToString());
if (first_party_for_cookies_ != new_url) {
Changed(kChangedFirstPartyForCookies);
first_party_for_cookies_ = new_url;
auto new_site = net::SiteForCookies::FromUrl(GURL(url.ToString()));
if (!new_site.IsEquivalent(site_for_cookies_)) {
Changed(kChangedSiteForCookies);
site_for_cookies_ = new_site;
}
}
@ -464,12 +468,16 @@ void CefRequestImpl::Set(const network::ResourceRequest* request,
method_ = request->method;
identifier_ = identifier;
// Our consumer should have made sure that this is a safe referrer. See for
// instance WebCore::FrameLoader::HideReferrer.
if (request->referrer.is_valid()) {
referrer_url_ = request->referrer;
const auto& sanitized_referrer = content::Referrer::SanitizeForRequest(
request->url,
content::Referrer(
request->referrer,
NetReferrerPolicyToBlinkReferrerPolicy(
static_cast<cef_referrer_policy_t>(request->referrer_policy))));
referrer_url_ = sanitized_referrer.url;
referrer_policy_ =
static_cast<cef_referrer_policy_t>(request->referrer_policy);
BlinkReferrerPolicyToNetReferrerPolicy(sanitized_referrer.policy);
}
// Transfer request headers.
@ -481,7 +489,7 @@ void CefRequestImpl::Set(const network::ResourceRequest* request,
static_cast<CefPostDataImpl*>(postdata_.get())->Set(*request->request_body);
}
first_party_for_cookies_ = request->site_for_cookies;
site_for_cookies_ = request->site_for_cookies;
resource_type_ = static_cast<cef_resource_type_t>(request->resource_type);
transition_type_ =
@ -519,9 +527,9 @@ void CefRequestImpl::Get(network::ResourceRequest* request,
}
}
if (!first_party_for_cookies_.is_empty() &&
ShouldSet(kChangedFirstPartyForCookies, changed_only)) {
request->site_for_cookies = first_party_for_cookies_;
if (!site_for_cookies_.IsNull() &&
ShouldSet(kChangedSiteForCookies, changed_only)) {
request->site_for_cookies = site_for_cookies_;
}
if (ShouldSet(kChangedFlags, changed_only)) {
@ -560,10 +568,17 @@ void CefRequestImpl::Set(const net::RedirectInfo& redirect_info) {
url_ = redirect_info.new_url;
method_ = redirect_info.new_method;
first_party_for_cookies_ = redirect_info.new_site_for_cookies;
referrer_url_ = GURL(redirect_info.new_referrer);
site_for_cookies_ = redirect_info.new_site_for_cookies;
const auto& sanitized_referrer = content::Referrer::SanitizeForRequest(
redirect_info.new_url,
content::Referrer(GURL(redirect_info.new_referrer),
NetReferrerPolicyToBlinkReferrerPolicy(
static_cast<cef_referrer_policy_t>(
redirect_info.new_referrer_policy))));
referrer_url_ = sanitized_referrer.url;
referrer_policy_ =
static_cast<cef_referrer_policy_t>(redirect_info.new_referrer_policy);
BlinkReferrerPolicyToNetReferrerPolicy(sanitized_referrer.policy);
}
void CefRequestImpl::Set(const net::HttpRequestHeaders& headers) {
@ -584,7 +599,7 @@ void CefRequestImpl::Set(
url_ = params.url();
method_ = params.is_post() ? "POST" : "GET";
const content::Referrer& sanitized_referrer =
const auto& sanitized_referrer =
content::Referrer::SanitizeForRequest(params.url(), params.referrer());
referrer_url_ = sanitized_referrer.url;
referrer_policy_ =
@ -609,8 +624,9 @@ void CefRequestImpl::Get(blink::WebURLRequest& request,
NetReferrerPolicyToBlinkReferrerPolicy(referrer_policy_), url_,
blink::WebString::FromUTF8(referrer_url_.spec()));
if (!referrer.IsEmpty()) {
request.SetHttpReferrer(
referrer, NetReferrerPolicyToBlinkReferrerPolicy(referrer_policy_));
request.SetReferrerString(referrer);
request.SetReferrerPolicy(
NetReferrerPolicyToBlinkReferrerPolicy(referrer_policy_));
}
}
@ -634,8 +650,8 @@ void CefRequestImpl::Get(blink::WebURLRequest& request,
::SetHeaderMap(headermap_, request);
if (!first_party_for_cookies_.is_empty())
request.SetSiteForCookies(first_party_for_cookies_);
if (!site_for_cookies_.IsNull())
request.SetSiteForCookies(site_for_cookies_);
int flags = flags_;
if (!(flags & kURCachePolicyMask)) {
@ -666,10 +682,9 @@ void CefRequestImpl::Get(const CefMsg_LoadRequest_Params& params,
static_cast<cef_referrer_policy_t>(params.referrer_policy)),
params.url, blink::WebString::FromUTF8(params.referrer.spec()));
if (!referrer.IsEmpty()) {
request.SetHttpReferrer(
referrer,
NetReferrerPolicyToBlinkReferrerPolicy(
static_cast<cef_referrer_policy_t>(params.referrer_policy)));
request.SetReferrerString(referrer);
request.SetReferrerPolicy(NetReferrerPolicyToBlinkReferrerPolicy(
static_cast<cef_referrer_policy_t>(params.referrer_policy)));
}
}
@ -711,8 +726,10 @@ void CefRequestImpl::Get(const CefMsg_LoadRequest_Params& params,
data.Assign(element->bytes(), element->bytes_length());
body.AppendData(data);
} else if (element->type() == net::UploadElement::TYPE_FILE) {
body.AppendFile(
FilePathStringToWebString(element->file_path().value()));
body.AppendFileRange(
FilePathStringToWebString(element->file_path().value()),
element->file_range_offset(), element->file_range_length(),
element->expected_file_modification_time());
} else {
NOTREACHED();
}
@ -721,7 +738,7 @@ void CefRequestImpl::Get(const CefMsg_LoadRequest_Params& params,
request.SetHttpBody(body);
}
if (params.site_for_cookies.is_valid())
if (!params.site_for_cookies.IsNull())
request.SetSiteForCookies(params.site_for_cookies);
int flags = params.load_flags;
@ -758,7 +775,7 @@ void CefRequestImpl::Get(CefNavigateParams& params) const {
impl->Get(*params.upload_data.get());
}
params.site_for_cookies = first_party_for_cookies_;
params.site_for_cookies = site_for_cookies_;
params.load_flags = flags_;
}
@ -817,8 +834,8 @@ void CefRequestImpl::RevertChanges() {
}
if (backup_->backups_ & kChangedFlags)
flags_ = backup_->flags_;
if (backup_->backups_ & kChangedFirstPartyForCookies)
first_party_for_cookies_ = backup_->first_party_for_cookies_;
if (backup_->backups_ & kChangedSiteForCookies)
site_for_cookies_ = backup_->site_for_cookies_;
backup_.reset();
}
@ -938,10 +955,10 @@ void CefRequestImpl::Changed(uint8_t changes) {
backup_->flags_ = flags_;
backup_->backups_ |= kChangedFlags;
}
if ((changes & kChangedFirstPartyForCookies) &&
!(backup_->backups_ & kChangedFirstPartyForCookies)) {
backup_->first_party_for_cookies_ = first_party_for_cookies_;
backup_->backups_ |= kChangedFirstPartyForCookies;
if ((changes & kChangedSiteForCookies) &&
!(backup_->backups_ & kChangedSiteForCookies)) {
backup_->site_for_cookies_ = site_for_cookies_;
backup_->backups_ |= kChangedSiteForCookies;
}
}
@ -988,7 +1005,7 @@ void CefRequestImpl::Reset() {
transition_type_ = TT_EXPLICIT;
identifier_ = 0U;
flags_ = UR_FLAG_NONE;
first_party_for_cookies_ = GURL();
site_for_cookies_ = net::SiteForCookies();
changes_ = kChangedNone;
}
@ -1193,7 +1210,8 @@ void CefPostDataImpl::Get(blink::WebHTTPBody& data) const {
if (element.type == blink::WebHTTPBody::Element::kTypeData) {
data.AppendData(element.data);
} else if (element.type == blink::WebHTTPBody::Element::kTypeFile) {
data.AppendFile(element.file_path);
data.AppendFileRange(element.file_path, element.file_start,
element.file_length, element.modification_time);
} else {
NOTREACHED();
}

View File

@ -13,6 +13,7 @@
#include "include/cef_request.h"
#include "base/synchronization/lock.h"
#include "net/cookies/site_for_cookies.h"
#include "services/network/public/mojom/referrer_policy.mojom-shared.h"
#include "third_party/blink/public/platform/web_http_body.h"
#include "url/gurl.h"
@ -54,7 +55,7 @@ class CefRequestImpl : public CefRequest {
kChangedPostData = 1 << 3,
kChangedHeaderMap = 1 << 4,
kChangedFlags = 1 << 5,
kChangedFirstPartyForCookies = 1 << 6,
kChangedSiteForCookies = 1 << 6,
};
CefRequestImpl();
@ -162,7 +163,7 @@ class CefRequestImpl : public CefRequest {
// The below members are used by CefURLRequest.
int flags_;
GURL first_party_for_cookies_;
net::SiteForCookies site_for_cookies_;
// Stores backup of values for use with track changes.
struct Backup {
@ -176,7 +177,7 @@ class CefRequestImpl : public CefRequest {
CefRefPtr<CefPostData> postdata_;
std::unique_ptr<HeaderMap> headermap_;
int flags_;
GURL first_party_for_cookies_;
net::SiteForCookies site_for_cookies_;
};
std::unique_ptr<Backup> backup_;

View File

@ -155,7 +155,7 @@ void CefResponseImpl::SetHeaderMap(const HeaderMap& headerMap) {
header_map_ = headerMap;
}
net::HttpResponseHeaders* CefResponseImpl::GetResponseHeaders() {
scoped_refptr<net::HttpResponseHeaders> CefResponseImpl::GetResponseHeaders() {
base::AutoLock lock_scope(lock_);
std::string mime_type = mime_type_;

View File

@ -44,7 +44,7 @@ class CefResponseImpl : public CefResponse {
CefString GetURL() override;
void SetURL(const CefString& url) override;
net::HttpResponseHeaders* GetResponseHeaders();
scoped_refptr<net::HttpResponseHeaders> GetResponseHeaders();
void SetResponseHeaders(const net::HttpResponseHeaders& headers);
void Set(const blink::WebURLResponse& response);

View File

@ -417,14 +417,14 @@ void LoadWidevineCdmInfoOnBlockingThread(
cef_cdm_registration_error_t result =
LoadWidevineCdmInfo(base_path, args.get(), &error_message);
if (result != CEF_CDM_REGISTRATION_ERROR_NONE) {
CEF_POST_TASK(CEF_UIT, base::Bind(DeliverWidevineCdmCallback, result,
error_message, callback));
CEF_POST_TASK(CEF_UIT, base::BindOnce(DeliverWidevineCdmCallback, result,
error_message, callback));
return;
}
// Continue execution on the UI thread.
CEF_POST_TASK(CEF_UIT, base::Bind(RegisterWidevineCdmOnUIThread,
base::Passed(std::move(args)), callback));
CEF_POST_TASK(CEF_UIT, base::BindOnce(RegisterWidevineCdmOnUIThread,
std::move(args), callback));
}
} // namespace
@ -446,7 +446,7 @@ void CefWidevineLoader::LoadWidevineCdm(
}
CEF_POST_USER_VISIBLE_TASK(
base::Bind(LoadWidevineCdmInfoOnBlockingThread, path, callback));
base::BindOnce(LoadWidevineCdmInfoOnBlockingThread, path, callback));
}
void CefWidevineLoader::OnContextInitialized() {