Issue #2024 - Part 1: Add wildcard to Access-Control-Expose-Headers

For requests without credentials, add wildcard to Access-Control-Expose-Headers.
This commit is contained in:
Moonchild 2022-11-06 12:31:17 +00:00 committed by roytam1
commit 211b7cf219
6 changed files with 40 additions and 16 deletions

View file

@ -17,12 +17,15 @@
namespace mozilla {
namespace dom {
InternalResponse::InternalResponse(uint16_t aStatus, const nsACString& aStatusText)
InternalResponse::InternalResponse(uint16_t aStatus,
const nsACString& aStatusText,
RequestCredentials aCredentialsMode)
: mType(ResponseType::Default)
, mStatus(aStatus)
, mStatusText(aStatusText)
, mHeaders(new InternalHeaders(HeadersGuardEnum::Response))
, mBodySize(UNKNOWN_BODY_SIZE)
, mCredentialsMode(aCredentialsMode)
{
}
@ -183,7 +186,7 @@ InternalResponse::CORSResponse()
MOZ_ASSERT(!mWrappedResponse, "Can't CORSResponse a already wrapped response");
RefPtr<InternalResponse> cors = CreateIncompleteCopy();
cors->mType = ResponseType::Cors;
cors->mHeaders = InternalHeaders::CORSHeaders(Headers());
cors->mHeaders = InternalHeaders::CORSHeaders(Headers(), mCredentialsMode);
cors->mWrappedResponse = this;
return cors.forget();
}