| Index: third_party/WebKit/Source/core/loader/WorkerFetchContext.cpp
|
| diff --git a/third_party/WebKit/Source/core/loader/WorkerFetchContext.cpp b/third_party/WebKit/Source/core/loader/WorkerFetchContext.cpp
|
| index 9f21b6665a3165a2db2e9d5eefa2935a9790a0b4..37b71921e3beaef13ff43bad27a2b2db1e981bff 100644
|
| --- a/third_party/WebKit/Source/core/loader/WorkerFetchContext.cpp
|
| +++ b/third_party/WebKit/Source/core/loader/WorkerFetchContext.cpp
|
| @@ -7,14 +7,17 @@
|
| #include "core/frame/Deprecation.h"
|
| #include "core/frame/UseCounter.h"
|
| #include "core/loader/MixedContentChecker.h"
|
| +#include "core/probe/CoreProbes.h"
|
| #include "core/timing/WorkerGlobalScopePerformance.h"
|
| #include "core/workers/WorkerClients.h"
|
| #include "core/workers/WorkerGlobalScope.h"
|
| +#include "platform/RuntimeEnabledFeatures.h"
|
| #include "platform/Supplementable.h"
|
| #include "platform/WebTaskRunner.h"
|
| #include "platform/exported/WrappedResourceRequest.h"
|
| #include "platform/loader/fetch/ResourceFetcher.h"
|
| #include "platform/scheduler/child/web_scheduler.h"
|
| +#include "platform/weborigin/SecurityPolicy.h"
|
| #include "public/platform/Platform.h"
|
| #include "public/platform/WebMixedContent.h"
|
| #include "public/platform/WebMixedContentContextType.h"
|
| @@ -120,17 +123,12 @@ SecurityContext* WorkerFetchContext::GetParentSecurityContext() const {
|
| return nullptr;
|
| }
|
|
|
| -bool WorkerFetchContext::ShouldBlockRequestByInspector(
|
| - const ResourceRequest& resource_request) const {
|
| - // TODO(horo): Implement this.
|
| - return false;
|
| -}
|
| -
|
| void WorkerFetchContext::DispatchDidBlockRequest(
|
| const ResourceRequest& resource_request,
|
| const FetchInitiatorInfo& fetch_initiator_info,
|
| ResourceRequestBlockedReason blocked_reason) const {
|
| - // TODO(horo): Implement this.
|
| + probe::didBlockRequest(worker_global_scope_, resource_request, nullptr,
|
| + fetch_initiator_info, blocked_reason);
|
| }
|
|
|
| void WorkerFetchContext::ReportLocalLoadFailed(const KURL&) const {
|
| @@ -174,6 +172,11 @@ bool WorkerFetchContext::IsControlledByServiceWorker() const {
|
|
|
| void WorkerFetchContext::PrepareRequest(ResourceRequest& request,
|
| RedirectType) {
|
| + String user_agent = worker_global_scope_->UserAgent();
|
| + probe::applyUserAgentOverride(worker_global_scope_, &user_agent);
|
| + DCHECK(!user_agent.IsNull());
|
| + request.SetHTTPUserAgent(AtomicString(user_agent));
|
| +
|
| request.OverrideLoadingIPCType(WebURLRequest::LoadingIPCType::kMojo);
|
| WrappedResourceRequest webreq(request);
|
| web_context_->WillSendRequest(webreq);
|
| @@ -195,6 +198,15 @@ void WorkerFetchContext::AddAdditionalRequestHeaders(ResourceRequest& request,
|
| request.SetHTTPHeaderField("Save-Data", "on");
|
| }
|
|
|
| +void WorkerFetchContext::DispatchWillSendRequest(
|
| + unsigned long identifier,
|
| + ResourceRequest& request,
|
| + const ResourceResponse& redirect_response,
|
| + const FetchInitiatorInfo& initiator_info) {
|
| + probe::willSendRequest(worker_global_scope_, identifier, nullptr, request,
|
| + redirect_response, initiator_info);
|
| +}
|
| +
|
| void WorkerFetchContext::DispatchDidReceiveResponse(
|
| unsigned long identifier,
|
| const ResourceResponse& response,
|
| @@ -212,6 +224,31 @@ void WorkerFetchContext::DispatchDidReceiveResponse(
|
| web_context_->DidDisplayContentWithCertificateErrors(response.Url());
|
| }
|
| }
|
| + probe::didReceiveResourceResponse(worker_global_scope_, identifier, nullptr,
|
| + response, resource);
|
| +}
|
| +
|
| +void WorkerFetchContext::DispatchDidReceiveData(unsigned long identifier,
|
| + const char* data,
|
| + int data_length) {
|
| + probe::didReceiveData(worker_global_scope_, identifier, nullptr, data,
|
| + data_length);
|
| +}
|
| +
|
| +void WorkerFetchContext::DispatchDidFinishLoading(unsigned long identifier,
|
| + double finish_time,
|
| + int64_t encoded_data_length,
|
| + int64_t decoded_body_length) {
|
| + probe::didFinishLoading(worker_global_scope_, identifier, nullptr,
|
| + finish_time, encoded_data_length,
|
| + decoded_body_length);
|
| +}
|
| +
|
| +void WorkerFetchContext::DispatchDidFail(unsigned long identifier,
|
| + const ResourceError& error,
|
| + int64_t encoded_data_length,
|
| + bool is_internal_request) {
|
| + probe::didFailLoading(worker_global_scope_, identifier, error);
|
| }
|
|
|
| void WorkerFetchContext::AddResourceTiming(const ResourceTimingInfo& info) {
|
|
|