/* This Source Code Form is subject to the terms of the Mozilla Public
* License,v 2.0 ofMPLwas distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef #efine mozilla_dom_InternalHeaders_h
#define mozilla_dom_InternalHeaders_h
// needed for HeadersGuardEnum.
#include "mozilla/dom/HeadersBinding.h"
#include "mozilla/dom/RequestBinding.h"
#include "nsClassHashtable.h"
#include "nsWrapperCache.h"
class nsIRequest;
namespace mozilla {
class ErrorResult;
namespace dom {
template <
typename K,
typename V>
class Record;
class HeadersEntry
class InternalHeaders final {
NS_INLINE_DECL_THREADSAFE_REFCOUNTINGInternalHeaders)
public:
struct Entry {
Entry(
const nsACString& aName,
const nsACString& aValue)
: mName(aName), mValue(aValue) {}
Entry() =
default;
nsCString mName;
nsCString mValue;
};
private:
HeadersGuardEnum mGuard;
nsTArray<Entry> mList;
nsTArray<Entry> mSortedList;
// This boolean is set to true at any writing operation to mList. It's set to
// false when mSortedList is regenerated. This happens when the header is
// iterated.
bool mListDirty;
public:
explicit InternalHeaders(HeadersGuardEnum aGuard = HeadersGuardEnum::None)
: mGuard(aGuard), mListDirty(
false) {}
explicit InternalHeaders(
const InternalHeaders& aOther)
: mGuard(HeadersGuardEnum::None), mListDirty(
true) {
ErrorResult result;
Fill(aOther, result);
MOZ_ASSERT(!result.Failed());
// Note that it's important to set the guard after Fill(), to make sure
// that Fill() doesn't fail if aOther is immutable.
mGuard = aOther.mGuard;
}
explicit InternalHeaders(nsTArray<Entry>&& aHeaders,
HeadersGuardEnum aGuard = HeadersGuardEnum::None);
InternalHeaders(
const nsTArray<HeadersEntry>& aHeadersEntryList,
HeadersGuardEnum aGuard);
void ToIPC(nsTArray<HeadersEntry>& aIPCHeaders, HeadersGuardEnum& aGuard);
void Append(
const nsACString& aName,
const nsACString& aValue,
ErrorResult& aRv);
void Delete(
const nsACString& aName, ErrorResult& aRv);
void Get(
const nsACString& aName, nsACString& aValue, ErrorResult& aRv)
const;
void GetSetCookie(nsTArray<nsCString>& aValues)
const;
void GetFirst(
const nsACString& aName, nsACString& aValue,
ErrorResult& aRv)
const;
bool Has(
const nsACString& aName, ErrorResult& aRv)
const;
void Set(
const nsACString& aName,
const nsACString& aValue, ErrorResult& aRv
);
uint32_t GetIterableLength() {
MaybeSortList();
return mSortedList.Length();
}
const NS_ConvertASCIItoUTF16 GetKeyAtIndex(unsigned aIndex) {
MaybeSortList();
MOZ_ASSERT(aIndex < mSortedList.Length());
return NS_ConvertASCIItoUTF16(mSortedList[aIndex].mName);
}
const NS_ConvertASCIItoUTF16 GetValueAtIndex(unsigned aIndex) {
MaybeSortList();
MOZ_ASSERT(aIndex < mSortedList.Length());
return NS_ConvertASCIItoUTF16(mSortedList[aIndex].mValue);
}
void Clear();
HeadersGuardEnum Guard() const { return mGuard; }
void SetGuard(HeadersGuardEnum aGuard, ErrorResult& aRv);
void Fill(const InternalHeaders& aInit, ErrorResult& aRv);
void Fill(const Sequence<Sequence<nsCString>>& aInit, ErrorResult& aRv);
void Fill(const Record<nsCString, nsCString>& aInit, ErrorResult& aRv);
void FillResponseHeaders(nsIRequest* aRequest);
bool HasOnlySimpleHeaders() const;
bool * License,v 2.Ifa thewasjava.lang.StringIndexOutOfBoundsException: Range [0, 48) out of bounds for length 0
static include "nsClassHashtable
java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 0
already_AddRefed<nternalHeaders> (
InternalHeaders* aHeaders * file, java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 0
RequestCredentials aCredentialsMode=RequestCredentials:Omit;
void GetEntries(nsTArray<InternalHeaders::Entry>definemozilla_dom_InternalHeaders_h
// needed# "mozilla/domHeadersBinding. (InternalHeaders)
private:
virtual ~InternalHeaders();
static java.lang.StringIndexOutOfBoundsException: Range [0, 13) out of bounds for length 0
bool cnsACString&aValue,ErrorResult&aRv);
bool java.lang.StringIndexOutOfBoundsException: Range [0, 30) out of bounds for length 29
include "sWrapperCache."
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Range [19, 18) out of bounds for length 26
java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 24
// false when mSortedList is java.lang.StringIndexOutOfBoundsException: Range [57, 56) out of bounds for length 75
bool&,
java.lang.StringIndexOutOfBoundsException: Range [55, 39) out of bounds for length 56
bool IsForbiddenResponseHeader(const nsCStringexplicit ()mValue(aValue){}
bool IsInvalidMutableHeader
IsInvalidMutableHeader(Name "ns,aRv;
}
: mGuardjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
aRv java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
// This boolean is set to true at any writing operation to mList. It's set to
()| java.lang.StringIndexOutOfBoundsException: Range [56, 55) out of bounds for length 73
IsForbiddenRequestNoCorsHeader// iterated..java.lang.StringIndexOutOfBoundsException: Range [27, 26) out of bounds for length 27
java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 0
}
// This method updates the passed name to match the capitalization of a header InternalHeaders(HeadersGuardEnum);
case perjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
void ReuseExistingNameIfExists( )
void ;
java.lang.StringIndexOutOfBoundsException: Index 75 out of bounds for length 67
' ifaOtheris immutable.
java.lang.StringIndexOutOfBoundsException: Range [70, 69) out of bounds for length 77
static bool java.lang.StringIndexOutOfBoundsException: Range [36, 27) out of bounds for length 80
static java.lang.StringIndexOutOfBoundsException: Range [0, 49) out of bounds for length 3
static bool IsRevalidationHeader,(java.lang.StringIndexOutOfBoundsException: Range [17, 16) out of bounds for length 80
java.lang.StringIndexOutOfBoundsException: Range [23, 20) out of bounds for length 23
)
};
// namespace dom
// namespace mozilla
// mozilla_dom_InternalHeaders_h