mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-27 23:02:20 +00:00
Backed out 4 changesets (bug 1697421) for e.g. breaking Tampermonkey userscripts (bug 1798149). CLOSED TREE
Backed out changeset 0ec0d4234b77 (bug 1697421) Backed out changeset b1c8d75d49ef (bug 1697421) Backed out changeset ca500b60941e (bug 1697421) Backed out changeset 5979ac92fa24 (bug 1697421)
This commit is contained in:
parent
1c2587b960
commit
533f673e9e
@ -21,7 +21,6 @@
|
||||
#include "nsProxyRelease.h"
|
||||
|
||||
#include "mozilla/ErrorResult.h"
|
||||
#include "mozilla/dom/MimeType.h"
|
||||
#include "mozilla/dom/BindingDeclarations.h"
|
||||
#include "mozilla/dom/BodyConsumer.h"
|
||||
#include "mozilla/dom/Exceptions.h"
|
||||
@ -1281,40 +1280,20 @@ template already_AddRefed<Promise> FetchBody<EmptyBody>::ConsumeBody(
|
||||
template <class Derived>
|
||||
void FetchBody<Derived>::GetMimeType(nsACString& aMimeType,
|
||||
nsACString& aMixedCaseMimeType) {
|
||||
// Extract mime type.
|
||||
ErrorResult result;
|
||||
nsAutoCString contentTypeValues, contentTypeUtf8;
|
||||
nsCString contentTypeValues;
|
||||
MOZ_ASSERT(DerivedClass()->GetInternalHeaders());
|
||||
DerivedClass()->GetInternalHeaders()->Get("Content-Type"_ns,
|
||||
contentTypeValues, result);
|
||||
MOZ_ALWAYS_TRUE(!result.Failed());
|
||||
|
||||
nsCCharSeparatedTokenizer contentTypeTokens(contentTypeValues, ',');
|
||||
|
||||
// currently we extract the MIME-type from the first content type header
|
||||
// In order to fully comply with the fetch spec we must be able to
|
||||
// parse multiple content-type headers and extrace headers from it
|
||||
// To achieve this we need to modify CMimeType::Parse and implement the
|
||||
// algorithm https://fetch.spec.whatwg.org/#concept-header-extract-mime-type
|
||||
// This issue is tracked by
|
||||
// https://bugzilla.mozilla.org/show_bug.cgi?id=1510180
|
||||
auto contentStr = contentTypeTokens.nextToken();
|
||||
|
||||
CopyLatin1toUTF8(contentStr, contentTypeUtf8);
|
||||
UniquePtr<CMimeType> contentTypeRecord = CMimeType::Parse(contentTypeUtf8);
|
||||
if (contentTypeRecord) {
|
||||
contentTypeRecord->Serialize(aMixedCaseMimeType);
|
||||
// validate invalid/empty parameter checks
|
||||
// according to https://mimesniff.spec.whatwg.org/#parsing-a-mime-type
|
||||
// CMimeType::Parse parses the parameters and discards ill-formed parameters
|
||||
// If we have invalid/illformed paramters we need to discard the parsed
|
||||
// mime-type
|
||||
if (contentStr.Contains(';') && !aMixedCaseMimeType.Contains(';')) {
|
||||
// parameters were discarded after parsing.
|
||||
// This should result in invalid MimeType
|
||||
aMixedCaseMimeType = "";
|
||||
}
|
||||
|
||||
aMimeType = aMixedCaseMimeType;
|
||||
// HTTP ABNF states Content-Type may have only one value.
|
||||
// This is from the "parse a header value" of the fetch spec.
|
||||
if (!contentTypeValues.IsVoid() && contentTypeValues.Find(",") == -1) {
|
||||
// Convert from a bytestring to a UTF8 CString.
|
||||
CopyLatin1toUTF8(contentTypeValues, aMimeType);
|
||||
aMixedCaseMimeType = aMimeType;
|
||||
ToLowerCase(aMimeType);
|
||||
}
|
||||
}
|
||||
|
@ -697,17 +697,9 @@ bool FetchUtil::StreamResponseToJS(JSContext* aCx, JS::Handle<JSObject*> aObj,
|
||||
response->GetMimeType(mimeType, mixedCaseMimeType);
|
||||
|
||||
if (!mimeType.EqualsASCII(requiredMimeType)) {
|
||||
// Errors encountered while parsing content-type headers for extracting
|
||||
// mimetype can result GetMimeType() to return an empty string. Get
|
||||
// content-type headers from the network for error logging
|
||||
ErrorResult result;
|
||||
nsAutoCString contentType;
|
||||
response->GetInternalHeaders()->Get("Content-Type"_ns, contentType, result);
|
||||
MOZ_ALWAYS_TRUE(!result.Failed());
|
||||
|
||||
JS_ReportErrorNumberASCII(aCx, js::GetErrorMessage, nullptr,
|
||||
JSMSG_WASM_BAD_RESPONSE_MIME_TYPE,
|
||||
contentType.get(), requiredMimeType);
|
||||
JSMSG_WASM_BAD_RESPONSE_MIME_TYPE, mimeType.get(),
|
||||
requiredMimeType);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -441,15 +441,15 @@ void InternalHeaders::Fill(const Record<nsCString, nsCString>& aInit,
|
||||
|
||||
namespace {
|
||||
|
||||
class FillOriginalResponseHeaders final : public nsIHttpHeaderVisitor {
|
||||
class FillHeaders final : public nsIHttpHeaderVisitor {
|
||||
RefPtr<InternalHeaders> mInternalHeaders;
|
||||
|
||||
~FillOriginalResponseHeaders() = default;
|
||||
~FillHeaders() = default;
|
||||
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
explicit FillOriginalResponseHeaders(InternalHeaders* aInternalHeaders)
|
||||
explicit FillHeaders(InternalHeaders* aInternalHeaders)
|
||||
: mInternalHeaders(aInternalHeaders) {
|
||||
MOZ_DIAGNOSTIC_ASSERT(mInternalHeaders);
|
||||
}
|
||||
@ -461,34 +461,8 @@ class FillOriginalResponseHeaders final : public nsIHttpHeaderVisitor {
|
||||
}
|
||||
};
|
||||
|
||||
NS_IMPL_ISUPPORTS(FillOriginalResponseHeaders, nsIHttpHeaderVisitor)
|
||||
NS_IMPL_ISUPPORTS(FillHeaders, nsIHttpHeaderVisitor)
|
||||
|
||||
class FillMissingResponseHeaders final : public nsIHttpHeaderVisitor {
|
||||
RefPtr<InternalHeaders> mInternalHeaders;
|
||||
|
||||
~FillMissingResponseHeaders() = default;
|
||||
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
explicit FillMissingResponseHeaders(InternalHeaders* aInternalHeaders)
|
||||
: mInternalHeaders(aInternalHeaders) {
|
||||
MOZ_DIAGNOSTIC_ASSERT(mInternalHeaders);
|
||||
}
|
||||
|
||||
NS_IMETHOD
|
||||
VisitHeader(const nsACString& aHeader, const nsACString& aValue) override {
|
||||
ErrorResult rv;
|
||||
|
||||
if (!mInternalHeaders->Has(aHeader, rv)) {
|
||||
MOZ_ASSERT(!rv.Failed());
|
||||
mInternalHeaders->Append(aHeader, aValue, IgnoreErrors());
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
};
|
||||
|
||||
NS_IMPL_ISUPPORTS(FillMissingResponseHeaders, nsIHttpHeaderVisitor)
|
||||
} // namespace
|
||||
|
||||
void InternalHeaders::FillResponseHeaders(nsIRequest* aRequest) {
|
||||
@ -497,23 +471,8 @@ void InternalHeaders::FillResponseHeaders(nsIRequest* aRequest) {
|
||||
return;
|
||||
}
|
||||
|
||||
RefPtr<FillOriginalResponseHeaders> visitor =
|
||||
new FillOriginalResponseHeaders(this);
|
||||
// response headers received from fetch requires extra processing
|
||||
// we need the response headers received in original formats and also include
|
||||
// any headers internally added
|
||||
// nsIHttpChannel does not have any implemenation to give both types of
|
||||
// headers hence, we fetch them seperately and merge them first step is to get
|
||||
// the original response header
|
||||
nsresult rv = httpChannel->VisitOriginalResponseHeaders(visitor);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_WARNING("failed to fill headers");
|
||||
}
|
||||
|
||||
RefPtr<FillMissingResponseHeaders> visitMissingHeaders =
|
||||
new FillMissingResponseHeaders(this);
|
||||
rv = httpChannel->VisitResponseHeaders(visitMissingHeaders);
|
||||
|
||||
RefPtr<FillHeaders> visitor = new FillHeaders(this);
|
||||
nsresult rv = httpChannel->VisitResponseHeaders(visitor);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_WARNING("failed to fill headers");
|
||||
}
|
||||
|
@ -1121,8 +1121,7 @@ void XMLHttpRequestMainThread::GetAllResponseHeaders(
|
||||
if (nsCOMPtr<nsIHttpChannel> httpChannel = GetCurrentHttpChannel()) {
|
||||
RefPtr<nsHeaderVisitor> visitor =
|
||||
new nsHeaderVisitor(*this, WrapNotNull(httpChannel));
|
||||
if (NS_SUCCEEDED(httpChannel->VisitOriginalResponseHeaders(visitor))) {
|
||||
visitor->MergeDuplicateHeaders();
|
||||
if (NS_SUCCEEDED(httpChannel->VisitResponseHeaders(visitor))) {
|
||||
aResponseHeaders = visitor->Headers();
|
||||
}
|
||||
return;
|
||||
@ -1157,38 +1156,6 @@ void XMLHttpRequestMainThread::GetAllResponseHeaders(
|
||||
}
|
||||
}
|
||||
|
||||
namespace {
|
||||
// used for parsing headers with duplicate entries
|
||||
class nsResponseHeaderVisitor final : public nsIHttpHeaderVisitor {
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
nsResponseHeaderVisitor() = default;
|
||||
|
||||
NS_IMETHOD
|
||||
VisitHeader(const nsACString& aHeader, const nsACString& aValue) override {
|
||||
if (mIsHeaderPresent) {
|
||||
mValue.AppendLiteral(", ");
|
||||
}
|
||||
mValue.Append(aValue);
|
||||
mIsHeaderPresent = true;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void GetValue(nsACString& aValue) { aValue = mValue; }
|
||||
|
||||
private:
|
||||
nsCString mValue;
|
||||
|
||||
// indicates whether a header is already stored during parsing
|
||||
bool mIsHeaderPresent{false};
|
||||
|
||||
virtual ~nsResponseHeaderVisitor() = default;
|
||||
};
|
||||
|
||||
NS_IMPL_ISUPPORTS(nsResponseHeaderVisitor, nsIHttpHeaderVisitor)
|
||||
} // namespace
|
||||
|
||||
void XMLHttpRequestMainThread::GetResponseHeader(const nsACString& header,
|
||||
nsACString& _retval,
|
||||
ErrorResult& aRv) {
|
||||
@ -1249,16 +1216,11 @@ void XMLHttpRequestMainThread::GetResponseHeader(const nsACString& header,
|
||||
return;
|
||||
}
|
||||
|
||||
RefPtr<nsResponseHeaderVisitor> resposeHeaderVisitor =
|
||||
new nsResponseHeaderVisitor();
|
||||
|
||||
aRv = httpChannel->GetOriginalResponseHeader(header, resposeHeaderVisitor);
|
||||
aRv = httpChannel->GetResponseHeader(header, _retval);
|
||||
if (aRv.ErrorCodeIs(NS_ERROR_NOT_AVAILABLE)) {
|
||||
// Means no header
|
||||
_retval.SetIsVoid(true);
|
||||
aRv.SuppressException();
|
||||
} else if (!aRv.Failed()) {
|
||||
resposeHeaderVisitor->GetValue(_retval);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -571,36 +571,18 @@ class XMLHttpRequestMainThread final : public XMLHttpRequest,
|
||||
NS_DECL_NSIHTTPHEADERVISITOR
|
||||
nsHeaderVisitor(const XMLHttpRequestMainThread& aXMLHttpRequest,
|
||||
NotNull<nsIHttpChannel*> aHttpChannel);
|
||||
|
||||
void MergeDuplicateHeaders() {
|
||||
if (mHeaderList.IsEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
mHeaders.Append(mHeaderList.ElementAt(0).mName);
|
||||
mHeaders.AppendLiteral(": ");
|
||||
mHeaders.Append(mHeaderList.ElementAt(0).mValue);
|
||||
|
||||
for (uint32_t i = 1; i < mHeaderList.Length(); i++) {
|
||||
const nsACString& Headers() {
|
||||
for (uint32_t i = 0; i < mHeaderList.Length(); i++) {
|
||||
HeaderEntry& header = mHeaderList.ElementAt(i);
|
||||
HeaderEntry& prevHeader = mHeaderList.ElementAt(i - 1);
|
||||
|
||||
if (header.mName != prevHeader.mName) {
|
||||
mHeaders.AppendLiteral("\r\n");
|
||||
mHeaders.Append(header.mName);
|
||||
mHeaders.AppendLiteral(": ");
|
||||
mHeaders.Append(header.mValue);
|
||||
} else {
|
||||
mHeaders.AppendLiteral(", ");
|
||||
mHeaders.Append(header.mValue);
|
||||
}
|
||||
mHeaders.Append(header.mName);
|
||||
mHeaders.AppendLiteral(": ");
|
||||
mHeaders.Append(header.mValue);
|
||||
mHeaders.AppendLiteral("\r\n");
|
||||
}
|
||||
|
||||
mHeaders.AppendLiteral("\r\n");
|
||||
return mHeaders;
|
||||
}
|
||||
|
||||
const nsACString& Headers() { return mHeaders; }
|
||||
|
||||
private:
|
||||
virtual ~nsHeaderVisitor();
|
||||
|
||||
|
@ -231,10 +231,6 @@ void nsHttpHeaderArray::ClearHeader(const nsHttpAtom& header) {
|
||||
}
|
||||
}
|
||||
|
||||
void nsHttpHeaderArray::PurgeHeaderEntries(const nsHttpAtom& header) {
|
||||
mHeaders.RemoveElementsBy(
|
||||
[header](const auto& entry) { return (entry.header == header); });
|
||||
}
|
||||
const char* nsHttpHeaderArray::PeekHeader(const nsHttpAtom& header) const {
|
||||
const nsEntry* entry = nullptr;
|
||||
LookupEntry(header, &entry);
|
||||
@ -448,16 +444,12 @@ void nsHttpHeaderArray::FlattenOriginalHeader(nsACString& buf) {
|
||||
}
|
||||
}
|
||||
|
||||
const char* nsHttpHeaderArray::PeekHeaderAt(uint32_t index, nsHttpAtom& header,
|
||||
nsACString& headerNameOriginal,
|
||||
HeaderVariety& variety,
|
||||
nsACString& val) const {
|
||||
const char* nsHttpHeaderArray::PeekHeaderAt(
|
||||
uint32_t index, nsHttpAtom& header, nsACString& headerNameOriginal) const {
|
||||
const nsEntry& entry = mHeaders[index];
|
||||
|
||||
header = entry.header;
|
||||
headerNameOriginal = entry.headerNameOriginal;
|
||||
variety = entry.variety;
|
||||
val = entry.value;
|
||||
return entry.value.get();
|
||||
}
|
||||
|
||||
|
@ -82,8 +82,6 @@ class nsHttpHeaderArray {
|
||||
nsIHttpHeaderVisitor* aVisitor);
|
||||
void ClearHeader(const nsHttpAtom& h);
|
||||
|
||||
void PurgeHeaderEntries(const nsHttpAtom& header);
|
||||
|
||||
// Find the location of the given header value, or null if none exists.
|
||||
const char* FindHeaderValue(const nsHttpAtom& header,
|
||||
const char* value) const {
|
||||
@ -119,8 +117,7 @@ class nsHttpHeaderArray {
|
||||
uint32_t Count() const { return mHeaders.Length(); }
|
||||
|
||||
const char* PeekHeaderAt(uint32_t i, nsHttpAtom& header,
|
||||
nsACString& headerNameOriginal,
|
||||
HeaderVariety& variety, nsACString& val) const;
|
||||
nsACString& headerNameOriginal) const;
|
||||
|
||||
void Clear();
|
||||
|
||||
|
@ -163,10 +163,12 @@ nsresult nsHttpResponseHead::SetHeader(const nsHttpAtom& hdr,
|
||||
return SetHeader_locked(hdr, ""_ns, val, merge);
|
||||
}
|
||||
|
||||
nsresult nsHttpResponseHead::SetHeader_locked(
|
||||
const nsHttpAtom& atom, const nsACString& hdr, const nsACString& val,
|
||||
bool merge, const nsHttpHeaderArray::HeaderVariety& variety) {
|
||||
nsresult rv = mHeaders.SetHeader(atom, hdr, val, merge, variety);
|
||||
nsresult nsHttpResponseHead::SetHeader_locked(const nsHttpAtom& atom,
|
||||
const nsACString& hdr,
|
||||
const nsACString& val,
|
||||
bool merge) {
|
||||
nsresult rv = mHeaders.SetHeader(atom, hdr, val, merge,
|
||||
nsHttpHeaderArray::eVarietyResponse);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// respond to changes in these headers. we need to reparse the entire
|
||||
@ -891,95 +893,48 @@ bool nsHttpResponseHead::ExpiresInPast_locked() const {
|
||||
NS_SUCCEEDED(GetDateValue_locked(&dateVal)) && expiresVal < dateVal;
|
||||
}
|
||||
|
||||
void nsHttpResponseHead::UpdateOriginalHeaders(nsHttpResponseHead* aOther) {
|
||||
mRecursiveMutex.AssertCurrentThreadIn();
|
||||
aOther->mRecursiveMutex.AssertCurrentThreadIn();
|
||||
|
||||
uint32_t i, count = aOther->mHeaders.Count();
|
||||
|
||||
// container to maintain a list of entries purged
|
||||
nsTHashSet<nsCString> purgedEntries;
|
||||
|
||||
for (i = 0; i < count; ++i) {
|
||||
nsHttpAtom header;
|
||||
nsHttpHeaderArray::HeaderVariety variety;
|
||||
nsAutoCString headerNameOriginal;
|
||||
nsAutoCString val;
|
||||
|
||||
if (!aOther->mHeaders.PeekHeaderAt(i, header, headerNameOriginal, variety,
|
||||
val)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (CanIgnoreResponseHeaderTypes(header) ||
|
||||
!IsOriginalResponseHeader(variety)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// remove old response header entries as we have received updated
|
||||
// response headers from 304/206 response
|
||||
if (purgedEntries.EnsureInserted(header.val())) {
|
||||
mHeaders.PurgeHeaderEntries(header);
|
||||
}
|
||||
|
||||
DebugOnly<nsresult> rv =
|
||||
mHeaders.SetHeaderFromNet(header, headerNameOriginal, val, true);
|
||||
MOZ_ASSERT(NS_SUCCEEDED(rv));
|
||||
}
|
||||
}
|
||||
|
||||
bool nsHttpResponseHead::CanIgnoreResponseHeaderTypes(
|
||||
const nsHttpAtom& header) const {
|
||||
return (header == nsHttp::Connection || header == nsHttp::Proxy_Connection ||
|
||||
header == nsHttp::Keep_Alive ||
|
||||
header == nsHttp::Proxy_Authenticate ||
|
||||
header == nsHttp::Proxy_Authorization ||
|
||||
// not a response header!
|
||||
header == nsHttp::TE || header == nsHttp::Trailer ||
|
||||
header == nsHttp::Transfer_Encoding || header == nsHttp::Upgrade ||
|
||||
// Ignore any non-modifiable headers...
|
||||
header == nsHttp::Content_Location || header == nsHttp::Content_MD5 ||
|
||||
header == nsHttp::ETag ||
|
||||
// Assume Cache-Control: "no-transform"
|
||||
header == nsHttp::Content_Encoding ||
|
||||
header == nsHttp::Content_Range || header == nsHttp::Content_Type ||
|
||||
// Ignore wacky headers too...
|
||||
// this one is for MS servers that send "Content-Length: 0"
|
||||
// on 304 responses
|
||||
header == nsHttp::Content_Length);
|
||||
}
|
||||
|
||||
void nsHttpResponseHead::UpdateHeaders(nsHttpResponseHead* aOther) {
|
||||
LOG(("nsHttpResponseHead::UpdateHeaders [this=%p]\n", this));
|
||||
|
||||
RecursiveMutexAutoLock monitor(mRecursiveMutex);
|
||||
RecursiveMutexAutoLock monitorOther(aOther->mRecursiveMutex);
|
||||
|
||||
UpdateOriginalHeaders(aOther);
|
||||
|
||||
uint32_t i, count = aOther->mHeaders.Count();
|
||||
|
||||
for (i = 0; i < count; ++i) {
|
||||
nsHttpAtom header;
|
||||
nsAutoCString headerNameOriginal;
|
||||
nsHttpHeaderArray::HeaderVariety variety;
|
||||
nsAutoCString val;
|
||||
|
||||
if (!aOther->mHeaders.PeekHeaderAt(i, header, headerNameOriginal, variety,
|
||||
val)) {
|
||||
if (!aOther->mHeaders.PeekHeaderAt(i, header, headerNameOriginal)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (CanIgnoreResponseHeaderTypes(header)) {
|
||||
nsAutoCString val;
|
||||
if (NS_FAILED(aOther->GetHeader(header, val))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Ignore any hop-by-hop headers...
|
||||
if (header == nsHttp::Connection || header == nsHttp::Proxy_Connection ||
|
||||
header == nsHttp::Keep_Alive || header == nsHttp::Proxy_Authenticate ||
|
||||
header == nsHttp::Proxy_Authorization || // not a response header!
|
||||
header == nsHttp::TE || header == nsHttp::Trailer ||
|
||||
header == nsHttp::Transfer_Encoding || header == nsHttp::Upgrade ||
|
||||
// Ignore any non-modifiable headers...
|
||||
header == nsHttp::Content_Location || header == nsHttp::Content_MD5 ||
|
||||
header == nsHttp::ETag ||
|
||||
// Assume Cache-Control: "no-transform"
|
||||
header == nsHttp::Content_Encoding || header == nsHttp::Content_Range ||
|
||||
header == nsHttp::Content_Type ||
|
||||
// Ignore wacky headers too...
|
||||
// this one is for MS servers that send "Content-Length: 0"
|
||||
// on 304 responses
|
||||
header == nsHttp::Content_Length) {
|
||||
LOG(("ignoring response header [%s: %s]\n", header.get(), val.get()));
|
||||
} else {
|
||||
LOG(("new response header [%s: %s]\n", header.get(), val.get()));
|
||||
|
||||
if (NS_FAILED(aOther->GetHeader(header, val))) {
|
||||
continue;
|
||||
}
|
||||
// overwrite the current header value with the new value...
|
||||
DebugOnly<nsresult> rv =
|
||||
// overwrite the current header value with the new value...
|
||||
SetHeader_locked(header, headerNameOriginal, val);
|
||||
MOZ_ASSERT(NS_SUCCEEDED(rv));
|
||||
}
|
||||
|
@ -147,11 +147,10 @@ class nsHttpResponseHead {
|
||||
bool GetContentTypeOptionsHeader(nsACString& aOutput) const;
|
||||
|
||||
private:
|
||||
[[nodiscard]] nsresult SetHeader_locked(
|
||||
const nsHttpAtom& atom, const nsACString& h, const nsACString& v,
|
||||
bool m = false,
|
||||
const nsHttpHeaderArray::HeaderVariety& variety =
|
||||
nsHttpHeaderArray::eVarietyResponse) MOZ_REQUIRES(mRecursiveMutex);
|
||||
[[nodiscard]] nsresult SetHeader_locked(const nsHttpAtom& atom,
|
||||
const nsACString& h,
|
||||
const nsACString& v, bool m = false)
|
||||
MOZ_REQUIRES(mRecursiveMutex);
|
||||
void AssignDefaultStatusText() MOZ_REQUIRES(mRecursiveMutex);
|
||||
void ParseVersion(const char*) MOZ_REQUIRES(mRecursiveMutex);
|
||||
void ParseCacheControl(const char*) MOZ_REQUIRES(mRecursiveMutex);
|
||||
@ -199,19 +198,6 @@ class nsHttpResponseHead {
|
||||
return mHasCacheControl ? mCacheControlNoCache : mPragmaNoCache;
|
||||
}
|
||||
|
||||
// update original response headers
|
||||
void UpdateOriginalHeaders(nsHttpResponseHead* aOther);
|
||||
|
||||
// headers that can be ignored for a 304/206 response
|
||||
bool CanIgnoreResponseHeaderTypes(const nsHttpAtom& header) const;
|
||||
|
||||
bool IsOriginalResponseHeader(
|
||||
const nsHttpHeaderArray::HeaderVariety variety) const {
|
||||
return (
|
||||
(variety == nsHttpHeaderArray::eVarietyResponseNetOriginal) ||
|
||||
(variety == nsHttpHeaderArray::eVarietyResponseNetOriginalAndResponse));
|
||||
}
|
||||
|
||||
private:
|
||||
// All members must be copy-constructable and assignable
|
||||
nsHttpHeaderArray mHeaders MOZ_GUARDED_BY(mRecursiveMutex);
|
||||
|
@ -1,15 +1,62 @@
|
||||
[header-value-combining.any.worker.html]
|
||||
expected:
|
||||
if (os == "android") and fission: [OK, TIMEOUT]
|
||||
[response.headers.get('content-length') expects 0, 0]
|
||||
expected: FAIL
|
||||
|
||||
[response.headers.get('double-trouble') expects , ]
|
||||
expected: FAIL
|
||||
|
||||
[response.headers.get('heya') expects , \x0b\x0c, 1, , , 2]
|
||||
expected: FAIL
|
||||
|
||||
[response.headers.get('www-authenticate') expects 1, 2, 3, 4]
|
||||
expected: FAIL
|
||||
|
||||
|
||||
[header-value-combining.any.serviceworker.html]
|
||||
expected:
|
||||
if (os == "android") and fission: [OK, TIMEOUT]
|
||||
[response.headers.get('content-length') expects 0, 0]
|
||||
expected: FAIL
|
||||
|
||||
[response.headers.get('double-trouble') expects , ]
|
||||
expected: FAIL
|
||||
|
||||
[response.headers.get('heya') expects , \x0b\x0c, 1, , , 2]
|
||||
expected: FAIL
|
||||
|
||||
[response.headers.get('www-authenticate') expects 1, 2, 3, 4]
|
||||
expected: FAIL
|
||||
|
||||
|
||||
[header-value-combining.any.sharedworker.html]
|
||||
expected:
|
||||
if (os == "android") and fission: [OK, TIMEOUT]
|
||||
[response.headers.get('content-length') expects 0, 0]
|
||||
expected: FAIL
|
||||
|
||||
[response.headers.get('double-trouble') expects , ]
|
||||
expected: FAIL
|
||||
|
||||
[response.headers.get('heya') expects , \x0b\x0c, 1, , , 2]
|
||||
expected: FAIL
|
||||
|
||||
[response.headers.get('www-authenticate') expects 1, 2, 3, 4]
|
||||
expected: FAIL
|
||||
|
||||
|
||||
[header-value-combining.any.html]
|
||||
expected:
|
||||
if (os == "android") and fission: [OK, TIMEOUT]
|
||||
[response.headers.get('content-length') expects 0, 0]
|
||||
expected: FAIL
|
||||
|
||||
[response.headers.get('double-trouble') expects , ]
|
||||
expected: FAIL
|
||||
|
||||
[response.headers.get('heya') expects , \x0b\x0c, 1, , , 2]
|
||||
expected: FAIL
|
||||
|
||||
[response.headers.get('www-authenticate') expects 1, 2, 3, 4]
|
||||
expected: FAIL
|
||||
|
@ -0,0 +1,14 @@
|
||||
[api-and-duplicate-headers.any.html]
|
||||
[fetch() and duplicate Content-Length/Content-Type headers]
|
||||
expected: FAIL
|
||||
|
||||
[XMLHttpRequest and duplicate Content-Length/Content-Type headers]
|
||||
expected: FAIL
|
||||
|
||||
|
||||
[api-and-duplicate-headers.any.worker.html]
|
||||
[fetch() and duplicate Content-Length/Content-Type headers]
|
||||
expected: FAIL
|
||||
|
||||
[XMLHttpRequest and duplicate Content-Length/Content-Type headers]
|
||||
expected: FAIL
|
@ -5,6 +5,9 @@
|
||||
[Request: combined response Content-Type: */* text/html]
|
||||
expected: FAIL
|
||||
|
||||
[Response: combined response Content-Type: text/html */*]
|
||||
expected: FAIL
|
||||
|
||||
[fetch(): separate response Content-Type: */* text/html]
|
||||
expected: FAIL
|
||||
|
||||
@ -20,6 +23,9 @@
|
||||
[fetch(): combined response Content-Type: */* text/html]
|
||||
expected: FAIL
|
||||
|
||||
[Request: combined response Content-Type: text/html */*]
|
||||
expected: FAIL
|
||||
|
||||
[Request: combined response Content-Type: text/plain;charset=gbk text/plain;charset=windows-1252]
|
||||
expected: FAIL
|
||||
|
||||
@ -44,12 +50,24 @@
|
||||
[<iframe>: separate response Content-Type: text/plain;charset=gbk text/html]
|
||||
expected: FAIL
|
||||
|
||||
[fetch(): combined response Content-Type: text/html */*;charset=gbk]
|
||||
expected: FAIL
|
||||
|
||||
[fetch(): combined response Content-Type: text/plain;charset=gbk text/plain]
|
||||
expected: FAIL
|
||||
|
||||
[Request: combined response Content-Type: text/html text/plain]
|
||||
expected: FAIL
|
||||
|
||||
[Request: combined response Content-Type: text/plain */*]
|
||||
expected: FAIL
|
||||
|
||||
[fetch(): separate response Content-Type: text/html;charset=gbk text/plain text/html]
|
||||
expected: FAIL
|
||||
|
||||
[Request: combined response Content-Type: text/plain;charset=gbk text/plain]
|
||||
expected: FAIL
|
||||
|
||||
[fetch(): combined response Content-Type: text/plain;charset=gbk text/html]
|
||||
expected: FAIL
|
||||
|
||||
@ -68,9 +86,18 @@
|
||||
[Request: combined response Content-Type: text/html;x=" text/plain]
|
||||
expected: FAIL
|
||||
|
||||
[Response: combined response Content-Type: text/plain */*]
|
||||
expected: FAIL
|
||||
|
||||
[Request: combined response Content-Type: text/html */*;charset=gbk]
|
||||
expected: FAIL
|
||||
|
||||
[Response: combined response Content-Type: text/html;x=" text/plain]
|
||||
expected: FAIL
|
||||
|
||||
[fetch(): combined response Content-Type: text/html */*]
|
||||
expected: FAIL
|
||||
|
||||
[Response: combined response Content-Type: text/html;" text/plain]
|
||||
expected: FAIL
|
||||
|
||||
@ -104,21 +131,45 @@
|
||||
[fetch(): combined response Content-Type: text/html;charset=gbk text/html;x=",text/plain]
|
||||
expected: FAIL
|
||||
|
||||
[fetch(): combined response Content-Type: text/plain */*]
|
||||
expected: FAIL
|
||||
|
||||
[Request: combined response Content-Type: text/plain */*;charset=gbk]
|
||||
expected: FAIL
|
||||
|
||||
[fetch(): separate response Content-Type: text/plain;charset=gbk text/html;charset=windows-1254]
|
||||
expected: FAIL
|
||||
|
||||
[fetch(): combined response Content-Type: text/plain */*;charset=gbk]
|
||||
expected: FAIL
|
||||
|
||||
[fetch(): combined response Content-Type: text/plain;charset=gbk text/plain;charset=windows-1252]
|
||||
expected: FAIL
|
||||
|
||||
[Response: combined response Content-Type: text/plain;charset=gbk text/plain]
|
||||
expected: FAIL
|
||||
|
||||
[fetch(): separate response Content-Type: text/html text/plain]
|
||||
expected: FAIL
|
||||
|
||||
[Request: combined response Content-Type: text/html;" text/plain]
|
||||
expected: FAIL
|
||||
|
||||
[Response: combined response Content-Type: text/plain */*;charset=gbk]
|
||||
expected: FAIL
|
||||
|
||||
[Request: combined response Content-Type: text/html;charset=gbk text/html;x=",text/plain]
|
||||
expected: FAIL
|
||||
|
||||
[Response: combined response Content-Type: text/html */*;charset=gbk]
|
||||
expected: FAIL
|
||||
|
||||
[fetch(): combined response Content-Type: text/plain ]
|
||||
expected: FAIL
|
||||
|
||||
[Response: combined response Content-Type: text/plain ]
|
||||
expected: FAIL
|
||||
|
||||
[fetch(): separate response Content-Type: text/plain]
|
||||
expected: FAIL
|
||||
|
||||
@ -131,6 +182,9 @@
|
||||
[fetch(): combined response Content-Type: text/plain]
|
||||
expected: FAIL
|
||||
|
||||
[Request: combined response Content-Type: text/plain ]
|
||||
expected: FAIL
|
||||
|
||||
[fetch(): separate response Content-Type: text/html;" \\" text/plain]
|
||||
expected: FAIL
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,3 +1,36 @@
|
||||
[navigation-sets-cookie.https.html]
|
||||
expected:
|
||||
if (os == "android") and fission: [OK, TIMEOUT]
|
||||
TIMEOUT
|
||||
[Same-site top-level navigation with passthrough service worker should be able to set SameSite=* cookies.]
|
||||
expected: TIMEOUT
|
||||
|
||||
[Cross-site top-level navigation with passthrough service worker should be able to set SameSite=* cookies.]
|
||||
expected: NOTRUN
|
||||
|
||||
[Same-site top-level POST with passthrough service worker should be able to set SameSite=* cookies.]
|
||||
expected: NOTRUN
|
||||
|
||||
[Cross-site top-level with passthrough service worker POST should be able to set SameSite=* cookies.]
|
||||
expected: NOTRUN
|
||||
|
||||
[Same-site top-level navigation with navpreload service worker should be able to set SameSite=* cookies.]
|
||||
expected: NOTRUN
|
||||
|
||||
[Cross-site top-level navigation with navpreload service worker should be able to set SameSite=* cookies.]
|
||||
expected: NOTRUN
|
||||
|
||||
[Same-site top-level navigation with change-request service worker should be able to set SameSite=* cookies.]
|
||||
expected: NOTRUN
|
||||
|
||||
[Cross-site top-level navigation with change-request service worker should be able to set SameSite=* cookies.]
|
||||
expected: NOTRUN
|
||||
|
||||
[Same-site top-level POST with change-request service worker should be able to set SameSite=* cookies.]
|
||||
expected: NOTRUN
|
||||
|
||||
[Cross-site top-level with change-request service worker POST should be able to set SameSite=* cookies.]
|
||||
expected: NOTRUN
|
||||
|
||||
[Cleanup service workers]
|
||||
expected: NOTRUN
|
||||
|
@ -2,32 +2,192 @@
|
||||
prefs: [network.cookie.sameSite.laxByDefault:true]
|
||||
expected:
|
||||
if (os == "android") and fission: [OK, TIMEOUT]
|
||||
TIMEOUT
|
||||
[cross-site, form post with no service worker]
|
||||
expected: FAIL
|
||||
expected: NOTRUN
|
||||
|
||||
[cross-site, form post with fallback]
|
||||
expected: FAIL
|
||||
expected: NOTRUN
|
||||
|
||||
[cross-site, form post with passthrough]
|
||||
expected: FAIL
|
||||
expected: NOTRUN
|
||||
|
||||
[same-origin, form post with no service worker and cross-site redirect]
|
||||
expected: FAIL
|
||||
expected: NOTRUN
|
||||
|
||||
[same-origin, form post with fallback and cross-site redirect]
|
||||
expected: FAIL
|
||||
expected: NOTRUN
|
||||
|
||||
[same-origin, form post with passthrough and cross-site redirect]
|
||||
expected: FAIL
|
||||
expected: NOTRUN
|
||||
|
||||
[same-origin, form post with no service worker, cross-site redirect, and same-origin redirect]
|
||||
expected: FAIL
|
||||
expected: NOTRUN
|
||||
|
||||
[same-origin, form post with fallback, cross-site redirect, and same-origin redirect]
|
||||
expected: FAIL
|
||||
expected: NOTRUN
|
||||
|
||||
[same-origin, form post with passthrough, cross-site redirect, and same-origin redirect]
|
||||
expected: FAIL
|
||||
expected: NOTRUN
|
||||
|
||||
[same-origin, nested set location with cross-site middle frame and change-request service worker]
|
||||
expected: FAIL
|
||||
expected: NOTRUN
|
||||
|
||||
[same-origin, window.open with passthrough]
|
||||
expected: TIMEOUT
|
||||
|
||||
[same-origin, window.open with change-request]
|
||||
expected: NOTRUN
|
||||
|
||||
[same-origin, window.open with navpreload]
|
||||
expected: NOTRUN
|
||||
|
||||
[same-site, window.open with no service worker]
|
||||
expected: NOTRUN
|
||||
|
||||
[same-site, window.open with fallback]
|
||||
expected: NOTRUN
|
||||
|
||||
[same-site, window.open with passthrough]
|
||||
expected: NOTRUN
|
||||
|
||||
[same-site, window.open with change-request]
|
||||
expected: NOTRUN
|
||||
|
||||
[same-site, window.open with navpreload]
|
||||
expected: NOTRUN
|
||||
|
||||
[cross-site, window.open with no service worker]
|
||||
expected: NOTRUN
|
||||
|
||||
[cross-site, window.open with fallback]
|
||||
expected: NOTRUN
|
||||
|
||||
[cross-site, window.open with passthrough]
|
||||
expected: NOTRUN
|
||||
|
||||
[cross-site, window.open with change-request]
|
||||
expected: NOTRUN
|
||||
|
||||
[cross-site, window.open with navpreload]
|
||||
expected: NOTRUN
|
||||
|
||||
[same-origin, window.open with no service worker and same-site redirect]
|
||||
expected: NOTRUN
|
||||
|
||||
[same-origin, window.open with fallback and same-site redirect]
|
||||
expected: NOTRUN
|
||||
|
||||
[same-origin, window.open with passthrough and same-site redirect]
|
||||
expected: NOTRUN
|
||||
|
||||
[same-origin, window.open with change-request and same-site redirect]
|
||||
expected: NOTRUN
|
||||
|
||||
[same-origin, window.open with navpreload and same-site redirect]
|
||||
expected: NOTRUN
|
||||
|
||||
[same-origin, window.open with no service worker and cross-site redirect]
|
||||
expected: NOTRUN
|
||||
|
||||
[same-origin, window.open with fallback and cross-site redirect]
|
||||
expected: NOTRUN
|
||||
|
||||
[same-origin, window.open with passthrough and cross-site redirect]
|
||||
expected: NOTRUN
|
||||
|
||||
[same-origin, window.open with change-request and cross-site redirect]
|
||||
expected: NOTRUN
|
||||
|
||||
[same-origin, window.open with navpreload and cross-site redirect]
|
||||
expected: NOTRUN
|
||||
|
||||
[same-origin, window.open with no service worker, cross-site redirect, and same-origin redirect]
|
||||
expected: NOTRUN
|
||||
|
||||
[same-origin, window.open with fallback, cross-site redirect, and same-origin redirect]
|
||||
expected: NOTRUN
|
||||
|
||||
[same-origin, window.open with passthrough, cross-site redirect, and same-origin redirect]
|
||||
expected: NOTRUN
|
||||
|
||||
[same-origin, window.open with change-request, cross-site redirect, and same-origin redirect]
|
||||
expected: NOTRUN
|
||||
|
||||
[same-origin, window.open with navpreload, cross-site redirect, and same-origin redirect]
|
||||
expected: NOTRUN
|
||||
|
||||
[same-origin, nested window.open with cross-site middle frame and no service worker]
|
||||
expected: NOTRUN
|
||||
|
||||
[same-origin, nested window.open with cross-site middle frame and fallback service worker]
|
||||
expected: NOTRUN
|
||||
|
||||
[same-origin, nested window.open with cross-site middle frame and passthrough service worker]
|
||||
expected: NOTRUN
|
||||
|
||||
[same-origin, nested window.open with cross-site middle frame and change-request service worker]
|
||||
expected: NOTRUN
|
||||
|
||||
[same-origin, nested window.open with cross-site middle frame and navpreload service worker]
|
||||
expected: NOTRUN
|
||||
|
||||
[same-origin, nested set location with cross-site middle frame and no service worker]
|
||||
expected: NOTRUN
|
||||
|
||||
[same-origin, nested set location with cross-site middle frame and fallback service worker]
|
||||
expected: NOTRUN
|
||||
|
||||
[same-origin, nested set location with cross-site middle frame and passthrough service worker]
|
||||
expected: NOTRUN
|
||||
|
||||
[same-origin, nested set location with cross-site middle frame and navpreload service worker]
|
||||
expected: NOTRUN
|
||||
|
||||
[same-origin, form post with no service worker]
|
||||
expected: NOTRUN
|
||||
|
||||
[same-origin, form post with fallback]
|
||||
expected: NOTRUN
|
||||
|
||||
[same-origin, form post with passthrough]
|
||||
expected: NOTRUN
|
||||
|
||||
[same-origin, form post with change-request]
|
||||
expected: NOTRUN
|
||||
|
||||
[same-site, form post with no service worker]
|
||||
expected: NOTRUN
|
||||
|
||||
[same-site, form post with fallback]
|
||||
expected: NOTRUN
|
||||
|
||||
[same-site, form post with passthrough]
|
||||
expected: NOTRUN
|
||||
|
||||
[same-site, form post with change-request]
|
||||
expected: NOTRUN
|
||||
|
||||
[cross-site, form post with change-request]
|
||||
expected: NOTRUN
|
||||
|
||||
[same-origin, form post with no service worker and same-site redirect]
|
||||
expected: NOTRUN
|
||||
|
||||
[same-origin, form post with fallback and same-site redirect]
|
||||
expected: NOTRUN
|
||||
|
||||
[same-origin, form post with passthrough and same-site redirect]
|
||||
expected: NOTRUN
|
||||
|
||||
[same-origin, form post with change-request and same-site redirect]
|
||||
expected: NOTRUN
|
||||
|
||||
[same-origin, form post with change-request and cross-site redirect]
|
||||
expected: NOTRUN
|
||||
|
||||
[same-origin, form post with change-request, cross-site redirect, and same-origin redirect]
|
||||
expected: NOTRUN
|
||||
|
||||
[Cleanup service workers]
|
||||
expected: NOTRUN
|
||||
|
@ -1,3 +1,5 @@
|
||||
[xhr-content-length.https.window.html]
|
||||
expected:
|
||||
if (os == "android") and fission: [OK, TIMEOUT]
|
||||
[Synthetic response with two Content-Length headers value larger than response body length]
|
||||
expected: FAIL
|
||||
|
@ -1,3 +1,14 @@
|
||||
[getallresponseheaders.htm]
|
||||
expected:
|
||||
if (os == "android") and fission: [OK, TIMEOUT]
|
||||
[XMLHttpRequest: getAllResponseHeaders() 2]
|
||||
expected: FAIL
|
||||
|
||||
[XMLHttpRequest: getAllResponseHeaders() 3]
|
||||
expected: FAIL
|
||||
|
||||
[XMLHttpRequest: getAllResponseHeaders() 5]
|
||||
expected: FAIL
|
||||
|
||||
[XMLHttpRequest: getAllResponseHeaders() 6]
|
||||
expected: FAIL
|
||||
|
@ -1,7 +1,30 @@
|
||||
[getresponseheader.any.worker.html]
|
||||
expected:
|
||||
if (os == "android") and fission: [OK, TIMEOUT]
|
||||
[getResponseHeader('content-length') expects 0, 0]
|
||||
expected: FAIL
|
||||
|
||||
[getResponseHeader('double-trouble') expects , ]
|
||||
expected: FAIL
|
||||
|
||||
[getResponseHeader('heya') expects , \x0b\x0c, 1, , , 2]
|
||||
expected: FAIL
|
||||
|
||||
[getResponseHeader('www-authenticate') expects 1, 2, 3, 4]
|
||||
expected: FAIL
|
||||
|
||||
|
||||
[getresponseheader.any.html]
|
||||
expected:
|
||||
if (os == "android") and fission: [OK, TIMEOUT]
|
||||
[getResponseHeader('content-length') expects 0, 0]
|
||||
expected: FAIL
|
||||
|
||||
[getResponseHeader('double-trouble') expects , ]
|
||||
expected: FAIL
|
||||
|
||||
[getResponseHeader('heya') expects , \x0b\x0c, 1, , , 2]
|
||||
expected: FAIL
|
||||
|
||||
[getResponseHeader('www-authenticate') expects 1, 2, 3, 4]
|
||||
expected: FAIL
|
||||
|
Loading…
Reference in New Issue
Block a user