Bug 1948577 - Revert undesired IDL changes for Attr.textContent and Attr.nodeValue. r=smaug

Differential Revision: https://phabricator.services.mozilla.com/D238412
This commit is contained in:
Frédéric Wang
2025-02-17 07:51:01 +00:00
parent 2795949e31
commit 1d9f0689e1
4 changed files with 14 additions and 30 deletions

View File

@@ -187,8 +187,7 @@ bool Attr::Specified() const { return true; }
Element* Attr::GetOwnerElement() { return GetElement(); }
void Attr::SetNodeValueWithTrustedTypeCheck(const nsAString& aNodeValue,
ErrorResult& aError) {
void Attr::SetNodeValue(const nsAString& aNodeValue, ErrorResult& aError) {
SetValue(aNodeValue, nullptr, aError);
}
@@ -217,9 +216,9 @@ nsIURI* Attr::GetBaseURI(bool aTryUseXHRDocBaseURI) const {
: OwnerDoc()->GetBaseURI(aTryUseXHRDocBaseURI);
}
void Attr::SetTextContentWithTrustedTypeCheck(const nsAString& aTextContent,
nsIPrincipal* aSubjectPrincipal,
ErrorResult& aError) {
void Attr::SetTextContent(const nsAString& aTextContent,
nsIPrincipal* aSubjectPrincipal,
ErrorResult& aError) {
SetValue(aTextContent, aSubjectPrincipal, aError);
}

View File

@@ -42,23 +42,16 @@ class Attr final : public nsINode {
NS_IMPL_FROMNODE_HELPER(Attr, IsAttr())
// nsINode interface
void GetTextContentWithTrustedTypeCheck(nsAString& aTextContent,
mozilla::OOMReporter& aError) {
GetTextContentInternal(aTextContent, aError);
}
MOZ_CAN_RUN_SCRIPT void SetTextContentWithTrustedTypeCheck(
const nsAString& aTextContent, nsIPrincipal* aSubjectPrincipal,
mozilla::ErrorResult& aError);
MOZ_CAN_RUN_SCRIPT void SetTextContent(const nsAString& aTextContent,
nsIPrincipal* aSubjectPrincipal,
mozilla::ErrorResult& aError) override;
virtual void GetTextContentInternal(nsAString& aTextContent,
OOMReporter& aError) override;
virtual void SetTextContentInternal(const nsAString& aTextContent,
nsIPrincipal* aSubjectPrincipal,
ErrorResult& aError) override;
void GetNodeValueWithTrustedTypeCheck(nsAString& aNodeValue) {
GetNodeValueInternal(aNodeValue);
}
MOZ_CAN_RUN_SCRIPT void SetNodeValueWithTrustedTypeCheck(
const nsAString& aNodeValue, mozilla::ErrorResult& aError);
MOZ_CAN_RUN_SCRIPT void SetNodeValue(const nsAString& aNodeValue,
mozilla::ErrorResult& aError) override;
virtual void GetNodeValueInternal(nsAString& aNodeValue) override;
virtual void SetNodeValueInternal(const nsAString& aNodeValue,
ErrorResult& aError) override;

View File

@@ -1802,9 +1802,9 @@ class nsINode : public mozilla::dom::EventTarget {
void GetTextContent(nsAString& aTextContent, mozilla::OOMReporter& aError) {
GetTextContentInternal(aTextContent, aError);
}
void SetTextContent(const nsAString& aTextContent,
nsIPrincipal* aSubjectPrincipal,
mozilla::ErrorResult& aError) {
MOZ_CAN_RUN_SCRIPT virtual void SetTextContent(
const nsAString& aTextContent, nsIPrincipal* aSubjectPrincipal,
mozilla::ErrorResult& aError) {
SetTextContentInternal(aTextContent, aSubjectPrincipal, aError);
}
void SetTextContent(const nsAString& aTextContent,
@@ -2299,7 +2299,8 @@ class nsINode : public mozilla::dom::EventTarget {
nsINode& aOther, mozilla::Maybe<uint32_t>* aThisIndex = nullptr,
mozilla::Maybe<uint32_t>* aOtherIndex = nullptr) const;
void GetNodeValue(nsAString& aNodeValue) { GetNodeValueInternal(aNodeValue); }
void SetNodeValue(const nsAString& aNodeValue, mozilla::ErrorResult& aError) {
MOZ_CAN_RUN_SCRIPT virtual void SetNodeValue(const nsAString& aNodeValue,
mozilla::ErrorResult& aError) {
SetNodeValueInternal(aNodeValue, aError);
}
virtual void GetNodeValueInternal(nsAString& aNodeValue);

View File

@@ -16,15 +16,6 @@ interface Attr : Node {
[CEReactions, SetterNeedsSubjectPrincipal=NonSystem, SetterThrows]
attribute DOMString value;
// Rename binary names of nodeValue and textContent from the Node interface.
[CEReactions, SetterThrows, Pure,
BinaryName="nodeValueWithTrustedTypeCheck"]
attribute DOMString? nodeValue;
[CEReactions, SetterThrows, GetterCanOOM,
SetterNeedsSubjectPrincipal=NonSystem, Pure,
BinaryName="textContentWithTrustedTypeCheck"]
attribute DOMString? textContent;
[Constant]
readonly attribute DOMString name;
[Constant]