Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(78)

Unified Diff: content/browser/service_worker/foreign_fetch_request_handler.cc

Issue 2255713003: Effectively disable foreign fetch when third party cookies are disabled. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: null out resource_context_ Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/service_worker/foreign_fetch_request_handler.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/service_worker/foreign_fetch_request_handler.cc
diff --git a/content/browser/service_worker/foreign_fetch_request_handler.cc b/content/browser/service_worker/foreign_fetch_request_handler.cc
index b4df605c1be1b6f90eee9473e474a2beafe0c8a5..f3437802e4c54618a9d751d33adb8f3f6e4e5689 100644
--- a/content/browser/service_worker/foreign_fetch_request_handler.cc
+++ b/content/browser/service_worker/foreign_fetch_request_handler.cc
@@ -13,6 +13,8 @@
#include "content/browser/service_worker/service_worker_url_request_job.h"
#include "content/common/resource_request_body_impl.h"
#include "content/common/service_worker/service_worker_utils.h"
+#include "content/public/browser/content_browser_client.h"
+#include "content/public/browser/resource_request_info.h"
#include "content/public/common/content_client.h"
#include "content/public/common/content_switches.h"
#include "content/public/common/origin_trial_policy.h"
@@ -159,6 +161,7 @@ net::URLRequestJob* ForeignFetchRequestHandler::MaybeCreateJob(
resource_type_, request_context_type_, frame_type_, body_,
ServiceWorkerFetchType::FOREIGN_FETCH, this);
job_ = job->GetWeakPtr();
+ resource_context_ = resource_context;
context_->FindReadyRegistrationForDocument(
request->url(),
@@ -227,6 +230,20 @@ void ForeignFetchRequestHandler::DidFindRegistration(
return;
}
+ int render_process_id;
+ int render_frame_id;
+ if (!ResourceRequestInfo::GetRenderFrameForRequest(
+ job->request(), &render_process_id, &render_frame_id)) {
+ render_process_id = -1;
+ render_frame_id = -1;
+ }
+ if (!GetContentClient()->browser()->AllowServiceWorker(
+ registration->pattern(), job->request()->first_party_for_cookies(),
+ resource_context_, render_process_id, render_frame_id)) {
+ job->FallbackToNetwork();
+ return;
+ }
+
target_worker_ = active_version;
job->ForwardToServiceWorker();
}
@@ -250,6 +267,7 @@ ServiceWorkerVersion* ForeignFetchRequestHandler::GetServiceWorkerVersion(
void ForeignFetchRequestHandler::ClearJob() {
job_.reset();
target_worker_ = nullptr;
+ resource_context_ = nullptr;
}
} // namespace content
« no previous file with comments | « content/browser/service_worker/foreign_fetch_request_handler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698