Bug 1666723 - Expose and add a test r=dragana,necko-reviewers

Depends on D93137

Differential Revision: https://phabricator.services.mozilla.com/D93922
This commit is contained in:
Hubert Boma Manilla 2020-10-22 23:23:53 +00:00
Родитель f6df481788
Коммит 7001145b00
7 изменённых файлов: 25 добавлений и 3 удалений

Просмотреть файл

@ -169,6 +169,7 @@ HttpBaseChannel::HttpBaseChannel()
mTransferSize(0),
mRequestSize(0),
mDecodedBodySize(0),
mSupportsHTTP3(false),
mEncodedBodySize(0),
mRequestContextID(0),
mContentWindowId(0),
@ -1568,6 +1569,12 @@ HttpBaseChannel::GetEncodedBodySize(uint64_t* aEncodedBodySize) {
return NS_OK;
}
NS_IMETHODIMP
HttpBaseChannel::GetSupportsHTTP3(bool* aSupportsHTTP3) {
*aSupportsHTTP3 = mSupportsHTTP3;
return NS_OK;
}
NS_IMETHODIMP
HttpBaseChannel::GetRequestMethod(nsACString& aMethod) {
mRequestHead.Method(aMethod);

Просмотреть файл

@ -231,6 +231,7 @@ class HttpBaseChannel : public nsHashPropertyBag,
NS_IMETHOD GetRequestSize(uint64_t* aRequestSize) override;
NS_IMETHOD GetDecodedBodySize(uint64_t* aDecodedBodySize) override;
NS_IMETHOD GetEncodedBodySize(uint64_t* aEncodedBodySize) override;
NS_IMETHOD GetSupportsHTTP3(bool* aSupportsHTTP3) override;
NS_IMETHOD SetRequestContextID(uint64_t aRCID) override;
NS_IMETHOD GetIsMainDocumentChannel(bool* aValue) override;
NS_IMETHOD SetIsMainDocumentChannel(bool aValue) override;
@ -730,6 +731,8 @@ class HttpBaseChannel : public nsHashPropertyBag,
uint64_t mTransferSize;
uint64_t mRequestSize;
uint64_t mDecodedBodySize;
// True only when the channel supports any of the versions of HTTP3
bool mSupportsHTTP3;
uint64_t mEncodedBodySize;
uint64_t mRequestContextID;
// ID of the top-level document's inner window this channel is being

Просмотреть файл

@ -287,6 +287,11 @@ NullHttpChannel::GetEncodedBodySize(uint64_t* aEncodedBodySize) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
NullHttpChannel::GetSupportsHTTP3(bool* aSupportsHTTP3) {
return NS_ERROR_NOT_IMPLEMENTED;
}
//-----------------------------------------------------------------------------
// NullHttpChannel::nsIChannel
//-----------------------------------------------------------------------------

Просмотреть файл

@ -739,9 +739,6 @@ class nsHttpChannel final : public HttpBaseChannel,
// is created.
uint32_t mHTTPSSVCTelemetryReported : 1;
// True only when the channel supports any of the versions of HTTP3
bool mSupportsHTTP3 = false;
// The origin of the top window, only valid when mTopWindowOriginComputed is
// true.
nsCString mTopWindowOrigin;

Просмотреть файл

@ -235,6 +235,10 @@ interface nsIHttpChannel : nsIIdentChannel
*/
[must_use] attribute unsigned long redirectionLimit;
/**
* This attribute indicates if the channel has support for HTTP3
*/
[must_use] readonly attribute boolean supportsHTTP3;
/**************************************************************************
* RESPONSE INFO

Просмотреть файл

@ -223,6 +223,11 @@ nsViewSourceChannel::GetEncodedBodySize(uint64_t* aEncodedBodySize) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsViewSourceChannel::GetSupportsHTTP3(bool* aSupportsHTTP3) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsViewSourceChannel::IsPending(bool* result) {
NS_ENSURE_TRUE(mChannel, NS_ERROR_FAILURE);

Просмотреть файл

@ -213,6 +213,7 @@ WaitForHttp3Listener.prototype.onStopRequest = function testOnStopRequest(
run_next_test();
} else {
dump("poll later for alt svc mapping\n");
Assert.ok(request.supportsHTTP3);
do_test_pending();
do_timeout(500, () => {
doTest(this.uri, this.expectedRoute, this.h3AltSvc);