Issue #2736 - Part 12: Re-work style <link> href attribute.

Use subject principal as triggering principal in style <link> "href"
attribute.
This commit is contained in:
Moonchild 2025-05-04 21:58:17 +02:00 committed by roytam1
commit 60ad5b2ffd
14 changed files with 51 additions and 29 deletions

View file

@ -2015,6 +2015,7 @@ Loader::LoadInlineStyle(nsIContent* aElement,
nsresult
Loader::LoadStyleLink(nsIContent* aElement,
nsIURI* aURL,
nsIPrincipal* aTriggeringPrincipal,
const nsAString& aTitle,
const nsAString& aMedia,
bool aHasAlternateRel,
@ -2044,11 +2045,9 @@ Loader::LoadStyleLink(nsIContent* aElement,
nsIPrincipal* loadingPrincipal = aElement ? aElement->NodePrincipal()
: mDocument->NodePrincipal();
//SHOULD BE:
//nsIPrincipal* principal = aTriggeringPrincipal ? aTriggeringPrincipal
// : loadingPrincipal;
nsIPrincipal* principal = loadingPrincipal;
nsIPrincipal* principal = aTriggeringPrincipal ? aTriggeringPrincipal
: loadingPrincipal;
nsISupports* context = aElement;
if (!context) {
context = mDocument;

View file

@ -254,6 +254,9 @@ public:
*
* @param aElement the element linking to the the stylesheet. May be null.
* @param aURL the URL of the sheet.
* @param aTriggeringPrincipal the triggering principal for the load. May be
* null, in which case the NodePrincipal() of the element (or
* document if aElement is null) should be used.
* @param aTitle the title of the sheet.
* @param aMedia the media string for the sheet.
* @param aHasAlternateRel whether the rel for this link included
@ -269,6 +272,7 @@ public:
*/
nsresult LoadStyleLink(nsIContent* aElement,
nsIURI* aURL,
nsIPrincipal* aTriggeringPrincipal,
const nsAString& aTitle,
const nsAString& aMedia,
bool aHasAlternateRel,