ported from UXP: Issue #2736 - Part 2: Pass subject principal to SetAttribute and friends. (824d0cad)

This commit is contained in:
2025-05-14 15:08:01 +08:00
parent 3cc87110cf
commit 058c37fa0e
88 changed files with 329 additions and 124 deletions
+2 -1
View File
@@ -75,6 +75,7 @@ void
AnonymousContent::SetAttributeForElement(const nsAString& aElementId,
const nsAString& aName,
const nsAString& aValue,
nsIPrincipal* aSubjectPrincipal,
ErrorResult& aRv)
{
Element* element = GetElementById(aElementId);
@@ -83,7 +84,7 @@ AnonymousContent::SetAttributeForElement(const nsAString& aElementId,
return;
}
element->SetAttribute(aName, aValue, aRv);
element->SetAttribute(aName, aValue, aSubjectPrincipal, aRv);
}
void
+1
View File
@@ -43,6 +43,7 @@ public:
void SetAttributeForElement(const nsAString& aElementId,
const nsAString& aName,
const nsAString& aValue,
nsIPrincipal* aSubjectPrincipal,
ErrorResult& aRv);
void GetAttributeForElement(const nsAString& aElementId,
+3 -2
View File
@@ -175,7 +175,7 @@ Attr::GetValue(nsAString& aValue)
}
void
Attr::SetValue(const nsAString& aValue, ErrorResult& aRv)
Attr::SetValue(const nsAString& aValue, nsIPrincipal* aTriggeringPrincipal, ErrorResult& aRv)
{
Element* element = GetElement();
if (!element) {
@@ -188,6 +188,7 @@ Attr::SetValue(const nsAString& aValue, ErrorResult& aRv)
nameAtom,
mNodeInfo->GetPrefixAtom(),
aValue,
aTriggeringPrincipal,
true);
}
@@ -195,7 +196,7 @@ NS_IMETHODIMP
Attr::SetValue(const nsAString& aValue)
{
ErrorResult rv;
SetValue(aValue, rv);
SetValue(aValue, nullptr, rv);
return rv.StealNSResult();
}
+6 -2
View File
@@ -85,9 +85,13 @@ public:
virtual JSObject* WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
// XPCOM GetName() is OK
// XPCOM GetValue() is OK
void SetValue(const nsAString& aValue, ErrorResult& aRv);
void GetValue(nsString& val, nsIPrincipal&)
{
GetValue(val);
}
void SetValue(const nsAString& aValue, nsIPrincipal* aTriggeringPrincipal, ErrorResult& aRv);
bool Specified() const;
+2 -5
View File
@@ -70,13 +70,10 @@ public:
virtual JSObject* WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto) override;
// nsIContent
nsresult SetAttr(int32_t aNameSpaceID, nsIAtom* aName,
const nsAString& aValue, bool aNotify)
{
return SetAttr(aNameSpaceID, aName, nullptr, aValue, aNotify);
}
using nsIContent::SetAttr;
virtual nsresult SetAttr(int32_t aNameSpaceID, nsIAtom* aName,
nsIAtom* aPrefix, const nsAString& aValue,
nsIPrincipal* aSubjectPrincipal,
bool aNotify) override
{
return NS_OK;
+13 -7
View File
@@ -1248,6 +1248,7 @@ Element::ToggleAttribute(const nsAString& aName,
void
Element::SetAttribute(const nsAString& aName,
const nsAString& aValue,
nsIPrincipal* aTriggeringPrincipal,
ErrorResult& aError)
{
aError = nsContentUtils::CheckQName(aName, false);
@@ -1263,12 +1264,12 @@ Element::SetAttribute(const nsAString& aName,
aError.Throw(NS_ERROR_OUT_OF_MEMORY);
return;
}
aError = SetAttr(kNameSpaceID_None, nameAtom, aValue, true);
aError = SetAttr(kNameSpaceID_None, nameAtom, aValue, aTriggeringPrincipal, true);
return;
}
aError = SetAttr(name->NamespaceID(), name->LocalName(), name->GetPrefix(),
aValue, true);
aValue, aTriggeringPrincipal, true);
return;
}
@@ -1351,6 +1352,7 @@ void
Element::SetAttributeNS(const nsAString& aNamespaceURI,
const nsAString& aQualifiedName,
const nsAString& aValue,
nsIPrincipal* aTriggeringPrincipal,
ErrorResult& aError)
{
RefPtr<mozilla::dom::NodeInfo> ni;
@@ -1364,7 +1366,7 @@ Element::SetAttributeNS(const nsAString& aNamespaceURI,
}
aError = SetAttr(ni->NamespaceID(), ni->NameAtom(), ni->GetPrefixAtom(),
aValue, true);
aValue, aTriggeringPrincipal, true);
}
void
@@ -2404,6 +2406,7 @@ Element::SetSingleClassFromParser(nsIAtom* aSingleClassName)
nullptr, // prefix
nullptr, // old value
value,
nullptr, // subject principal
static_cast<uint8_t>(nsIDOMMutationEvent::ADDITION),
false, // hasListeners
false, // notify
@@ -2415,6 +2418,7 @@ Element::SetSingleClassFromParser(nsIAtom* aSingleClassName)
nsresult
Element::SetAttr(int32_t aNamespaceID, nsIAtom* aName,
nsIAtom* aPrefix, const nsAString& aValue,
nsIPrincipal* aSubjectPrincipal,
bool aNotify)
{
// Keep this in sync with SetParsedAttr below and SetSingleClassFromParser
@@ -2474,7 +2478,8 @@ Element::SetAttr(int32_t aNamespaceID, nsIAtom* aName,
return SetAttrAndNotify(aNamespaceID, aName, aPrefix,
oldValueSet ? &oldValue : nullptr,
attrValue, modType, hasListeners, aNotify,
attrValue, aSubjectPrincipal, modType,
hasListeners, aNotify,
kCallAfterSetAttr, document, updateBatch);
}
@@ -2519,7 +2524,7 @@ Element::SetParsedAttr(int32_t aNamespaceID, nsIAtom* aName,
mozAutoDocUpdate updateBatch(document, UPDATE_CONTENT_MODEL, aNotify);
return SetAttrAndNotify(aNamespaceID, aName, aPrefix,
oldValueSet ? &oldValue : nullptr,
aParsedValue, modType, hasListeners, aNotify,
aParsedValue, nullptr, modType, hasListeners, aNotify,
kCallAfterSetAttr, document, updateBatch);
}
@@ -2529,6 +2534,7 @@ Element::SetAttrAndNotify(int32_t aNamespaceID,
nsIAtom* aPrefix,
const nsAttrValue* aOldValue,
nsAttrValue& aParsedValue,
nsIPrincipal* aSubjectPrincipal,
uint8_t aModType,
bool aFireMutation,
bool aNotify,
@@ -2635,7 +2641,7 @@ Element::SetAttrAndNotify(int32_t aNamespaceID,
if (aCallAfterSetAttr) {
rv = AfterSetAttr(aNamespaceID, aName, &valueForAfterSetAttr, oldValue,
aNotify);
aSubjectPrincipal, aNotify);
NS_ENSURE_SUCCESS(rv, rv);
if (aNamespaceID == kNameSpaceID_None && aName == nsGkAtoms::dir) {
@@ -2931,7 +2937,7 @@ Element::UnsetAttr(int32_t aNameSpaceID, nsIAtom* aName,
}
}
rv = AfterSetAttr(aNameSpaceID, aName, nullptr, &oldValue, aNotify);
rv = AfterSetAttr(aNameSpaceID, aName, nullptr, &oldValue, nullptr, aNotify);
NS_ENSURE_SUCCESS(rv, rv);
UpdateState(aNotify);
+35 -10
View File
@@ -561,12 +561,7 @@ public:
already_AddRefed<mozilla::dom::NodeInfo>
GetExistingAttrNameFromQName(const nsAString& aStr) const;
MOZ_ALWAYS_INLINE // Avoid a crashy hook from Avast 10 Beta (Bug 1058131)
nsresult SetAttr(int32_t aNameSpaceID, nsIAtom* aName,
const nsAString& aValue, bool aNotify)
{
return SetAttr(aNameSpaceID, aName, nullptr, aValue, aNotify);
}
using nsIContent::SetAttr;
/**
* Helper for SetAttr/SetParsedAttr. This method will return true if aNotify
@@ -629,7 +624,8 @@ public:
nsresult SetSingleClassFromParser(nsIAtom* aSingleClassName);
virtual nsresult SetAttr(int32_t aNameSpaceID, nsIAtom* aName, nsIAtom* aPrefix,
const nsAString& aValue, bool aNotify) override;
const nsAString& aValue, nsIPrincipal* aSubjectPrincipal,
bool aNotify) override;
// aParsedValue receives the old value of the attribute. That's useful if
// either the input or output value of aParsedValue is StoresOwnData.
nsresult SetParsedAttr(int32_t aNameSpaceID, nsIAtom* aName, nsIAtom* aPrefix,
@@ -802,11 +798,18 @@ public:
bool ToggleAttribute(const nsAString& aName, const Optional<bool>& aForce,
ErrorResult& aError);
void SetAttribute(const nsAString& aName, const nsAString& aValue,
ErrorResult& aError);
nsIPrincipal* aTriggeringPrincipal, ErrorResult& aError);
void SetAttributeNS(const nsAString& aNamespaceURI,
const nsAString& aLocalName,
const nsAString& aValue,
nsIPrincipal* aTriggeringPrincipal,
ErrorResult& aError);
void SetAttribute(const nsAString& aName, const nsAString& aValue,
ErrorResult& aError)
{
SetAttribute(aName, aValue, nullptr, aError);
}
void RemoveAttribute(const nsAString& aName,
ErrorResult& aError);
void RemoveAttributeNS(const nsAString& aNamespaceURI,
@@ -1245,6 +1248,11 @@ public:
aError = SetAttr(kNameSpaceID_None, aAttr, aValue, true);
}
void SetAttr(nsIAtom* aAttr, const nsAString& aValue, nsIPrincipal& aTriggeringPrincipal, ErrorResult& aError)
{
aError = nsIContent::SetAttr(kNameSpaceID_None, aAttr, aValue, &aTriggeringPrincipal, true);
}
/**
* Set a content attribute via a reflecting nullable string IDL
* attribute (e.g. a CORS attribute). If DOMStringIsNull(aValue),
@@ -1322,6 +1330,14 @@ protected:
* @param aParsedValue parsed new value of attribute. Replaced by the
* old value of the attribute. This old value is only
* useful if either it or the new value is StoresOwnData.
* @param aMaybeScriptedPrincipal
* the principal of the scripted caller responsible for
* setting the attribute, or null if no scripted caller
* can be determined. A null value here does not
* guarantee that there is no scripted caller, but a
* non-null value does guarantee that a scripted caller
* with the given principal is directly responsible for
* the attribute change.
* @param aModType nsIDOMMutationEvent::MODIFICATION or ADDITION. Only
* needed if aFireMutation or aNotify is true.
* @param aFireMutation should mutation-events be fired?
@@ -1334,6 +1350,7 @@ protected:
nsIAtom* aPrefix,
const nsAttrValue* aOldValue,
nsAttrValue& aParsedValue,
nsIPrincipal* aMaybeScriptedPrincipal,
uint8_t aModType,
bool aFireMutation,
bool aNotify,
@@ -1425,13 +1442,21 @@ protected:
* the attr was not previously set. This argument may not have the
* correct value for SVG elements, or other cases in which the
* attribute value doesn't store its own data
* @param aMaybeScriptedPrincipal the principal of the scripted caller
* responsible for setting the attribute, or null if no scripted caller
* can be determined, or the attribute is being unset. A null value
* here does not guarantee that there is no scripted caller, but a
* non-null value does guarantee that a scripted caller with the given
* principal is directly responsible for the attribute change.
* @param aNotify Whether we plan to notify document observers.
*/
// Note that this is inlined so that when subclasses call it it gets
// inlined. Those calls don't go through a vtable.
virtual nsresult AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName,
const nsAttrValue* aValue,
const nsAttrValue* aOldValue, bool aNotify)
const nsAttrValue* aOldValue,
nsIPrincipal* aMaybeScriptedPrincipal,
bool aNotify)
{
return NS_OK;
}
@@ -1782,7 +1807,7 @@ NS_IMETHOD SetAttribute(const nsAString& name, \
const nsAString& value) override \
{ \
mozilla::ErrorResult rv; \
Element::SetAttribute(name, value, rv); \
Element::SetAttribute(name, value, nullptr, rv); \
return rv.StealNSResult(); \
} \
using Element::HasAttribute; \
+1
View File
@@ -619,6 +619,7 @@ nsGenericDOMDataNode::GetChildren(uint32_t aFilter)
nsresult
nsGenericDOMDataNode::SetAttr(int32_t aNameSpaceID, nsIAtom* aAttr,
nsIAtom* aPrefix, const nsAString& aValue,
nsIPrincipal* aContentPrincipal,
bool aNotify)
{
return NS_OK;
+2 -5
View File
@@ -117,13 +117,10 @@ public:
virtual already_AddRefed<nsINodeList> GetChildren(uint32_t aFilter) override;
nsresult SetAttr(int32_t aNameSpaceID, nsIAtom* aName,
const nsAString& aValue, bool aNotify)
{
return SetAttr(aNameSpaceID, aName, nullptr, aValue, aNotify);
}
using nsIContent::SetAttr;
virtual nsresult SetAttr(int32_t aNameSpaceID, nsIAtom* aAttribute,
nsIAtom* aPrefix, const nsAString& aValue,
nsIPrincipal* aSubjectPrincipal,
bool aNotify) override;
virtual nsresult UnsetAttr(int32_t aNameSpaceID, nsIAtom* aAttribute,
bool aNotify) override;
+17
View File
@@ -364,6 +364,16 @@ public:
{
return SetAttr(aNameSpaceID, aName, nullptr, aValue, aNotify);
}
nsresult SetAttr(int32_t aNameSpaceID, nsIAtom* aName, nsIAtom* aPrefix,
const nsAString& aValue, bool aNotify)
{
return SetAttr(aNameSpaceID, aName, aPrefix, aValue, nullptr, aNotify);
}
nsresult SetAttr(int32_t aNameSpaceID, nsIAtom* aName, const nsAString& aValue,
nsIPrincipal* aTriggeringPrincipal, bool aNotify)
{
return SetAttr(aNameSpaceID, aName, nullptr, aValue, aTriggeringPrincipal, aNotify);
}
/**
* Set attribute values. All attribute values are assumed to have a
@@ -376,11 +386,18 @@ public:
* @param aName the name of the attribute
* @param aPrefix the prefix of the attribute
* @param aValue the value to set
* @param aMaybeScriptedPrincipal the principal of the scripted caller responsible
* for setting the attribute, or null if no scripted caller can be
* determined. A null value here does not guarantee that there is no
* scripted caller, but a non-null value does guarantee that a scripted
* caller with the given principal is directly responsible for the
* attribute change.
* @param aNotify specifies how whether or not the document should be
* notified of the attribute change.
*/
virtual nsresult SetAttr(int32_t aNameSpaceID, nsIAtom* aName,
nsIAtom* aPrefix, const nsAString& aValue,
nsIPrincipal* aMaybeScriptedPrincipal,
bool aNotify) = 0;
/**
+2 -1
View File
@@ -111,7 +111,8 @@ nsStyledElement::SetInlineStyleDeclaration(css::Declaration* aDeclaration,
nsIDocument* document = GetComposedDoc();
mozAutoDocUpdate updateBatch(document, UPDATE_CONTENT_MODEL, aNotify);
return SetAttrAndNotify(kNameSpaceID_None, nsGkAtoms::style, nullptr,
oldValueSet ? &oldValue : nullptr, attrValue, modType,
oldValueSet ? &oldValue : nullptr, attrValue,
nullptr, modType,
hasListeners, aNotify, kDontCallAfterSetAttr,
document, updateBatch);
}
+5 -2
View File
@@ -380,7 +380,9 @@ HTMLAnchorElement::BeforeSetAttr(int32_t aNamespaceID, nsIAtom* aName,
nsresult
HTMLAnchorElement::AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName,
const nsAttrValue* aValue,
const nsAttrValue* aOldValue, bool aNotify)
const nsAttrValue* aOldValue,
nsIPrincipal* aSubjectPrincipal,
bool aNotify)
{
if (aNamespaceID == kNameSpaceID_None) {
if (aName == nsGkAtoms::href) {
@@ -392,7 +394,8 @@ HTMLAnchorElement::AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName,
}
return nsGenericHTMLElement::AfterSetAttr(aNamespaceID, aName,
aValue, aOldValue, aNotify);
aValue, aOldValue,
aSubjectPrincipal, aNotify);
}
EventStates
+1
View File
@@ -72,6 +72,7 @@ public:
virtual nsresult AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName,
const nsAttrValue* aValue,
const nsAttrValue* aOldValue,
nsIPrincipal* aSubjectPrincipal,
bool aNotify) override;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const override;
+4 -2
View File
@@ -143,7 +143,9 @@ HTMLAreaElement::UnbindFromTree(bool aDeep, bool aNullParent)
nsresult
HTMLAreaElement::AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName,
const nsAttrValue* aValue,
const nsAttrValue* aOldValue, bool aNotify)
const nsAttrValue* aOldValue,
nsIPrincipal* aSubjectPrincipal,
bool aNotify)
{
if (aNamespaceID == kNameSpaceID_None) {
// This must happen after the attribute is set. We will need the updated
@@ -156,7 +158,7 @@ HTMLAreaElement::AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName,
}
return nsGenericHTMLElement::AfterSetAttr(aNamespaceID, aName, aValue,
aOldValue, aNotify);
aOldValue, aSubjectPrincipal, aNotify);
}
#define IMPL_URI_PART(_part) \
+1
View File
@@ -179,6 +179,7 @@ protected:
virtual nsresult AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName,
const nsAttrValue* aValue,
const nsAttrValue* aOldValue,
nsIPrincipal* aSubjectPrincipal,
bool aNotify) override;
RefPtr<nsDOMTokenList > mRelList;
+4 -2
View File
@@ -439,7 +439,9 @@ HTMLButtonElement::BeforeSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
nsresult
HTMLButtonElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
const nsAttrValue* aValue,
const nsAttrValue* aOldValue, bool aNotify)
const nsAttrValue* aOldValue,
nsIPrincipal* aSubjectPrincipal,
bool aNotify)
{
if (aNameSpaceID == kNameSpaceID_None) {
if (aName == nsGkAtoms::type) {
@@ -455,7 +457,7 @@ HTMLButtonElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
return nsGenericHTMLFormElementWithState::AfterSetAttr(aNameSpaceID, aName,
aValue, aOldValue,
aNotify);
aSubjectPrincipal, aNotify);
}
NS_IMETHODIMP
+1
View File
@@ -89,6 +89,7 @@ public:
virtual nsresult AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName,
const nsAttrValue* aValue,
const nsAttrValue* aOldValue,
nsIPrincipal* aSubjectPrincipal,
bool aNotify) override;
virtual bool ParseAttribute(int32_t aNamespaceID,
nsIAtom* aAttribute,
+4 -2
View File
@@ -460,12 +460,14 @@ NS_IMPL_BOOL_ATTR(HTMLCanvasElement, MozOpaque, moz_opaque)
nsresult
HTMLCanvasElement::AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName,
const nsAttrValue* aValue,
const nsAttrValue* aOldValue, bool aNotify)
const nsAttrValue* aOldValue,
nsIPrincipal* aSubjectPrincipal,
bool aNotify)
{
AfterMaybeChangeAttr(aNamespaceID, aName, aNotify);
return nsGenericHTMLElement::AfterSetAttr(aNamespaceID, aName, aValue,
aOldValue, aNotify);
aOldValue, aSubjectPrincipal, aNotify);
}
nsresult
+1
View File
@@ -364,6 +364,7 @@ protected:
virtual nsresult AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName,
const nsAttrValue* aValue,
const nsAttrValue* aOldValue,
nsIPrincipal* aSubjectPrincipal,
bool aNotify) override;
virtual nsresult OnAttrSetButNotChanged(int32_t aNamespaceID, nsIAtom* aName,
const nsAttrValueOrString& aValue,
+5 -2
View File
@@ -84,7 +84,9 @@ HTMLFieldSetElement::GetEventTargetParent(EventChainPreVisitor& aVisitor)
nsresult
HTMLFieldSetElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
const nsAttrValue* aValue,
const nsAttrValue* aOldValue, bool aNotify)
const nsAttrValue* aOldValue,
nsIPrincipal* aSubjectPrincipal,
bool aNotify)
{
if (aNameSpaceID == kNameSpaceID_None && aName == nsGkAtoms::disabled &&
nsINode::GetFirstChild()) {
@@ -101,7 +103,8 @@ HTMLFieldSetElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
}
return nsGenericHTMLFormElement::AfterSetAttr(aNameSpaceID, aName,
aValue, aOldValue, aNotify);
aValue, aOldValue,
aSubjectPrincipal, aNotify);
}
// nsIDOMHTMLFieldSetElement
+1
View File
@@ -45,6 +45,7 @@ public:
virtual nsresult AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
const nsAttrValue* aValue,
const nsAttrValue* aOldValue,
nsIPrincipal* aSubjectPrincipal,
bool aNotify) override;
virtual nsresult InsertChildAt(nsIContent* aChild, uint32_t aIndex,
+4 -2
View File
@@ -222,7 +222,9 @@ HTMLFormElement::BeforeSetAttr(int32_t aNamespaceID, nsIAtom* aName,
nsresult
HTMLFormElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
const nsAttrValue* aValue,
const nsAttrValue* aOldValue, bool aNotify)
const nsAttrValue* aOldValue,
nsIPrincipal* aSubjectPrincipal,
bool aNotify)
{
if (aName == nsGkAtoms::novalidate && aNameSpaceID == kNameSpaceID_None) {
// Update all form elements states because they might be [no longer]
@@ -239,7 +241,7 @@ HTMLFormElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
}
return nsGenericHTMLElement::AfterSetAttr(aNameSpaceID, aName, aValue,
aOldValue, aNotify);
aOldValue, aSubjectPrincipal, aNotify);
}
NS_IMPL_STRING_ATTR(HTMLFormElement, AcceptCharset, acceptcharset)
+1
View File
@@ -111,6 +111,7 @@ public:
virtual nsresult AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
const nsAttrValue* aValue,
const nsAttrValue* aOldValue,
nsIPrincipal* aSubjectPrincipal,
bool aNotify) override;
/**
+7 -3
View File
@@ -184,7 +184,9 @@ HTMLIFrameElement::GetAttributeMappingFunction() const
nsresult
HTMLIFrameElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
const nsAttrValue* aValue,
const nsAttrValue* aOldValue, bool aNotify)
const nsAttrValue* aOldValue,
nsIPrincipal* aMaybeScriptedPrincipal,
bool aNotify)
{
AfterMaybeChangeAttr(aNameSpaceID, aName, aNotify);
@@ -198,8 +200,10 @@ HTMLIFrameElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
}
}
}
return nsGenericHTMLFrameElement::AfterSetAttr(aNameSpaceID, aName, aValue,
aOldValue, aNotify);
return nsGenericHTMLFrameElement::AfterSetAttr(aNameSpaceID, aName,
aValue, aOldValue,
aMaybeScriptedPrincipal,
aNotify);
}
nsresult
+1
View File
@@ -185,6 +185,7 @@ protected:
virtual nsresult AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
const nsAttrValue* aValue,
const nsAttrValue* aOldValue,
nsIPrincipal* aMaybeScriptedPrincipal,
bool aNotify) override;
virtual nsresult OnAttrSetButNotChanged(int32_t aNamespaceID, nsIAtom* aName,
const nsAttrValueOrString& aValue,
+9 -4
View File
@@ -395,10 +395,12 @@ HTMLImageElement::BeforeSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
nsresult
HTMLImageElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
const nsAttrValue* aValue,
const nsAttrValue* aOldValue, bool aNotify)
const nsAttrValue* aOldValue,
nsIPrincipal* aMaybeScriptedPrincipal,
bool aNotify)
{
if (aValue) {
AfterMaybeChangeAttr(aNameSpaceID, aName, aNotify);
AfterMaybeChangeAttr(aNameSpaceID, aName, aMaybeScriptedPrincipal, aNotify);
}
if (aNameSpaceID == kNameSpaceID_None && mForm &&
@@ -441,7 +443,9 @@ HTMLImageElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
}
return nsGenericHTMLElement::AfterSetAttr(aNameSpaceID, aName,
aValue, aOldValue, aNotify);
aValue, aOldValue,
aMaybeScriptedPrincipal,
aNotify);
}
nsresult
@@ -450,7 +454,7 @@ HTMLImageElement::OnAttrSetButNotChanged(int32_t aNamespaceID, nsIAtom* aName,
bool aNotify)
{
BeforeMaybeChangeAttr(aNamespaceID, aName, aValue, aNotify);
AfterMaybeChangeAttr(aNamespaceID, aName, aNotify);
AfterMaybeChangeAttr(aNamespaceID, aName, nullptr, aNotify);
return nsGenericHTMLElement::OnAttrSetButNotChanged(aNamespaceID, aName,
aValue, aNotify);
@@ -532,6 +536,7 @@ HTMLImageElement::BeforeMaybeChangeAttr(int32_t aNamespaceID, nsIAtom* aName,
void
HTMLImageElement::AfterMaybeChangeAttr(int32_t aNamespaceID, nsIAtom* aName,
nsIPrincipal* aMaybeScriptedPrincipal,
bool aNotify)
{
// Because we load image synchronously in non-responsive-mode, we need to do
+2
View File
@@ -344,6 +344,7 @@ protected:
virtual nsresult AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
const nsAttrValue* aValue,
const nsAttrValue* aOldValue,
nsIPrincipal* aMaybeScriptedPrincipal,
bool aNotify) override;
virtual nsresult OnAttrSetButNotChanged(int32_t aNamespaceID, nsIAtom* aName,
@@ -385,6 +386,7 @@ private:
* @param aNotify Whether we plan to notify document observers.
*/
void AfterMaybeChangeAttr(int32_t aNamespaceID, nsIAtom* aName,
nsIPrincipal* aMaybeScriptedPrincipal,
bool aNotify);
/**
* Used by BeforeMaybeChangeAttr and AfterMaybeChangeAttr to keep track of
+4 -1
View File
@@ -1291,7 +1291,9 @@ HTMLInputElement::BeforeSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
nsresult
HTMLInputElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
const nsAttrValue* aValue,
const nsAttrValue* aOldValue, bool aNotify)
const nsAttrValue* aOldValue,
nsIPrincipal* aSubjectPrincipal,
bool aNotify)
{
if (aNameSpaceID == kNameSpaceID_None) {
//
@@ -1442,6 +1444,7 @@ HTMLInputElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
return nsGenericHTMLFormElementWithState::AfterSetAttr(aNameSpaceID, aName,
aValue, aOldValue,
aSubjectPrincipal,
aNotify);
}
+1
View File
@@ -982,6 +982,7 @@ protected:
virtual nsresult AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
const nsAttrValue* aValue,
const nsAttrValue* aOldValue,
nsIPrincipal* aSubjectPrincipal,
bool aNotify) override;
virtual void ResultForDialogSubmit(nsAString& aResult) override;
+5 -2
View File
@@ -358,7 +358,9 @@ HTMLLinkElement::BeforeSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
nsresult
HTMLLinkElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
const nsAttrValue* aValue,
const nsAttrValue* aOldValue, bool aNotify)
const nsAttrValue* aOldValue,
nsIPrincipal* aSubjectPrincipal,
bool aNotify)
{
// It's safe to call ResetLinkState here because our new attr value has
// already been set or unset. ResetLinkState needs the updated attribute
@@ -452,7 +454,8 @@ HTMLLinkElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
}
return nsGenericHTMLElement::AfterSetAttr(aNameSpaceID, aName, aValue,
aOldValue, aNotify);
aOldValue, aSubjectPrincipal,
aNotify);
}
nsresult
+1
View File
@@ -67,6 +67,7 @@ public:
virtual nsresult AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
const nsAttrValue* aValue,
const nsAttrValue* aOldValue,
nsIPrincipal* aSubjectPrincipal,
bool aNotify) override;
virtual bool IsLink(nsIURI** aURI) const override;
virtual already_AddRefed<nsIURI> GetHrefURI() const override;
+6 -2
View File
@@ -4219,7 +4219,9 @@ int32_t HTMLMediaElement::TabIndexDefault()
nsresult
HTMLMediaElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
const nsAttrValue* aValue,
const nsAttrValue* aOldValue, bool aNotify)
const nsAttrValue* aOldValue,
nsIPrincipal* aMaybeScriptedPrincipal,
bool aNotify)
{
if (aNameSpaceID == kNameSpaceID_None) {
if (aName == nsGkAtoms::src) {
@@ -4261,7 +4263,9 @@ HTMLMediaElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
}
return nsGenericHTMLElement::AfterSetAttr(aNameSpaceID, aName,
aValue, aOldValue, aNotify);
aValue, aOldValue,
aMaybeScriptedPrincipal,
aNotify);
}
nsresult
+1
View File
@@ -1280,6 +1280,7 @@ protected:
virtual nsresult AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
const nsAttrValue* aValue,
const nsAttrValue* aOldValue,
nsIPrincipal* aMaybeScriptedPrincipal,
bool aNotify) override;
virtual nsresult OnAttrSetButNotChanged(int32_t aNamespaceID, nsIAtom* aName,
const nsAttrValueOrString& aValue,
+7 -3
View File
@@ -390,7 +390,9 @@ HTMLMenuItemElement::GetText(nsAString& aText)
nsresult
HTMLMenuItemElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
const nsAttrValue* aValue,
const nsAttrValue* aOldValue, bool aNotify)
const nsAttrValue* aOldValue,
nsIPrincipal* aSubjectPrincipal,
bool aNotify)
{
if (aNameSpaceID == kNameSpaceID_None) {
if ((aName == nsGkAtoms::radiogroup || aName == nsGkAtoms::type) &&
@@ -413,8 +415,10 @@ HTMLMenuItemElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
}
}
return nsGenericHTMLElement::AfterSetAttr(aNameSpaceID, aName, aValue,
aOldValue, aNotify);
return nsGenericHTMLElement::AfterSetAttr(aNameSpaceID, aName,
aValue, aOldValue,
aSubjectPrincipal,
aNotify);
}
void
+1
View File
@@ -127,6 +127,7 @@ protected:
virtual nsresult AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName,
const nsAttrValue* aValue,
const nsAttrValue* aOldValue,
nsIPrincipal* aSubjectPrincipal,
bool aNotify) override;
void WalkRadioGroup(Visitor* aVisitor);
+7 -3
View File
@@ -62,7 +62,9 @@ HTMLMetaElement::SetMetaReferrer(nsIDocument* aDocument)
nsresult
HTMLMetaElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
const nsAttrValue* aValue,
const nsAttrValue* aOldValue, bool aNotify)
const nsAttrValue* aOldValue,
nsIPrincipal* aSubjectPrincipal,
bool aNotify)
{
if (aNameSpaceID == kNameSpaceID_None) {
nsIDocument *document = GetUncomposedDoc();
@@ -83,8 +85,10 @@ HTMLMetaElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
}
}
return nsGenericHTMLElement::AfterSetAttr(aNameSpaceID, aName, aValue,
aOldValue, aNotify);
return nsGenericHTMLElement::AfterSetAttr(aNameSpaceID, aName,
aValue, aOldValue,
aSubjectPrincipal,
aNotify);
}
nsresult
+1
View File
@@ -35,6 +35,7 @@ public:
virtual nsresult AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
const nsAttrValue* aValue,
const nsAttrValue* aOldValue,
nsIPrincipal* aSubjectPrincipal,
bool aNotify) override;
void CreateAndDispatchEvent(nsIDocument* aDoc, const nsAString& aEventName);
+5 -2
View File
@@ -296,13 +296,16 @@ HTMLObjectElement::UnbindFromTree(bool aDeep,
nsresult
HTMLObjectElement::AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName,
const nsAttrValue* aValue,
const nsAttrValue* aOldValue, bool aNotify)
const nsAttrValue* aOldValue,
nsIPrincipal* aSubjectPrincipal,
bool aNotify)
{
nsresult rv = AfterMaybeChangeAttr(aNamespaceID, aName, aNotify);
NS_ENSURE_SUCCESS(rv, rv);
return nsGenericHTMLFormElement::AfterSetAttr(aNamespaceID, aName, aValue,
aOldValue, aNotify);
aOldValue, aSubjectPrincipal,
aNotify);
}
nsresult
+1
View File
@@ -246,6 +246,7 @@ public:
virtual nsresult AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName,
const nsAttrValue* aValue,
const nsAttrValue* aOldValue,
nsIPrincipal* aSubjectPrincipal,
bool aNotify) override;
virtual nsresult OnAttrSetButNotChanged(int32_t aNamespaceID, nsIAtom* aName,
const nsAttrValueOrString& aValue,
+5 -2
View File
@@ -107,7 +107,9 @@ HTMLOptGroupElement::RemoveChildAt(uint32_t aIndex, bool aNotify)
nsresult
HTMLOptGroupElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
const nsAttrValue* aValue,
const nsAttrValue* aOldValue, bool aNotify)
const nsAttrValue* aOldValue,
nsIPrincipal* aSubjectPrincipal,
bool aNotify)
{
if (aNameSpaceID == kNameSpaceID_None && aName == nsGkAtoms::disabled) {
// All our children <option> have their :disabled state depending on our
@@ -122,7 +124,8 @@ HTMLOptGroupElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
}
return nsGenericHTMLElement::AfterSetAttr(aNameSpaceID, aName, aValue,
aOldValue, aNotify);
aOldValue, aSubjectPrincipal,
aNotify);
}
EventStates
+1
View File
@@ -45,6 +45,7 @@ public:
virtual nsresult AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
const nsAttrValue* aValue,
const nsAttrValue* aOldValue,
nsIPrincipal* aSubjectPrincipal,
bool aNotify) override;
virtual nsIDOMNode* AsDOMNode() override { return this; }
+6 -2
View File
@@ -245,7 +245,9 @@ HTMLOptionElement::BeforeSetAttr(int32_t aNamespaceID, nsIAtom* aName,
nsresult
HTMLOptionElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
const nsAttrValue* aValue,
const nsAttrValue* aOldValue, bool aNotify)
const nsAttrValue* aOldValue,
nsIPrincipal* aSubjectPrincipal,
bool aNotify)
{
if (aNameSpaceID == kNameSpaceID_None &&
aName == nsGkAtoms::value && Selected()) {
@@ -259,7 +261,9 @@ HTMLOptionElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
}
return nsGenericHTMLElement::AfterSetAttr(aNameSpaceID, aName,
aValue, aOldValue, aNotify);
aValue, aOldValue,
aSubjectPrincipal,
aNotify);
}
NS_IMETHODIMP
+1
View File
@@ -52,6 +52,7 @@ public:
virtual nsresult AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
const nsAttrValue* aValue,
const nsAttrValue* aOldValue,
nsIPrincipal* aSubjectPrincipal,
bool aNotify) override;
void SetSelectedInternal(bool aValue, bool aNotify);
+7 -3
View File
@@ -233,13 +233,17 @@ HTMLScriptElement::SetNoModule(bool aValue, ErrorResult& aRv)
nsresult
HTMLScriptElement::AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName,
const nsAttrValue* aValue,
const nsAttrValue* aOldValue, bool aNotify)
const nsAttrValue* aOldValue,
nsIPrincipal* aMaybeScriptedPrincipal,
bool aNotify)
{
if (nsGkAtoms::async == aName && kNameSpaceID_None == aNamespaceID) {
mForceAsync = false;
}
return nsGenericHTMLElement::AfterSetAttr(aNamespaceID, aName, aValue,
aOldValue, aNotify);
return nsGenericHTMLElement::AfterSetAttr(aNamespaceID, aName,
aValue, aOldValue,
aMaybeScriptedPrincipal,
aNotify);
}
NS_IMETHODIMP
+1
View File
@@ -60,6 +60,7 @@ public:
virtual nsresult AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName,
const nsAttrValue* aValue,
const nsAttrValue* aOldValue,
nsIPrincipal* aMaybeScriptedPrincipal,
bool aNotify) override;
// WebIDL
+4 -1
View File
@@ -1310,7 +1310,9 @@ HTMLSelectElement::BeforeSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
nsresult
HTMLSelectElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
const nsAttrValue* aValue,
const nsAttrValue* aOldValue, bool aNotify)
const nsAttrValue* aOldValue,
nsIPrincipal* aSubjectPrincipal,
bool aNotify)
{
if (aNameSpaceID == kNameSpaceID_None) {
if (aName == nsGkAtoms::disabled) {
@@ -1331,6 +1333,7 @@ HTMLSelectElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
return nsGenericHTMLFormElementWithState::AfterSetAttr(aNameSpaceID, aName,
aValue, aOldValue,
aSubjectPrincipal,
aNotify);
}
+1
View File
@@ -384,6 +384,7 @@ public:
virtual nsresult AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
const nsAttrValue* aValue,
const nsAttrValue* aOldValue,
nsIPrincipal* aSubjectPrincipal,
bool aNotify) override;
virtual void DoneAddingChildren(bool aHaveNotified) override;
+5 -2
View File
@@ -234,7 +234,9 @@ SetBaseTargetUsingFirstBaseWithTarget(nsIDocument* aDocument,
nsresult
HTMLSharedElement::AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName,
const nsAttrValue* aValue,
const nsAttrValue* aOldValue, bool aNotify)
const nsAttrValue* aOldValue,
nsIPrincipal* aSubjectPrincipal,
bool aNotify)
{
if (aNamespaceID == kNameSpaceID_None) {
if (aName == nsGkAtoms::href) {
@@ -257,7 +259,8 @@ HTMLSharedElement::AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName,
}
}
return nsGenericHTMLElement::AfterSetAttr(aNamespaceID, aName, aValue,
aOldValue, aNotify);
aOldValue, aSubjectPrincipal,
aNotify);
}
nsresult
+1
View File
@@ -174,6 +174,7 @@ protected:
virtual nsresult AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName,
const nsAttrValue* aValue,
const nsAttrValue* aOldValue,
nsIPrincipal* aSubjectPrincipal,
bool aNotify) override;
};
+2 -1
View File
@@ -165,6 +165,7 @@ nsresult
HTMLSharedObjectElement::AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName,
const nsAttrValue* aValue,
const nsAttrValue* aOldValue,
nsIPrincipal* aSubjectPrincipal,
bool aNotify)
{
if (aValue) {
@@ -173,7 +174,7 @@ HTMLSharedObjectElement::AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName,
}
return nsGenericHTMLElement::AfterSetAttr(aNamespaceID, aName, aValue,
aOldValue, aNotify);
aOldValue, aSubjectPrincipal, aNotify);
}
nsresult
+1
View File
@@ -202,6 +202,7 @@ protected:
virtual nsresult AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName,
const nsAttrValue* aValue,
const nsAttrValue* aOldValue,
nsIPrincipal* aSubjectPrincipal,
bool aNotify) override;
virtual nsresult OnAttrSetButNotChanged(int32_t aNamespaceID, nsIAtom* aName,
const nsAttrValueOrString& aValue,
+3 -1
View File
@@ -103,6 +103,7 @@ nsresult
HTMLSlotElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
const nsAttrValue* aValue,
const nsAttrValue* aOldValue,
nsIPrincipal* aSubjectPrincipal,
bool aNotify)
{
@@ -120,7 +121,8 @@ HTMLSlotElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
}
return nsGenericHTMLElement::AfterSetAttr(aNameSpaceID, aName, aValue,
aOldValue, aNotify);
aOldValue, aSubjectPrincipal,
aNotify);
}
/**
+1
View File
@@ -39,6 +39,7 @@ public:
virtual nsresult AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
const nsAttrValue* aValue,
const nsAttrValue* aOldValue,
nsIPrincipal* aSubjectPrincipal,
bool aNotify) override;
// WebIDL
+6 -2
View File
@@ -99,7 +99,9 @@ HTMLSourceElement::UpdateMediaList(const nsAttrValue* aValue)
nsresult
HTMLSourceElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
const nsAttrValue* aValue,
const nsAttrValue* aOldValue, bool aNotify)
const nsAttrValue* aOldValue,
nsIPrincipal* aMaybeScriptedPrincipal,
bool aNotify)
{
// If we are associated with a <picture> with a valid <img>, notify it of
// responsive parameter changes
@@ -144,7 +146,9 @@ HTMLSourceElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
}
return nsGenericHTMLElement::AfterSetAttr(aNameSpaceID, aName,
aValue, aOldValue, aNotify);
aValue, aOldValue,
aMaybeScriptedPrincipal,
aNotify);
}
nsresult
+1
View File
@@ -111,6 +111,7 @@ protected:
virtual nsresult AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
const nsAttrValue* aValue,
const nsAttrValue* aOldValue,
nsIPrincipal* aMaybeScriptedPrincipal,
bool aNotify) override;
private:
+5 -2
View File
@@ -172,7 +172,9 @@ HTMLStyleElement::UnbindFromTree(bool aDeep, bool aNullParent)
nsresult
HTMLStyleElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
const nsAttrValue* aValue,
const nsAttrValue* aOldValue, bool aNotify)
const nsAttrValue* aOldValue,
nsIPrincipal* aSubjectPrincipal,
bool aNotify)
{
if (aNameSpaceID == kNameSpaceID_None) {
if (aName == nsGkAtoms::title ||
@@ -186,7 +188,8 @@ HTMLStyleElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
}
return nsGenericHTMLElement::AfterSetAttr(aNameSpaceID, aName, aValue,
aOldValue, aNotify);
aOldValue, aSubjectPrincipal,
aNotify);
}
NS_IMETHODIMP
+1
View File
@@ -49,6 +49,7 @@ public:
virtual nsresult AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
const nsAttrValue* aValue,
const nsAttrValue* aOldValue,
nsIPrincipal* aSubjectPrincipal,
bool aNotify) override;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const override;
+5 -2
View File
@@ -1006,13 +1006,16 @@ HTMLTableElement::BeforeSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
nsresult
HTMLTableElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
const nsAttrValue* aValue,
const nsAttrValue* aOldValue, bool aNotify)
const nsAttrValue* aOldValue,
nsIPrincipal* aSubjectPrincipal,
bool aNotify)
{
if (aName == nsGkAtoms::cellpadding && aNameSpaceID == kNameSpaceID_None) {
BuildInheritedAttributes();
}
return nsGenericHTMLElement::AfterSetAttr(aNameSpaceID, aName, aValue,
aOldValue, aNotify);
aOldValue, aSubjectPrincipal,
aNotify);
}
} // namespace dom
+1
View File
@@ -198,6 +198,7 @@ public:
virtual nsresult AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
const nsAttrValue* aValue,
const nsAttrValue* aOldValue,
nsIPrincipal* aSubjectPrincipal,
bool aNotify) override;
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(HTMLTableElement,
+5 -2
View File
@@ -1328,7 +1328,9 @@ HTMLTextAreaElement::ContentChanged(nsIContent* aContent)
nsresult
HTMLTextAreaElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
const nsAttrValue* aValue,
const nsAttrValue* aOldValue, bool aNotify)
const nsAttrValue* aOldValue,
nsIPrincipal* aSubjectPrincipal,
bool aNotify)
{
if (aNameSpaceID == kNameSpaceID_None) {
if (aName == nsGkAtoms::required || aName == nsGkAtoms::disabled ||
@@ -1347,7 +1349,8 @@ HTMLTextAreaElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
}
return nsGenericHTMLFormElementWithState::AfterSetAttr(aNameSpaceID, aName, aValue,
aOldValue, aNotify);
aOldValue, aSubjectPrincipal,
aNotify);
}
nsresult
+1
View File
@@ -359,6 +359,7 @@ protected:
virtual nsresult AfterSetAttr(int32_t aNamespaceID, nsIAtom *aName,
const nsAttrValue* aValue,
const nsAttrValue* aOldValue,
nsIPrincipal* aSubjectPrincipal,
bool aNotify) override;
/**
+12 -4
View File
@@ -679,7 +679,9 @@ nsGenericHTMLElement::BeforeSetAttr(int32_t aNamespaceID, nsIAtom* aName,
nsresult
nsGenericHTMLElement::AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName,
const nsAttrValue* aValue,
const nsAttrValue* aOldValue, bool aNotify)
const nsAttrValue* aOldValue,
nsIPrincipal* aMaybeScriptedPrincipal,
bool aNotify)
{
if (aNamespaceID == kNameSpaceID_None) {
if (IsEventAttributeName(aName) && aValue) {
@@ -769,7 +771,9 @@ nsGenericHTMLElement::AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName,
}
return nsGenericHTMLElementBase::AfterSetAttr(aNamespaceID, aName,
aValue, aOldValue, aNotify);
aValue, aOldValue,
aMaybeScriptedPrincipal,
aNotify);
}
EventListenerManager*
@@ -2019,7 +2023,9 @@ nsGenericHTMLFormElement::BeforeSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
nsresult
nsGenericHTMLFormElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
const nsAttrValue* aValue,
const nsAttrValue* aOldValue, bool aNotify)
const nsAttrValue* aOldValue,
nsIPrincipal* aMaybeScriptedPrincipal,
bool aNotify)
{
if (aNameSpaceID == kNameSpaceID_None) {
// add the control to the hashtable as needed
@@ -2068,7 +2074,9 @@ nsGenericHTMLFormElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
}
return nsGenericHTMLElement::AfterSetAttr(aNameSpaceID, aName,
aValue, aOldValue, aNotify);
aValue, aOldValue,
aMaybeScriptedPrincipal,
aNotify);
}
nsresult
+6
View File
@@ -912,6 +912,7 @@ protected:
virtual nsresult AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName,
const nsAttrValue* aValue,
const nsAttrValue* aOldValue,
nsIPrincipal* aMaybeScriptedPrincipal,
bool aNotify) override;
virtual mozilla::EventListenerManager*
@@ -957,6 +958,10 @@ protected:
{
mozilla::dom::Element::SetAttr(aName, aValue, aError);
}
void SetHTMLAttr(nsIAtom* aName, const nsAString& aValue, nsIPrincipal& aTriggeringPrincipal, mozilla::ErrorResult& aError)
{
mozilla::dom::Element::SetAttr(aName, aValue, aTriggeringPrincipal, aError);
}
void UnsetHTMLAttr(nsIAtom* aName, mozilla::ErrorResult& aError)
{
mozilla::dom::Element::UnsetAttr(aName, aError);
@@ -1271,6 +1276,7 @@ protected:
virtual nsresult AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
const nsAttrValue* aValue,
const nsAttrValue* aOldValue,
nsIPrincipal* aMaybeScriptedPrincipal,
bool aNotify) override;
/**
+5 -2
View File
@@ -338,7 +338,9 @@ PrincipalAllowsBrowserFrame(nsIPrincipal* aPrincipal)
/* virtual */ nsresult
nsGenericHTMLFrameElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
const nsAttrValue* aValue,
const nsAttrValue* aOldValue, bool aNotify)
const nsAttrValue* aOldValue,
nsIPrincipal* aSubjectPrincipal,
bool aNotify)
{
if (aValue) {
nsAttrValueOrString value(aValue);
@@ -377,7 +379,8 @@ nsGenericHTMLFrameElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
}
return nsGenericHTMLElement::AfterSetAttr(aNameSpaceID, aName, aValue,
aOldValue, aNotify);
aOldValue, aSubjectPrincipal,
aNotify);
}
nsresult
+1
View File
@@ -101,6 +101,7 @@ protected:
virtual nsresult AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
const nsAttrValue* aValue,
const nsAttrValue* aOldValue,
nsIPrincipal* aSubjectPrincipal,
bool aNotify) override;
virtual nsresult OnAttrSetButNotChanged(int32_t aNamespaceID, nsIAtom* aName,
const nsAttrValueOrString& aValue,
+5 -2
View File
@@ -1087,7 +1087,9 @@ nsMathMLElement::GetHrefURI() const
nsresult
nsMathMLElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
const nsAttrValue* aValue,
const nsAttrValue* aOldValue, bool aNotify)
const nsAttrValue* aOldValue,
nsIPrincipal* aSubjectPrincipal,
bool aNotify)
{
// It is important that this be done after the attribute is set/unset.
// We will need the updated attribute value because notifying the document
@@ -1105,7 +1107,8 @@ nsMathMLElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
}
return nsMathMLElementBase::AfterSetAttr(aNameSpaceID, aName, aValue,
aOldValue, aNotify);
aOldValue, aSubjectPrincipal,
aNotify);
}
JSObject*
+1
View File
@@ -104,6 +104,7 @@ protected:
virtual nsresult AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
const nsAttrValue* aValue,
const nsAttrValue* aOldValue,
nsIPrincipal* aSubjectPrincipal,
bool aNotify) override;
private:
+3 -1
View File
@@ -300,10 +300,12 @@ SVGAElement::IntrinsicState() const
nsresult
SVGAElement::SetAttr(int32_t aNameSpaceID, nsIAtom* aName,
nsIAtom* aPrefix, const nsAString& aValue,
nsIPrincipal* aSubjectPrincipal,
bool aNotify)
{
nsresult rv = SVGAElementBase::SetAttr(aNameSpaceID, aName, aPrefix,
aValue, aNotify);
aValue, aSubjectPrincipal,
aNotify);
// The ordering of the parent class's SetAttr call and Link::ResetLinkState
// is important here! The attribute is not set until SetAttr returns, and
+3 -5
View File
@@ -55,13 +55,11 @@ public:
virtual void GetLinkTarget(nsAString& aTarget) override;
virtual already_AddRefed<nsIURI> GetHrefURI() const override;
virtual EventStates IntrinsicState() const override;
nsresult SetAttr(int32_t aNameSpaceID, nsIAtom* aName,
const nsAString& aValue, bool aNotify)
{
return SetAttr(aNameSpaceID, aName, nullptr, aValue, aNotify);
}
using nsIContent::SetAttr;
virtual nsresult SetAttr(int32_t aNameSpaceID, nsIAtom* aName,
nsIAtom* aPrefix, const nsAString& aValue,
nsIPrincipal* aSubjectPrincipal,
bool aNotify) override;
virtual nsresult UnsetAttr(int32_t aNameSpaceID, nsIAtom* aAttribute,
bool aNotify) override;
+5 -2
View File
@@ -300,11 +300,14 @@ SVGAnimationElement::ParseAttribute(int32_t aNamespaceID,
nsresult
SVGAnimationElement::AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName,
const nsAttrValue* aValue,
const nsAttrValue* aOldValue, bool aNotify)
const nsAttrValue* aOldValue,
nsIPrincipal* aSubjectPrincipal,
bool aNotify)
{
nsresult rv =
SVGAnimationElementBase::AfterSetAttr(aNamespaceID, aName, aValue,
aOldValue, aNotify);
aOldValue, aSubjectPrincipal,
aNotify);
if (SVGTests::IsConditionalProcessingAttribute(aName)) {
bool isDisabled = !SVGTests::PassesConditionalProcessingTests();
+1
View File
@@ -60,6 +60,7 @@ public:
virtual nsresult AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName,
const nsAttrValue* aValue,
const nsAttrValue* aOldValue,
nsIPrincipal* aSubjectPrincipal,
bool aNotify) override;
const nsAttrValue* GetAnimAttr(nsIAtom* aName) const;
+6 -2
View File
@@ -120,7 +120,9 @@ SVGFEImageElement::IsAttributeMapped(const nsIAtom* name) const
nsresult
SVGFEImageElement::AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName,
const nsAttrValue* aValue,
const nsAttrValue* aOldValue, bool aNotify)
const nsAttrValue* aOldValue,
nsIPrincipal* aSubjectPrincipal,
bool aNotify)
{
if (aName == nsGkAtoms::href &&
(aNamespaceID == kNameSpaceID_XLink ||
@@ -140,7 +142,9 @@ SVGFEImageElement::AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName,
}
return SVGFEImageElementBase::AfterSetAttr(aNamespaceID, aName,
aValue, aOldValue, aNotify);
aValue, aOldValue,
aSubjectPrincipal,
aNotify);
}
void
+1
View File
@@ -60,6 +60,7 @@ public:
virtual nsresult AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName,
const nsAttrValue* aValue,
const nsAttrValue* aOldValue,
nsIPrincipal* aSubjectPrincipal,
bool aNotify) override;
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
nsIContent* aBindingParent,
+6 -2
View File
@@ -37,7 +37,9 @@ SVGGeometryElement::GetNumberInfo()
nsresult
SVGGeometryElement::AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName,
const nsAttrValue* aValue,
const nsAttrValue* aOldValue, bool aNotify)
const nsAttrValue* aOldValue,
nsIPrincipal* aSubjectPrincipal,
bool aNotify)
{
if (mCachedPath &&
aNamespaceID == kNameSpaceID_None &&
@@ -45,7 +47,9 @@ SVGGeometryElement::AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName,
mCachedPath = nullptr;
}
return SVGGeometryElementBase::AfterSetAttr(aNamespaceID, aName,
aValue, aOldValue, aNotify);
aValue, aOldValue,
aSubjectPrincipal,
aNotify);
}
bool
+1
View File
@@ -54,6 +54,7 @@ public:
virtual nsresult AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName,
const nsAttrValue* aValue,
const nsAttrValue* aOldValue,
nsIPrincipal* aSubjectPrincipal,
bool aNotify) override;
/**
+6 -2
View File
@@ -151,7 +151,9 @@ SVGImageElement::AsyncEventRunning(AsyncEventDispatcher* aEvent)
nsresult
SVGImageElement::AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName,
const nsAttrValue* aValue,
const nsAttrValue* aOldValue, bool aNotify)
const nsAttrValue* aOldValue,
nsIPrincipal* aSubjectPrincipal,
bool aNotify)
{
if (aName == nsGkAtoms::href &&
(aNamespaceID == kNameSpaceID_None ||
@@ -170,7 +172,9 @@ SVGImageElement::AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName,
}
}
return SVGImageElementBase::AfterSetAttr(aNamespaceID, aName,
aValue, aOldValue, aNotify);
aValue, aOldValue,
aSubjectPrincipal,
aNotify);
}
void
+1
View File
@@ -48,6 +48,7 @@ public:
virtual nsresult AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName,
const nsAttrValue* aValue,
const nsAttrValue* aOldValue,
nsIPrincipal* aSubjectPrincipal,
bool aNotify) override;
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
nsIContent* aBindingParent,
+6 -2
View File
@@ -212,7 +212,9 @@ SVGScriptElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
nsresult
SVGScriptElement::AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName,
const nsAttrValue* aValue,
const nsAttrValue* aOldValue, bool aNotify)
const nsAttrValue* aOldValue,
nsIPrincipal* aSubjectPrincipal,
bool aNotify)
{
if ((aNamespaceID == kNameSpaceID_XLink ||
aNamespaceID == kNameSpaceID_None) &&
@@ -220,7 +222,9 @@ SVGScriptElement::AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName,
MaybeProcessScript();
}
return SVGScriptElementBase::AfterSetAttr(aNamespaceID, aName,
aValue, aOldValue, aNotify);
aValue, aOldValue,
aSubjectPrincipal,
aNotify);
}
bool
+1
View File
@@ -57,6 +57,7 @@ public:
virtual nsresult AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName,
const nsAttrValue* aValue,
const nsAttrValue* aOldValue,
nsIPrincipal* aSubjectPrincipal,
bool aNotify) override;
virtual bool ParseAttribute(int32_t aNamespaceID,
nsIAtom* aAttribute,
+2 -1
View File
@@ -95,10 +95,11 @@ SVGStyleElement::UnbindFromTree(bool aDeep, bool aNullParent)
nsresult
SVGStyleElement::SetAttr(int32_t aNameSpaceID, nsIAtom* aName,
nsIAtom* aPrefix, const nsAString& aValue,
nsIPrincipal* aSubjectPrincipal,
bool aNotify)
{
nsresult rv = SVGStyleElementBase::SetAttr(aNameSpaceID, aName, aPrefix,
aValue, aNotify);
aValue, aSubjectPrincipal, aNotify);
if (NS_SUCCEEDED(rv) && aNameSpaceID == kNameSpaceID_None) {
if (aName == nsGkAtoms::title ||
aName == nsGkAtoms::media ||
+3 -5
View File
@@ -44,13 +44,11 @@ public:
bool aCompileEventHandlers) override;
virtual void UnbindFromTree(bool aDeep = true,
bool aNullParent = true) override;
nsresult SetAttr(int32_t aNameSpaceID, nsIAtom* aName,
const nsAString& aValue, bool aNotify)
{
return SetAttr(aNameSpaceID, aName, nullptr, aValue, aNotify);
}
using nsIContent::SetAttr;
virtual nsresult SetAttr(int32_t aNameSpaceID, nsIAtom* aName,
nsIAtom* aPrefix, const nsAString& aValue,
nsIPrincipal* aSubjectPrincipal,
bool aNotify) override;
virtual nsresult UnsetAttr(int32_t aNameSpaceID, nsIAtom* aAttribute,
bool aNotify) override;
+5 -3
View File
@@ -288,7 +288,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
@@ -316,7 +318,7 @@ nsSVGElement::AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName,
}
return nsSVGElementBase::AfterSetAttr(aNamespaceID, aName, aValue, aOldValue,
aNotify);
aSubjectPrincipal, aNotify);
}
bool
@@ -1524,7 +1526,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);
}
+1
View File
@@ -343,6 +343,7 @@ protected:
virtual nsresult AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName,
const nsAttrValue* aValue,
const nsAttrValue* aOldValue,
nsIPrincipal* aSubjectPrincipal,
bool aNotify) override;
virtual bool ParseAttribute(int32_t aNamespaceID, nsIAtom* aAttribute,
const nsAString& aValue, nsAttrValue& aResult) override;
+1 -1
View File
@@ -42,7 +42,7 @@ interface AnonymousContent {
* Set the value of an attribute of an element inside this custom anonymous
* content.
*/
[Throws]
[NeedsSubjectPrincipal, Throws]
void setAttributeForElement(DOMString elementId,
DOMString attributeName,
DOMString value);
+1 -1
View File
@@ -12,7 +12,7 @@
interface Attr : Node {
readonly attribute DOMString localName;
[CEReactions, SetterThrows]
[CEReactions, NeedsSubjectPrincipal, SetterThrows]
attribute DOMString value;
[Constant]
+2 -2
View File
@@ -42,9 +42,9 @@ interface Element : Node {
DOMString? getAttributeNS(DOMString? namespace, DOMString localName);
[CEReactions, Throws]
boolean toggleAttribute(DOMString name, optional boolean force);
[CEReactions, Throws]
[CEReactions, NeedsSubjectPrincipal, Throws]
void setAttribute(DOMString name, DOMString value);
[CEReactions, Throws]
[CEReactions, NeedsSubjectPrincipal, Throws]
void setAttributeNS(DOMString? namespace, DOMString name, DOMString value);
[CEReactions, Throws]
void removeAttribute(DOMString name);
+4 -2
View File
@@ -1025,7 +1025,9 @@ nsXULElement::BeforeSetAttr(int32_t aNamespaceID, nsIAtom* aName,
nsresult
nsXULElement::AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName,
const nsAttrValue* aValue,
const nsAttrValue* aOldValue, bool aNotify)
const nsAttrValue* aOldValue,
nsIPrincipal* aSubjectPrincipal,
bool aNotify)
{
if (aNamespaceID == kNameSpaceID_None) {
if (aValue) {
@@ -1146,7 +1148,7 @@ nsXULElement::AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName,
}
return nsStyledElement::AfterSetAttr(aNamespaceID, aName,
aValue, aOldValue, aNotify);
aValue, aOldValue, aSubjectPrincipal, aNotify);
}
bool
+1
View File
@@ -743,6 +743,7 @@ protected:
virtual nsresult AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName,
const nsAttrValue* aValue,
const nsAttrValue* aOldValue,
nsIPrincipal* aSubjectPrincipal,
bool aNotify) override;
virtual void UpdateEditableState(bool aNotify) override;