Bug 1841859 - Part 1: Move ReferrerPolicy to ScriptLoadRequest and LoadedScript. r=jonco,smaug
Suggested by jonco during review, https://phabricator.services.mozilla.com/D186944#inline-1036982 Differential Revision: https://phabricator.services.mozilla.com/D187385
This commit is contained in:
@@ -71,6 +71,12 @@ enum class ParserMetadata {
|
||||
* implemented in ScriptLoadRequest, as it changes for every
|
||||
* ScriptLoadRequest.
|
||||
*
|
||||
* referrerPolicy
|
||||
* For a module script, its referrerPolicy will be updated if there is a
|
||||
* HTTP Response 'REFERRER-POLICY' header, given this value may be different
|
||||
* for every ScriptLoadRequest, so we store it directly in
|
||||
* ScriptLoadRequest.
|
||||
*
|
||||
* In the case of classic scripts without dynamic import, this object is
|
||||
* used once. For modules, this object is propogated throughout the module
|
||||
* tree. If there is a dynamically imported module in any type of script,
|
||||
@@ -84,9 +90,7 @@ class ScriptFetchOptions {
|
||||
NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(ScriptFetchOptions)
|
||||
NS_DECL_CYCLE_COLLECTION_NATIVE_CLASS(ScriptFetchOptions)
|
||||
|
||||
ScriptFetchOptions(mozilla::CORSMode aCORSMode,
|
||||
enum mozilla::dom::ReferrerPolicy aReferrerPolicy,
|
||||
const nsAString& aNonce,
|
||||
ScriptFetchOptions(mozilla::CORSMode aCORSMode, const nsAString& aNonce,
|
||||
mozilla::dom::RequestPriority aFetchPriority,
|
||||
const ParserMetadata aParserMetadata,
|
||||
nsIPrincipal* aTriggeringPrincipal,
|
||||
@@ -99,12 +103,6 @@ class ScriptFetchOptions {
|
||||
*/
|
||||
const mozilla::CORSMode mCORSMode;
|
||||
|
||||
/*
|
||||
* The referrer policy used for the initial fetch and for fetching any
|
||||
* imported modules
|
||||
*/
|
||||
const enum mozilla::dom::ReferrerPolicy mReferrerPolicy;
|
||||
|
||||
/*
|
||||
* The cryptographic nonce metadata used for the initial fetch and for
|
||||
* fetching any imported modules.
|
||||
@@ -182,6 +180,7 @@ class ScriptLoadRequest
|
||||
public:
|
||||
using SRIMetadata = mozilla::dom::SRIMetadata;
|
||||
ScriptLoadRequest(ScriptKind aKind, nsIURI* aURI,
|
||||
mozilla::dom::ReferrerPolicy aReferrerPolicy,
|
||||
ScriptFetchOptions* aFetchOptions,
|
||||
const SRIMetadata& aIntegrity, nsIURI* aReferrer,
|
||||
LoadContextBase* aContext);
|
||||
@@ -298,7 +297,7 @@ class ScriptLoadRequest
|
||||
}
|
||||
|
||||
enum mozilla::dom::ReferrerPolicy ReferrerPolicy() const {
|
||||
return mFetchOptions->mReferrerPolicy;
|
||||
return mReferrerPolicy;
|
||||
}
|
||||
|
||||
enum ParserMetadata ParserMetadata() const {
|
||||
@@ -343,6 +342,10 @@ class ScriptLoadRequest
|
||||
State mState; // Are we still waiting for a load to complete?
|
||||
bool mFetchSourceOnly; // Request source, not cached bytecode.
|
||||
DataType mDataType; // Does this contain Source or Bytecode?
|
||||
|
||||
// The referrer policy used for the initial fetch and for fetching any
|
||||
// imported modules
|
||||
enum mozilla::dom::ReferrerPolicy mReferrerPolicy;
|
||||
RefPtr<ScriptFetchOptions> mFetchOptions;
|
||||
const SRIMetadata mIntegrity;
|
||||
const nsCOMPtr<nsIURI> mReferrer;
|
||||
|
||||
Reference in New Issue
Block a user