chore: bump chromium to 94cc24d3bb17a7406ba6c6cc6dc29 (master) (#21485)

This commit is contained in:
Electron Bot 2019-12-13 15:13:12 -05:00 committed by Jeremy Apthorp
parent 19cd8f3a02
commit 0f2f9a580a
47 changed files with 285 additions and 256 deletions

View file

@ -21,7 +21,7 @@
#include "net/base/mime_util.h"
#include "net/http/http_byte_range.h"
#include "net/http/http_util.h"
#include "services/network/public/cpp/resource_response.h"
#include "services/network/public/mojom/url_response_head.mojom.h"
#include "shell/common/asar/archive.h"
#include "shell/common/asar/asar_util.h"
@ -87,10 +87,10 @@ class AsarURLLoader : public network::mojom::URLLoader {
mojo::PendingReceiver<network::mojom::URLLoader> loader,
mojo::PendingRemote<network::mojom::URLLoaderClient> client,
scoped_refptr<net::HttpResponseHeaders> extra_response_headers) {
network::ResourceResponseHead head;
head.request_start = base::TimeTicks::Now();
head.response_start = base::TimeTicks::Now();
head.headers = extra_response_headers;
auto head = network::mojom::URLResponseHead::New();
head->request_start = base::TimeTicks::Now();
head->response_start = base::TimeTicks::Now();
head->headers = extra_response_headers;
base::FilePath path;
if (!net::FileURLToFilePath(request.url, &path)) {
@ -188,7 +188,7 @@ class AsarURLLoader : public network::mojom::URLLoader {
total_bytes_written_ = total_bytes_to_send;
head.content_length = base::saturated_cast<int64_t>(total_bytes_to_send);
head->content_length = base::saturated_cast<int64_t>(total_bytes_to_send);
if (first_byte_to_send < read_result.bytes_read) {
// Write any data we read for MIME sniffing, constraining by range where
@ -211,20 +211,20 @@ class AsarURLLoader : public network::mojom::URLLoader {
total_bytes_to_send -= write_size;
}
if (!net::GetMimeTypeFromFile(path, &head.mime_type)) {
if (!net::GetMimeTypeFromFile(path, &head->mime_type)) {
std::string new_type;
net::SniffMimeType(initial_read_buffer.data(), read_result.bytes_read,
request.url, head.mime_type,
request.url, head->mime_type,
net::ForceSniffFileUrlsForHtml::kDisabled, &new_type);
head.mime_type.assign(new_type);
head.did_mime_sniff = true;
head->mime_type.assign(new_type);
head->did_mime_sniff = true;
}
if (head.headers) {
head.headers->AddHeader(
if (head->headers) {
head->headers->AddHeader(
base::StringPrintf("%s: %s", net::HttpRequestHeaders::kContentType,
head.mime_type.c_str()));
head->mime_type.c_str()));
}
client_->OnReceiveResponse(head);
client_->OnReceiveResponse(std::move(head));
client_->OnStartLoadingResponseBody(std::move(pipe.consumer_handle));
if (total_bytes_to_send == 0) {

View file

@ -88,24 +88,24 @@ gin::Dictionary ToDict(v8::Isolate* isolate, v8::Local<v8::Value> value) {
}
// Parse headers from response object.
network::ResourceResponseHead ToResponseHead(
network::mojom::URLResponseHeadPtr ToResponseHead(
const gin_helper::Dictionary& dict) {
network::ResourceResponseHead head;
head.mime_type = "text/html";
head.charset = "utf-8";
auto head = network::mojom::URLResponseHead::New();
head->mime_type = "text/html";
head->charset = "utf-8";
if (dict.IsEmpty()) {
head.headers = new net::HttpResponseHeaders("HTTP/1.1 200 OK");
head->headers = new net::HttpResponseHeaders("HTTP/1.1 200 OK");
return head;
}
int status_code = 200;
dict.Get("statusCode", &status_code);
head.headers = new net::HttpResponseHeaders(base::StringPrintf(
head->headers = new net::HttpResponseHeaders(base::StringPrintf(
"HTTP/1.1 %d %s", status_code,
net::GetHttpReasonPhrase(static_cast<net::HttpStatusCode>(status_code))));
dict.Get("charset", &head.charset);
bool has_mime_type = dict.Get("mimeType", &head.mime_type);
dict.Get("charset", &head->charset);
bool has_mime_type = dict.Get("mimeType", &head->mime_type);
bool has_content_type = false;
base::DictionaryValue headers;
@ -113,12 +113,12 @@ network::ResourceResponseHead ToResponseHead(
for (const auto& iter : headers.DictItems()) {
if (iter.second.is_string()) {
// key: value
head.headers->AddHeader(iter.first + ": " + iter.second.GetString());
head->headers->AddHeader(iter.first + ": " + iter.second.GetString());
} else if (iter.second.is_list()) {
// key: [values...]
for (const auto& item : iter.second.GetList()) {
if (item.is_string())
head.headers->AddHeader(iter.first + ": " + item.GetString());
head->headers->AddHeader(iter.first + ": " + item.GetString());
}
} else {
continue;
@ -126,16 +126,16 @@ network::ResourceResponseHead ToResponseHead(
// Some apps are passing content-type via headers, which is not accepted
// in NetworkService.
if (base::ToLowerASCII(iter.first) == "content-type") {
head.headers->GetMimeTypeAndCharset(&head.mime_type, &head.charset);
head->headers->GetMimeTypeAndCharset(&head->mime_type, &head->charset);
has_content_type = true;
}
}
}
// Setting |head.mime_type| does not automatically set the "content-type"
// Setting |head->mime_type| does not automatically set the "content-type"
// header in NetworkService.
if (has_mime_type && !has_content_type)
head.headers->AddHeader("content-type: " + head.mime_type);
head->headers->AddHeader("content-type: " + head->mime_type);
return head;
}
@ -225,7 +225,7 @@ void AtomURLLoaderFactory::StartLoading(
}
}
network::ResourceResponseHead head = ToResponseHead(dict);
network::mojom::URLResponseHeadPtr head = ToResponseHead(dict);
// Handle redirection.
//
@ -234,7 +234,7 @@ void AtomURLLoaderFactory::StartLoading(
// to implement redirection. This is also what Chromium does with WebRequest
// API in WebRequestProxyingURLLoaderFactory.
std::string location;
if (head.headers->IsRedirect(&location)) {
if (head->headers->IsRedirect(&location)) {
network::ResourceRequest new_request = request;
new_request.url = GURL(location);
// When the redirection comes from an intercepted scheme (which has
@ -310,7 +310,7 @@ void AtomURLLoaderFactory::StartLoading(
// static
void AtomURLLoaderFactory::StartLoadingBuffer(
mojo::PendingRemote<network::mojom::URLLoaderClient> client,
network::ResourceResponseHead head,
network::mojom::URLResponseHeadPtr head,
const gin_helper::Dictionary& dict) {
v8::Local<v8::Value> buffer = dict.GetHandle();
dict.Get("data", &buffer);
@ -330,7 +330,7 @@ void AtomURLLoaderFactory::StartLoadingBuffer(
// static
void AtomURLLoaderFactory::StartLoadingString(
mojo::PendingRemote<network::mojom::URLLoaderClient> client,
network::ResourceResponseHead head,
network::mojom::URLResponseHeadPtr head,
const gin_helper::Dictionary& dict,
v8::Isolate* isolate,
v8::Local<v8::Value> response) {
@ -355,7 +355,7 @@ void AtomURLLoaderFactory::StartLoadingFile(
mojo::PendingReceiver<network::mojom::URLLoader> loader,
network::ResourceRequest request,
mojo::PendingRemote<network::mojom::URLLoaderClient> client,
network::ResourceResponseHead head,
network::mojom::URLResponseHeadPtr head,
const gin_helper::Dictionary& dict,
v8::Isolate* isolate,
v8::Local<v8::Value> response) {
@ -375,9 +375,9 @@ void AtomURLLoaderFactory::StartLoadingFile(
return;
}
head.headers->AddHeader(kCORSHeader);
head->headers->AddHeader(kCORSHeader);
asar::CreateAsarURLLoader(request, std::move(loader), std::move(client),
head.headers);
head->headers);
}
// static
@ -426,7 +426,7 @@ void AtomURLLoaderFactory::StartLoadingHttp(
void AtomURLLoaderFactory::StartLoadingStream(
mojo::PendingReceiver<network::mojom::URLLoader> loader,
mojo::PendingRemote<network::mojom::URLLoaderClient> client,
network::ResourceResponseHead head,
network::mojom::URLResponseHeadPtr head,
const gin_helper::Dictionary& dict) {
v8::Local<v8::Value> stream;
if (!dict.Get("data", &stream)) {
@ -440,7 +440,7 @@ void AtomURLLoaderFactory::StartLoadingStream(
//
// Note that We must submit a empty body otherwise NetworkService would
// crash.
client_remote->OnReceiveResponse(head);
client_remote->OnReceiveResponse(std::move(head));
mojo::ScopedDataPipeProducerHandle producer;
mojo::ScopedDataPipeConsumerHandle consumer;
if (mojo::CreateDataPipe(nullptr, &producer, &consumer) != MOJO_RESULT_OK) {
@ -478,12 +478,12 @@ void AtomURLLoaderFactory::StartLoadingStream(
// static
void AtomURLLoaderFactory::SendContents(
mojo::PendingRemote<network::mojom::URLLoaderClient> client,
network::ResourceResponseHead head,
network::mojom::URLResponseHeadPtr head,
std::string data) {
mojo::Remote<network::mojom::URLLoaderClient> client_remote(
std::move(client));
head.headers->AddHeader(kCORSHeader);
client_remote->OnReceiveResponse(head);
head->headers->AddHeader(kCORSHeader);
client_remote->OnReceiveResponse(std::move(head));
// Code bellow follows the pattern of data_url_loader_factory.cc.
mojo::ScopedDataPipeProducerHandle producer;

View file

@ -14,8 +14,8 @@
#include "mojo/public/cpp/bindings/receiver_set.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "net/url_request/url_request_job_factory.h"
#include "services/network/public/cpp/resource_response.h"
#include "services/network/public/mojom/url_loader_factory.mojom.h"
#include "services/network/public/mojom/url_response_head.mojom.h"
#include "shell/common/gin_helper/dictionary.h"
namespace electron {
@ -72,11 +72,11 @@ class AtomURLLoaderFactory : public network::mojom::URLLoaderFactory {
private:
static void StartLoadingBuffer(
mojo::PendingRemote<network::mojom::URLLoaderClient> client,
network::ResourceResponseHead head,
network::mojom::URLResponseHeadPtr head,
const gin_helper::Dictionary& dict);
static void StartLoadingString(
mojo::PendingRemote<network::mojom::URLLoaderClient> client,
network::ResourceResponseHead head,
network::mojom::URLResponseHeadPtr head,
const gin_helper::Dictionary& dict,
v8::Isolate* isolate,
v8::Local<v8::Value> response);
@ -84,7 +84,7 @@ class AtomURLLoaderFactory : public network::mojom::URLLoaderFactory {
mojo::PendingReceiver<network::mojom::URLLoader> loader,
network::ResourceRequest request,
mojo::PendingRemote<network::mojom::URLLoaderClient> client,
network::ResourceResponseHead head,
network::mojom::URLResponseHeadPtr head,
const gin_helper::Dictionary& dict,
v8::Isolate* isolate,
v8::Local<v8::Value> response);
@ -97,13 +97,13 @@ class AtomURLLoaderFactory : public network::mojom::URLLoaderFactory {
static void StartLoadingStream(
mojo::PendingReceiver<network::mojom::URLLoader> loader,
mojo::PendingRemote<network::mojom::URLLoaderClient> client,
network::ResourceResponseHead head,
network::mojom::URLResponseHeadPtr head,
const gin_helper::Dictionary& dict);
// Helper to send string as response.
static void SendContents(
mojo::PendingRemote<network::mojom::URLLoaderClient> client,
network::ResourceResponseHead head,
network::mojom::URLResponseHeadPtr head,
std::string data);
// TODO(zcbenz): This comes from extensions/browser/extension_protocols.cc

View file

@ -13,7 +13,7 @@
namespace electron {
NodeStreamLoader::NodeStreamLoader(
network::ResourceResponseHead head,
network::mojom::URLResponseHeadPtr head,
network::mojom::URLLoaderRequest loader,
mojo::PendingRemote<network::mojom::URLLoaderClient> client,
v8::Isolate* isolate,
@ -44,7 +44,7 @@ NodeStreamLoader::~NodeStreamLoader() {
}
}
void NodeStreamLoader::Start(network::ResourceResponseHead head) {
void NodeStreamLoader::Start(network::mojom::URLResponseHeadPtr head) {
mojo::ScopedDataPipeProducerHandle producer;
mojo::ScopedDataPipeConsumerHandle consumer;
MojoResult rv = mojo::CreateDataPipe(nullptr, &producer, &consumer);
@ -54,7 +54,7 @@ void NodeStreamLoader::Start(network::ResourceResponseHead head) {
}
producer_ = std::make_unique<mojo::DataPipeProducer>(std::move(producer));
client_->OnReceiveResponse(head);
client_->OnReceiveResponse(std::move(head));
client_->OnStartLoadingResponseBody(std::move(consumer));
auto weak = weak_factory_.GetWeakPtr();

View file

@ -14,8 +14,8 @@
#include "mojo/public/cpp/bindings/remote.h"
#include "mojo/public/cpp/bindings/strong_binding.h"
#include "mojo/public/cpp/system/data_pipe_producer.h"
#include "services/network/public/cpp/resource_response.h"
#include "services/network/public/mojom/url_loader.mojom.h"
#include "services/network/public/mojom/url_response_head.mojom.h"
#include "v8/include/v8.h"
namespace electron {
@ -30,7 +30,7 @@ namespace electron {
// the passed |Buffer| is alive while writing data to pipe.
class NodeStreamLoader : public network::mojom::URLLoader {
public:
NodeStreamLoader(network::ResourceResponseHead head,
NodeStreamLoader(network::mojom::URLResponseHeadPtr head,
network::mojom::URLLoaderRequest loader,
mojo::PendingRemote<network::mojom::URLLoaderClient> client,
v8::Isolate* isolate,
@ -41,7 +41,7 @@ class NodeStreamLoader : public network::mojom::URLLoader {
using EventCallback = base::RepeatingCallback<void()>;
void Start(network::ResourceResponseHead head);
void Start(network::mojom::URLResponseHeadPtr head);
void NotifyReadable();
void NotifyComplete(int result);
void ReadMore();

View file

@ -7,6 +7,7 @@
#include <utility>
#include "base/command_line.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
#include "content/public/browser/browser_context.h"
#include "extensions/browser/extension_navigation_ui_data.h"