Bug 1839316: part 4) Add RequestPriority to ScriptFetchOptions and ScriptLoadRequest. r=smaug
The request priority isn't propagated from `ScriptFetchOptions`, so setting it has no effect for end-users. That will be implemented in a following part. Differential Revision: https://phabricator.services.mozilla.com/D183483
This commit is contained in:
@@ -37,11 +37,13 @@ NS_IMPL_CYCLE_COLLECTION(ScriptFetchOptions, mTriggeringPrincipal, mElement)
|
||||
|
||||
ScriptFetchOptions::ScriptFetchOptions(
|
||||
mozilla::CORSMode aCORSMode, mozilla::dom::ReferrerPolicy aReferrerPolicy,
|
||||
const nsAString& aNonce, const ParserMetadata aParserMetadata,
|
||||
nsIPrincipal* aTriggeringPrincipal, mozilla::dom::Element* aElement)
|
||||
const nsAString& aNonce, mozilla::dom::RequestPriority aFetchPriority,
|
||||
const ParserMetadata aParserMetadata, nsIPrincipal* aTriggeringPrincipal,
|
||||
mozilla::dom::Element* aElement)
|
||||
: mCORSMode(aCORSMode),
|
||||
mReferrerPolicy(aReferrerPolicy),
|
||||
mNonce(aNonce),
|
||||
mFetchPriority(aFetchPriority),
|
||||
mParserMetadata(aParserMetadata),
|
||||
mTriggeringPrincipal(aTriggeringPrincipal),
|
||||
mElement(aElement) {}
|
||||
|
||||
@@ -37,6 +37,7 @@ namespace mozilla::dom {
|
||||
class ScriptLoadContext;
|
||||
class WorkerLoadContext;
|
||||
class WorkletLoadContext;
|
||||
enum class RequestPriority : uint8_t;
|
||||
|
||||
} // namespace mozilla::dom
|
||||
|
||||
@@ -88,6 +89,7 @@ class ScriptFetchOptions {
|
||||
ScriptFetchOptions(mozilla::CORSMode aCORSMode,
|
||||
enum mozilla::dom::ReferrerPolicy aReferrerPolicy,
|
||||
const nsAString& aNonce,
|
||||
mozilla::dom::RequestPriority aFetchPriority,
|
||||
const ParserMetadata aParserMetadata,
|
||||
nsIPrincipal* aTriggeringPrincipal,
|
||||
mozilla::dom::Element* aElement = nullptr);
|
||||
@@ -111,6 +113,11 @@ class ScriptFetchOptions {
|
||||
*/
|
||||
const nsString mNonce;
|
||||
|
||||
/*
|
||||
* <https://html.spec.whatwg.org/multipage/webappapis.html#script-fetch-options>.
|
||||
*/
|
||||
const mozilla::dom::RequestPriority mFetchPriority;
|
||||
|
||||
/*
|
||||
* The parser metadata used for the initial fetch and for fetching any
|
||||
* imported modules
|
||||
@@ -288,6 +295,10 @@ class ScriptLoadRequest
|
||||
: ScriptText<Utf8Unit>().clearAndFree();
|
||||
}
|
||||
|
||||
mozilla::dom::RequestPriority FetchPriority() const {
|
||||
return mFetchOptions->mFetchPriority;
|
||||
}
|
||||
|
||||
enum mozilla::dom::ReferrerPolicy ReferrerPolicy() const {
|
||||
return mFetchOptions->mReferrerPolicy;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user