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

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

Issue 2554393003: Add null-check for context_wrapper->context() in ForeignFetchRequestHandler. (Closed)
Patch Set: Created 4 years 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/command_line.h" 9 #include "base/command_line.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 FetchCredentialsMode credentials_mode, 75 FetchCredentialsMode credentials_mode,
76 FetchRedirectMode redirect_mode, 76 FetchRedirectMode redirect_mode,
77 ResourceType resource_type, 77 ResourceType resource_type,
78 RequestContextType request_context_type, 78 RequestContextType request_context_type,
79 RequestContextFrameType frame_type, 79 RequestContextFrameType frame_type,
80 scoped_refptr<ResourceRequestBodyImpl> body, 80 scoped_refptr<ResourceRequestBodyImpl> body,
81 bool initiated_in_secure_context) { 81 bool initiated_in_secure_context) {
82 if (!IsForeignFetchEnabled()) 82 if (!IsForeignFetchEnabled())
83 return; 83 return;
84 84
85 if (!context_wrapper) 85 if (!context_wrapper || !context_wrapper->context() ||
86 provider_id == kInvalidServiceWorkerProviderId) {
86 return; 87 return;
88 }
87 89
88 if (skip_service_worker == SkipServiceWorker::ALL) 90 if (skip_service_worker == SkipServiceWorker::ALL)
89 return; 91 return;
90 92
91 if (!initiated_in_secure_context) 93 if (!initiated_in_secure_context)
92 return; 94 return;
93 95
94 // ServiceWorkerUtils::IsMainResource doesn't consider all worker types to 96 // ServiceWorkerUtils::IsMainResource doesn't consider all worker types to
95 // be main resources. This code shouldn't handle any main resource requests 97 // be main resources. This code shouldn't handle any main resource requests
96 // though, so explicitly exclude the extra worker types. 98 // though, so explicitly exclude the extra worker types.
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 // The worker entry in the database was written by old version Chrome (< M56) 305 // The worker entry in the database was written by old version Chrome (< M56)
304 // and the main script was not loaded yet. In this case, we can't check the 306 // and the main script was not loaded yet. In this case, we can't check the
305 // origin trial token. 307 // origin trial token.
306 if (!active_version->origin_trial_tokens()) 308 if (!active_version->origin_trial_tokens())
307 return true; 309 return true;
308 const auto& token_map = *active_version->origin_trial_tokens(); 310 const auto& token_map = *active_version->origin_trial_tokens();
309 return base::ContainsKey(token_map, "ForeignFetch"); 311 return base::ContainsKey(token_map, "ForeignFetch");
310 } 312 }
311 313
312 } // namespace content 314 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698