зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1881040 - Propagate RequestPriority when using PFetch. r=edenchuang
This patch makes sure the RequestPriority of the internal request is propagated to the child process when using PFetch here: https://searchfox.org/mozilla-central/rev/14ff5b1650123600698f4bb8998ee02b102b8d2f/dom/fetch/Fetch.cpp#632 Note that IPCInternalRequest is also used in ServiceWorkerPrivate when intercepting a request. However, propagating the RequestPriority of the intercepted request does not seem desirable, so we just initialize with PRIORITY_AUTO. One version of the constructor for InternalRequest is no longer used, so we just remove it. Differential Revision: https://phabricator.services.mozilla.com/D210281
This commit is contained in:
Родитель
83be8ddc91
Коммит
290ea69c0e
|
@ -39,6 +39,10 @@ struct ParamTraits<mozilla::dom::RequestRedirect>
|
|||
: public mozilla::dom::WebIDLEnumSerializer<mozilla::dom::RequestRedirect> {
|
||||
};
|
||||
template <>
|
||||
struct ParamTraits<mozilla::dom::RequestPriority>
|
||||
: public mozilla::dom::WebIDLEnumSerializer<mozilla::dom::RequestPriority> {
|
||||
};
|
||||
template <>
|
||||
struct ParamTraits<mozilla::dom::ResponseType>
|
||||
: public mozilla::dom::WebIDLEnumSerializer<mozilla::dom::ResponseType> {};
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ using mozilla::dom::ReferrerPolicy from "mozilla/dom/ReferrerPolicyBinding.h";
|
|||
using mozilla::dom::RequestCache from "mozilla/dom/RequestBinding.h";
|
||||
using mozilla::dom::RequestCredentials from "mozilla/dom/RequestBinding.h";
|
||||
using mozilla::dom::RequestRedirect from "mozilla/dom/RequestBinding.h";
|
||||
using mozilla::dom::RequestPriority from "mozilla/dom/RequestBinding.h";
|
||||
using mozilla::dom::ResponseType from "mozilla/dom/ResponseBinding.h";
|
||||
using struct nsID from "nsID.h";
|
||||
using mozilla::dom::FetchDriverObserver::EndReason from "mozilla/dom/FetchDriver.h";
|
||||
|
@ -67,6 +68,7 @@ struct IPCInternalRequest {
|
|||
RequestCredentials requestCredentials;
|
||||
RequestCache cacheMode;
|
||||
RequestRedirect requestRedirect;
|
||||
RequestPriority requestPriority;
|
||||
nsString integrity;
|
||||
nsCString fragment;
|
||||
PrincipalInfo? principalInfo;
|
||||
|
|
|
@ -98,30 +98,6 @@ InternalRequest::InternalRequest(const nsACString& aURL,
|
|||
MOZ_ASSERT(!aURL.IsEmpty());
|
||||
AddURL(aURL, aFragment);
|
||||
}
|
||||
InternalRequest::InternalRequest(
|
||||
const nsACString& aURL, const nsACString& aFragment,
|
||||
const nsACString& aMethod, already_AddRefed<InternalHeaders> aHeaders,
|
||||
RequestCache aCacheMode, RequestMode aMode,
|
||||
RequestRedirect aRequestRedirect, RequestCredentials aRequestCredentials,
|
||||
const nsACString& aReferrer, ReferrerPolicy aReferrerPolicy,
|
||||
RequestPriority aPriority, nsContentPolicyType aContentPolicyType,
|
||||
const nsAString& aIntegrity)
|
||||
: mMethod(aMethod),
|
||||
mHeaders(aHeaders),
|
||||
mBodyLength(InternalResponse::UNKNOWN_BODY_SIZE),
|
||||
mContentPolicyType(aContentPolicyType),
|
||||
mReferrer(aReferrer),
|
||||
mReferrerPolicy(aReferrerPolicy),
|
||||
mEnvironmentReferrerPolicy(ReferrerPolicy::_empty),
|
||||
mMode(aMode),
|
||||
mCredentialsMode(aRequestCredentials),
|
||||
mCacheMode(aCacheMode),
|
||||
mRedirectMode(aRequestRedirect),
|
||||
mPriorityMode(aPriority),
|
||||
mIntegrity(aIntegrity) {
|
||||
MOZ_ASSERT(!aURL.IsEmpty());
|
||||
AddURL(aURL, aFragment);
|
||||
}
|
||||
InternalRequest::InternalRequest(const InternalRequest& aOther,
|
||||
ConstructorGuard)
|
||||
: mMethod(aOther.mMethod),
|
||||
|
@ -178,6 +154,7 @@ InternalRequest::InternalRequest(const IPCInternalRequest& aIPCRequest)
|
|||
mCredentialsMode(aIPCRequest.requestCredentials()),
|
||||
mCacheMode(aIPCRequest.cacheMode()),
|
||||
mRedirectMode(aIPCRequest.requestRedirect()),
|
||||
mPriorityMode(aIPCRequest.requestPriority()),
|
||||
mIntegrity(aIPCRequest.integrity()),
|
||||
mFragment(aIPCRequest.fragment()),
|
||||
mEmbedderPolicy(aIPCRequest.embedderPolicy()),
|
||||
|
@ -227,6 +204,7 @@ void InternalRequest::ToIPCInternalRequest(
|
|||
aIPCRequest->requestCredentials() = mCredentialsMode;
|
||||
aIPCRequest->cacheMode() = mCacheMode;
|
||||
aIPCRequest->requestRedirect() = mRedirectMode;
|
||||
aIPCRequest->requestPriority() = mPriorityMode;
|
||||
aIPCRequest->integrity() = mIntegrity;
|
||||
aIPCRequest->fragment() = mFragment;
|
||||
aIPCRequest->embedderPolicy() = mEmbedderPolicy;
|
||||
|
|
|
@ -87,16 +87,6 @@ class InternalRequest final : public AtomicSafeRefCounted<InternalRequest> {
|
|||
public:
|
||||
MOZ_DECLARE_REFCOUNTED_TYPENAME(InternalRequest)
|
||||
InternalRequest(const nsACString& aURL, const nsACString& aFragment);
|
||||
InternalRequest(const nsACString& aURL, const nsACString& aFragment,
|
||||
const nsACString& aMethod,
|
||||
already_AddRefed<InternalHeaders> aHeaders,
|
||||
RequestCache aCacheMode, RequestMode aMode,
|
||||
RequestRedirect aRequestRedirect,
|
||||
RequestCredentials aRequestCredentials,
|
||||
const nsACString& aReferrer, ReferrerPolicy aReferrerPolicy,
|
||||
RequestPriority aPriority,
|
||||
nsContentPolicyType aContentPolicyType,
|
||||
const nsAString& aIntegrity);
|
||||
|
||||
explicit InternalRequest(const IPCInternalRequest& aIPCRequest);
|
||||
|
||||
|
|
|
@ -322,6 +322,14 @@ Result<IPCInternalRequest, nsresult> GetIPCInternalRequest(
|
|||
MOZ_ALWAYS_SUCCEEDS(internalChannel->GetRedirectMode(&redirectMode));
|
||||
RequestRedirect requestRedirect = static_cast<RequestRedirect>(redirectMode);
|
||||
|
||||
// request's priority is not copied by the new Request() constructor used by
|
||||
// a fetch() call while request's internal priority is. So let's use the
|
||||
// default, otherwise a fetch(event.request) from a worker on an intercepted
|
||||
// fetch event would adjust priority twice.
|
||||
// https://fetch.spec.whatwg.org/#dom-global-fetch
|
||||
// https://fetch.spec.whatwg.org/#dom-request
|
||||
RequestPriority requestPriority = RequestPriority::Auto;
|
||||
|
||||
RequestCredentials requestCredentials =
|
||||
InternalRequest::MapChannelToRequestCredentials(underlyingChannel);
|
||||
|
||||
|
@ -411,9 +419,9 @@ Result<IPCInternalRequest, nsresult> GetIPCInternalRequest(
|
|||
method, {spec}, ipcHeadersGuard, ipcHeaders, Nothing(), -1,
|
||||
alternativeDataType, contentPolicyType, internalPriority, referrer,
|
||||
referrerPolicy, environmentReferrerPolicy, requestMode,
|
||||
requestCredentials, cacheMode, requestRedirect, integrity, fragment,
|
||||
principalInfo, interceptionPrincipalInfo, contentPolicyType,
|
||||
redirectChain, isThirdPartyChannel, embedderPolicy);
|
||||
requestCredentials, cacheMode, requestRedirect, requestPriority,
|
||||
integrity, fragment, principalInfo, interceptionPrincipalInfo,
|
||||
contentPolicyType, redirectChain, isThirdPartyChannel, embedderPolicy);
|
||||
}
|
||||
|
||||
nsresult MaybeStoreStreamForBackgroundThread(nsIInterceptedChannel* aChannel,
|
||||
|
|
Загрузка…
Ссылка в новой задаче