/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
void SetBody(nsIInputStream* aBody, int64_t aBodySize) { if (mWrappedResponse) { return mWrappedResponse->SetBody(aBody, aBodySize);
} // A request's body may not be reset once set.
MOZ_ASSERT(!mBody);
MOZ_ASSERT(mBodySize == UNKNOWN_BODY_SIZE); // Check arguments.
MOZ_ASSERT(aBodySize == UNKNOWN_BODY_SIZE || aBodySize >= 0); // If body is not given, then size must be unknown.
MOZ_ASSERT_IF(!aBody, aBodySize == UNKNOWN_BODY_SIZE);
const nsCString& GetAlternativeDataType() { if (mWrappedResponse) { return mWrappedResponse->GetAlternativeDataType();
}
return mAlternativeDataType;
}
void SetAlternativeBody(nsIInputStream* aAlternativeBody) { if (mWrappedResponse) { return mWrappedResponse->SetAlternativeBody(aAlternativeBody);
} // A request's body may not be reset once set.
MOZ_DIAGNOSTIC_ASSERT(!mAlternativeBody);
mAlternativeBody = aAlternativeBody;
}
already_AddRefed<nsIInputStream> TakeAlternativeBody() { if (mWrappedResponse) { return mWrappedResponse->TakeAlternativeBody();
}
if (!mAlternativeBody) { return nullptr;
}
// cleanup the non-alternative body here. // Once alternative data is used, the real body is no need anymore.
mBody = nullptr;
mBodySize = UNKNOWN_BODY_SIZE; return mAlternativeBody.forget();
}
// Returns an instance of InternalResponse which is a copy of this // InternalResponse, except headers, body and wrapped response (if any) which // are left uninitialized. Used for cloning and filtering.
SafeRefPtr<InternalResponse> CreateIncompleteCopy();
ResponseType mType; // A response has an associated url list (a list of zero or more fetch URLs). // Unless stated otherwise, it is the empty list. The current url is the last // element in mURLlist
nsTArray<nsCString> mURLList; const uint16_t mStatus; const nsCString mStatusText;
RefPtr<InternalHeaders> mHeaders;
nsCOMPtr<nsIInputStream> mBody;
nsCString mBodyBlobURISpec;
nsString mBodyLocalPath;
int64_t mBodySize; // It's used to passed to the CacheResponse to generate padding size. Once, we // generate the padding size for resposne, we don't need it anymore.
Maybe<uint32_t> mPaddingInfo;
int64_t mPaddingSize;
nsresult mErrorCode;
RequestCredentials mCredentialsMode;
// For alternative data such as JS Bytecode cached in the HTTP cache.
nsCString mAlternativeDataType;
nsCOMPtr<nsIInputStream> mAlternativeBody;
nsMainThreadPtrHandle<nsICacheInfoChannel> mCacheInfoChannel; bool mCloned; // boolean to indicate the body/alternativeBody will be serialized as a // RemoteLazyInputStream. bool mSerializeAsLazy{true};
// For filtered responses. // Cache, and SW interception should always serialize/access the underlying // unfiltered headers and when deserializing, create an InternalResponse // with the unfiltered headers followed by wrapping it.
SafeRefPtr<InternalResponse> mWrappedResponse;
};
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.