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

Side by Side Diff: content/browser/service_worker/foreign_fetch_request_handler.cc

Issue 2049723004: Revert of Limit foreign fetch to only intercept requests made from secure contexts. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/service_worker/foreign_fetch_request_handler.h" 5 #include "content/browser/service_worker/foreign_fetch_request_handler.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "content/browser/service_worker/service_worker_context_wrapper.h" 10 #include "content/browser/service_worker/service_worker_context_wrapper.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 storage::BlobStorageContext* blob_storage_context, 51 storage::BlobStorageContext* blob_storage_context,
52 int process_id, 52 int process_id,
53 int provider_id, 53 int provider_id,
54 bool skip_service_worker, 54 bool skip_service_worker,
55 FetchRequestMode request_mode, 55 FetchRequestMode request_mode,
56 FetchCredentialsMode credentials_mode, 56 FetchCredentialsMode credentials_mode,
57 FetchRedirectMode redirect_mode, 57 FetchRedirectMode redirect_mode,
58 ResourceType resource_type, 58 ResourceType resource_type,
59 RequestContextType request_context_type, 59 RequestContextType request_context_type,
60 RequestContextFrameType frame_type, 60 RequestContextFrameType frame_type,
61 scoped_refptr<ResourceRequestBody> body, 61 scoped_refptr<ResourceRequestBody> body) {
62 bool initiated_in_secure_context) {
63 if (!context_wrapper) { 62 if (!context_wrapper) {
64 return; 63 return;
65 } 64 }
66 65
67 if (!initiated_in_secure_context)
68 return;
69
70 if (!context_wrapper->OriginHasForeignFetchRegistrations( 66 if (!context_wrapper->OriginHasForeignFetchRegistrations(
71 request->url().GetOrigin())) { 67 request->url().GetOrigin())) {
72 return; 68 return;
73 } 69 }
74 70
75 if (request->initiator().IsSameOriginWith(url::Origin(request->url()))) 71 if (request->initiator().IsSameOriginWith(url::Origin(request->url())))
76 return; 72 return;
77
78 if (ServiceWorkerUtils::IsMainResourceType(resource_type)) 73 if (ServiceWorkerUtils::IsMainResourceType(resource_type))
79 return; 74 return;
80 75
81 // Any more precise checks to see if the request should be intercepted are 76 // Any more precise checks to see if the request should be intercepted are
82 // asynchronous, so just create our handler in all cases. 77 // asynchronous, so just create our handler in all cases.
83 std::unique_ptr<ForeignFetchRequestHandler> handler( 78 std::unique_ptr<ForeignFetchRequestHandler> handler(
84 new ForeignFetchRequestHandler( 79 new ForeignFetchRequestHandler(
85 context_wrapper, blob_storage_context->AsWeakPtr(), request_mode, 80 context_wrapper, blob_storage_context->AsWeakPtr(), request_mode,
86 credentials_mode, redirect_mode, resource_type, request_context_type, 81 credentials_mode, redirect_mode, resource_type, request_context_type,
87 frame_type, body)); 82 frame_type, body));
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 } 221 }
227 return target_worker_.get(); 222 return target_worker_.get();
228 } 223 }
229 224
230 void ForeignFetchRequestHandler::ClearJob() { 225 void ForeignFetchRequestHandler::ClearJob() {
231 job_.reset(); 226 job_.reset();
232 target_worker_ = nullptr; 227 target_worker_ = nullptr;
233 } 228 }
234 229
235 } // namespace content 230 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/service_worker/foreign_fetch_request_handler.h ('k') | content/child/request_extra_data.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698