ported from mozilla: Bug 1384493 - LoadStyleLink and LoadInlineStyle should use correct referrer policy. r=heycam (53e3c926ff)

This commit is contained in:
roytam1 2024-10-01 11:18:09 +08:00
commit d0c0a7d8d2
8 changed files with 56 additions and 24 deletions

View file

@ -1941,6 +1941,7 @@ Loader::LoadInlineStyle(nsIContent* aElement,
uint32_t aLineNumber,
const nsAString& aTitle,
const nsAString& aMedia,
ReferrerPolicy aReferrerPolicy,
Element* aScopeElement,
nsICSSLoaderObserver* aObserver,
bool* aCompleted,
@ -1964,11 +1965,12 @@ Loader::LoadInlineStyle(nsIContent* aElement,
// Since we're not planning to load a URI, no need to hand a principal to the
// load data or to CreateSheet(). Also, OK to use CORS_NONE for the CORS
// mode and mDocument's ReferrerPolicy.
// mode.
StyleSheetState state;
RefPtr<StyleSheet> sheet;
nsresult rv = CreateSheet(nullptr, aElement, nullptr, eAuthorSheetFeatures,
CORS_NONE, mDocument->GetReferrerPolicy(),
CORS_NONE, aReferrerPolicy,
EmptyString(), // no inline integrity checks
false, false, aTitle, state, aIsAlternate,
&sheet);

View file

@ -224,6 +224,7 @@ public:
* @param aLineNumber the line number at which the stylesheet data started.
* @param aTitle the title of the sheet.
* @param aMedia the media string for the sheet.
* @param aReferrerPolicy the referrer policy for loading the sheet.
* @param aObserver the observer to notify when the load completes.
* May be null.
* @param [out] aCompleted whether parsing of the sheet completed.
@ -237,6 +238,7 @@ public:
uint32_t aLineNumber,
const nsAString& aTitle,
const nsAString& aMedia,
ReferrerPolicy aReferrerPolicy,
mozilla::dom::Element* aScopeElement,
nsICSSLoaderObserver* aObserver,
bool* aCompleted,