mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-21 01:05:45 +00:00
Bug 1642531 - Instead of using RequestMode, using ResponseType for CORP checking in cache APIs r=dom-workers-and-storage-reviewers,perry
According to https://github.com/w3c/ServiceWorker/pull/1516, Replacing RequestMode by ResponseType for CORP checking in cache.match() and cache.matchAll(). Differential Revision: https://phabricator.services.mozilla.com/D77747
This commit is contained in:
parent
eaf8e5f228
commit
400b4664ad
12
dom/cache/CacheOpParent.cpp
vendored
12
dom/cache/CacheOpParent.cpp
vendored
@ -221,13 +221,11 @@ already_AddRefed<nsIInputStream> CacheOpParent::DeserializeCacheStream(
|
||||
void CacheOpParent::ProcessCrossOriginResourcePolicyHeader(
|
||||
ErrorResult& aRv, const nsTArray<SavedResponse>& aResponses) {
|
||||
// Only checking for match/matchAll.
|
||||
RequestMode mode = RequestMode::No_cors;
|
||||
nsILoadInfo::CrossOriginEmbedderPolicy loadingCOEP =
|
||||
nsILoadInfo::EMBEDDER_POLICY_NULL;
|
||||
Maybe<PrincipalInfo> principalInfo;
|
||||
switch (mOpArgs.type()) {
|
||||
case CacheOpArgs::TCacheMatchArgs: {
|
||||
mode = mOpArgs.get_CacheMatchArgs().request().mode();
|
||||
loadingCOEP =
|
||||
mOpArgs.get_CacheMatchArgs().request().loadingEmbedderPolicy();
|
||||
principalInfo = mOpArgs.get_CacheMatchArgs().request().principalInfo();
|
||||
@ -235,7 +233,6 @@ void CacheOpParent::ProcessCrossOriginResourcePolicyHeader(
|
||||
}
|
||||
case CacheOpArgs::TCacheMatchAllArgs: {
|
||||
if (mOpArgs.get_CacheMatchAllArgs().maybeRequest().isSome()) {
|
||||
mode = mOpArgs.get_CacheMatchAllArgs().maybeRequest().ref().mode();
|
||||
loadingCOEP = mOpArgs.get_CacheMatchAllArgs()
|
||||
.maybeRequest()
|
||||
.ref()
|
||||
@ -252,11 +249,6 @@ void CacheOpParent::ProcessCrossOriginResourcePolicyHeader(
|
||||
}
|
||||
}
|
||||
|
||||
// skip checking for CORS mode
|
||||
if (mode == RequestMode::Cors) {
|
||||
return;
|
||||
}
|
||||
|
||||
// skip checking if the request has no principal for same-origin/same-site
|
||||
// checking.
|
||||
if (principalInfo.isNothing() ||
|
||||
@ -268,6 +260,10 @@ void CacheOpParent::ProcessCrossOriginResourcePolicyHeader(
|
||||
|
||||
nsAutoCString corp;
|
||||
for (auto it = aResponses.cbegin(); it != aResponses.cend(); ++it) {
|
||||
if (it->mValue.type() != ResponseType::Opaque &&
|
||||
it->mValue.type() != ResponseType::Opaqueredirect) {
|
||||
continue;
|
||||
}
|
||||
corp.Assign(EmptyCString());
|
||||
for (auto headerIt = it->mValue.headers().cbegin();
|
||||
headerIt != it->mValue.headers().cend(); ++headerIt) {
|
||||
|
@ -1,7 +0,0 @@
|
||||
[require-corp-load-from-cache-storage.https.html]
|
||||
[Fetch cross-origin no-cors cors-enabled corp-undefined from network and CacheStorage.]
|
||||
expected: FAIL
|
||||
|
||||
[Fetch cross-origin no-cors cors-disabled corp-undefined from network and CacheStorage.]
|
||||
expected: FAIL
|
||||
|
Loading…
Reference in New Issue
Block a user