mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-20 15:27:32 +09:00
Issue #2736 - Part 2: Pass subject principal to SetAttribute and friends.
In order to tailor certain security checks to the caller that is attempting to load a particular piece of content, we need to be able to attach an appropriate triggering principal to the corresponding requests. Since most HTML content is loaded based on attribute values, this means capturing the subject principal of the caller who sets those attributes, which in turn means we need to make it available to `AfterSetAttr` hooks on all relevant element types.
This commit is contained in:
parent
9ad680cfc4
commit
824d0cad58
88 changed files with 337 additions and 132 deletions
|
|
@ -283,7 +283,9 @@ nsSVGElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
|||
nsresult
|
||||
nsSVGElement::AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName,
|
||||
const nsAttrValue* aValue,
|
||||
const nsAttrValue* aOldValue, bool aNotify)
|
||||
const nsAttrValue* aOldValue,
|
||||
nsIPrincipal* aSubjectPrincipal,
|
||||
bool aNotify)
|
||||
{
|
||||
// We don't currently use nsMappedAttributes within SVG. If this changes, we
|
||||
// need to be very careful because some nsAttrValues used by SVG point to
|
||||
|
|
@ -312,7 +314,7 @@ nsSVGElement::AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName,
|
|||
}
|
||||
|
||||
return nsSVGElementBase::AfterSetAttr(aNamespaceID, aName, aValue, aOldValue,
|
||||
aNotify);
|
||||
aSubjectPrincipal, aNotify);
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
@ -1480,7 +1482,7 @@ nsSVGElement::DidChangeValue(nsIAtom* aName,
|
|||
// attribute, but currently SVG elements do not even use the old attribute
|
||||
// value in |AfterSetAttr|, so this should be ok.
|
||||
SetAttrAndNotify(kNameSpaceID_None, aName, nullptr, &aEmptyOrOldValue,
|
||||
aNewValue, modType, hasListeners, kNotifyDocumentObservers,
|
||||
aNewValue, nullptr, modType, hasListeners, kNotifyDocumentObservers,
|
||||
kCallAfterSetAttr, document, updateBatch);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue