@@ -221,21 +221,18 @@ already_AddRefed<nsIInputStream> CacheOpParent::DeserializeCacheStream(
221
221
void CacheOpParent::ProcessCrossOriginResourcePolicyHeader (
222
222
ErrorResult& aRv, const nsTArray<SavedResponse>& aResponses) {
223
223
// Only checking for match/matchAll.
224
- RequestMode mode = RequestMode::No_cors;
225
224
nsILoadInfo::CrossOriginEmbedderPolicy loadingCOEP =
226
225
nsILoadInfo::EMBEDDER_POLICY_NULL;
227
226
Maybe<PrincipalInfo> principalInfo;
228
227
switch (mOpArgs .type ()) {
229
228
case CacheOpArgs::TCacheMatchArgs: {
230
- mode = mOpArgs .get_CacheMatchArgs ().request ().mode ();
231
229
loadingCOEP =
232
230
mOpArgs .get_CacheMatchArgs ().request ().loadingEmbedderPolicy ();
233
231
principalInfo = mOpArgs .get_CacheMatchArgs ().request ().principalInfo ();
234
232
break ;
235
233
}
236
234
case CacheOpArgs::TCacheMatchAllArgs: {
237
235
if (mOpArgs .get_CacheMatchAllArgs ().maybeRequest ().isSome ()) {
238
- mode = mOpArgs .get_CacheMatchAllArgs ().maybeRequest ().ref ().mode ();
239
236
loadingCOEP = mOpArgs .get_CacheMatchAllArgs ()
240
237
.maybeRequest ()
241
238
.ref ()
@@ -252,11 +249,6 @@ void CacheOpParent::ProcessCrossOriginResourcePolicyHeader(
252
249
}
253
250
}
254
251
255
- // skip checking for CORS mode
256
- if (mode == RequestMode::Cors) {
257
- return ;
258
- }
259
-
260
252
// skip checking if the request has no principal for same-origin/same-site
261
253
// checking.
262
254
if (principalInfo.isNothing () ||
@@ -268,6 +260,10 @@ void CacheOpParent::ProcessCrossOriginResourcePolicyHeader(
268
260
269
261
nsAutoCString corp;
270
262
for (auto it = aResponses.cbegin (); it != aResponses.cend (); ++it) {
263
+ if (it->mValue .type () != ResponseType::Opaque &&
264
+ it->mValue .type () != ResponseType::Opaqueredirect) {
265
+ continue ;
266
+ }
271
267
corp.Assign (EmptyCString ());
272
268
for (auto headerIt = it->mValue .headers ().cbegin ();
273
269
headerIt != it->mValue .headers ().cend (); ++headerIt) {
0 commit comments