diff --git a/dom/fetch/InternalRequest.h b/dom/fetch/InternalRequest.h index d2b7721f5e59..b74ec1db1e40 100644 --- a/dom/fetch/InternalRequest.h +++ b/dom/fetch/InternalRequest.h @@ -263,6 +263,10 @@ class InternalRequest final : public AtomicSafeRefCounted { mIntegrity.Assign(aIntegrity); } + bool GetKeepalive() const { return mKeepalive; } + + void SetKeepalive(const bool aKeepalive) { mKeepalive = aKeepalive; } + bool MozErrors() const { return mMozErrors; } void SetMozErrors() { mMozErrors = true; } @@ -454,6 +458,7 @@ class InternalRequest final : public AtomicSafeRefCounted { RequestRedirect mRedirectMode; RequestPriority mPriorityMode = RequestPriority::Auto; nsString mIntegrity; + bool mKeepalive = false; bool mMozErrors = false; nsCString mFragment; bool mSkipServiceWorker = false; diff --git a/dom/fetch/Request.cpp b/dom/fetch/Request.cpp index 00758384d303..25a7446ec28e 100644 --- a/dom/fetch/Request.cpp +++ b/dom/fetch/Request.cpp @@ -517,7 +517,7 @@ SafeRefPtr Request::Constructor(nsIGlobalObject* aGlobal, } if (aInit.mKeepalive.WasPassed()) { - // place holder to set keepalive + request->SetKeepalive(aInit.mKeepalive.Value()); } if (aInit.mMozErrors.WasPassed() && aInit.mMozErrors.Value()) { diff --git a/dom/fetch/Request.h b/dom/fetch/Request.h index 368936345d49..1487700c85ba 100644 --- a/dom/fetch/Request.h +++ b/dom/fetch/Request.h @@ -59,7 +59,7 @@ class Request final : public FetchBody, public nsWrapperCache { aIntegrity = mRequest->GetIntegrity(); } - bool Keepalive() const { return false; } + bool Keepalive() const { return mRequest->GetKeepalive(); } bool MozErrors() const { return mRequest->MozErrors(); } diff --git a/testing/web-platform/meta/fetch/api/request/request-keepalive.any.js.ini b/testing/web-platform/meta/fetch/api/request/request-keepalive.any.js.ini index a3819488281a..9298bef1adcd 100644 --- a/testing/web-platform/meta/fetch/api/request/request-keepalive.any.js.ini +++ b/testing/web-platform/meta/fetch/api/request/request-keepalive.any.js.ini @@ -1,12 +1,10 @@ +prefs: [dom.fetchKeepalive.enabled:true] [request-keepalive.any.sharedworker.html] expected: if (os == "android") and fission: [OK, TIMEOUT] [keepalive flag with stream body] expected: FAIL - [keepalive flag] - expected: FAIL - [request-keepalive.any.worker.html] expected: @@ -14,21 +12,12 @@ [keepalive flag with stream body] expected: FAIL - [keepalive flag] - expected: FAIL - [request-keepalive.any.serviceworker.html] [keepalive flag with stream body] expected: FAIL - [keepalive flag] - expected: FAIL - [request-keepalive.any.html] [keepalive flag with stream body] expected: FAIL - - [keepalive flag] - expected: FAIL