Bug 1631581 - Part 6: Rename LenientSetter to LegacyLenientSetter r=edgar

Differential Revision: https://phabricator.services.mozilla.com/D111214
This commit is contained in:
Kagami Sascha Rosylight 2021-04-11 03:13:32 +00:00
Родитель 434af579f7
Коммит 074001023e
7 изменённых файлов: 33 добавлений и 30 удалений

Просмотреть файл

@ -3165,7 +3165,7 @@ class AttrDefiner(PropertyDefiner):
attr.readonly attr.readonly
and attr.getExtendedAttribute("PutForwards") is None and attr.getExtendedAttribute("PutForwards") is None
and attr.getExtendedAttribute("Replaceable") is None and attr.getExtendedAttribute("Replaceable") is None
and attr.getExtendedAttribute("LenientSetter") is None and attr.getExtendedAttribute("LegacyLenientSetter") is None
): ):
return "nullptr, nullptr" return "nullptr, nullptr"
if crossOriginOnly and not attr.getExtendedAttribute("CrossOriginWritable"): if crossOriginOnly and not attr.getExtendedAttribute("CrossOriginWritable"):
@ -11732,7 +11732,7 @@ class CGMemberJITInfo(CGThing):
not self.member.readonly not self.member.readonly
or self.member.getExtendedAttribute("PutForwards") is not None or self.member.getExtendedAttribute("PutForwards") is not None
or self.member.getExtendedAttribute("Replaceable") is not None or self.member.getExtendedAttribute("Replaceable") is not None
or self.member.getExtendedAttribute("LenientSetter") is not None or self.member.getExtendedAttribute("LegacyLenientSetter") is not None
): ):
setterinfo = "%s_setterinfo" % IDLToCIdentifier( setterinfo = "%s_setterinfo" % IDLToCIdentifier(
self.member.identifier.name self.member.identifier.name
@ -16111,7 +16111,7 @@ def memberProperties(m, descriptor):
if m.getExtendedAttribute("CrossOriginWritable"): if m.getExtendedAttribute("CrossOriginWritable"):
props.isCrossOriginSetter = True props.isCrossOriginSetter = True
elif m.getExtendedAttribute("Replaceable") or m.getExtendedAttribute( elif m.getExtendedAttribute("Replaceable") or m.getExtendedAttribute(
"LenientSetter" "LegacyLenientSetter"
): ):
if m.getExtendedAttribute("CrossOriginWritable"): if m.getExtendedAttribute("CrossOriginWritable"):
props.isCrossOriginSetter = True props.isCrossOriginSetter = True
@ -16216,7 +16216,7 @@ class CGDescriptor(CGThing):
needCrossOriginPropertyArrays = True needCrossOriginPropertyArrays = True
elif m.getExtendedAttribute("Replaceable"): elif m.getExtendedAttribute("Replaceable"):
cgThings.append(CGSpecializedReplaceableSetter(descriptor, m)) cgThings.append(CGSpecializedReplaceableSetter(descriptor, m))
elif m.getExtendedAttribute("LenientSetter"): elif m.getExtendedAttribute("LegacyLenientSetter"):
# XXX In this case, we need to add an include for mozilla/dom/Document.h to the generated cpp file. # XXX In this case, we need to add an include for mozilla/dom/Document.h to the generated cpp file.
cgThings.append(CGSpecializedLenientSetter(descriptor, m)) cgThings.append(CGSpecializedLenientSetter(descriptor, m))
if ( if (

Просмотреть файл

@ -5292,35 +5292,36 @@ class IDLAttribute(IDLInterfaceMember):
"appear on the same attribute", "appear on the same attribute",
[attr.location, self.location], [attr.location, self.location],
) )
elif identifier == "LenientSetter": elif identifier == "LegacyLenientSetter":
if not attr.noArguments(): if not attr.noArguments():
raise WebIDLError( raise WebIDLError(
"[LenientSetter] must take no arguments", [attr.location] "[LegacyLenientSetter] must take no arguments", [attr.location]
) )
if not self.readonly: if not self.readonly:
raise WebIDLError( raise WebIDLError(
"[LenientSetter] is only allowed on readonly " "attributes", "[LegacyLenientSetter] is only allowed on readonly " "attributes",
[attr.location, self.location], [attr.location, self.location],
) )
if self.type.isPromise(): if self.type.isPromise():
raise WebIDLError( raise WebIDLError(
"[LenientSetter] is not allowed on " "Promise-typed attributes", "[LegacyLenientSetter] is not allowed on "
"Promise-typed attributes",
[attr.location, self.location], [attr.location, self.location],
) )
if self.isStatic(): if self.isStatic():
raise WebIDLError( raise WebIDLError(
"[LenientSetter] is only allowed on non-static " "attributes", "[LegacyLenientSetter] is only allowed on non-static " "attributes",
[attr.location, self.location], [attr.location, self.location],
) )
if self.getExtendedAttribute("PutForwards") is not None: if self.getExtendedAttribute("PutForwards") is not None:
raise WebIDLError( raise WebIDLError(
"[LenientSetter] and [PutForwards] can't both " "[LegacyLenientSetter] and [PutForwards] can't both "
"appear on the same attribute", "appear on the same attribute",
[attr.location, self.location], [attr.location, self.location],
) )
if self.getExtendedAttribute("Replaceable") is not None: if self.getExtendedAttribute("Replaceable") is not None:
raise WebIDLError( raise WebIDLError(
"[LenientSetter] and [Replaceable] can't both " "[LegacyLenientSetter] and [Replaceable] can't both "
"appear on the same attribute", "appear on the same attribute",
[attr.location, self.location], [attr.location, self.location],
) )
@ -6309,9 +6310,9 @@ class IDLMethod(IDLInterfaceMember, IDLScope):
raise WebIDLError( raise WebIDLError(
"Only attributes support [PutForwards]", [attr.location, self.location] "Only attributes support [PutForwards]", [attr.location, self.location]
) )
elif identifier == "LenientSetter": elif identifier == "LegacyLenientSetter":
raise WebIDLError( raise WebIDLError(
"Only attributes support [LenientSetter]", "Only attributes support [LegacyLenientSetter]",
[attr.location, self.location], [attr.location, self.location],
) )
elif identifier == "LenientFloat": elif identifier == "LenientFloat":

Просмотреть файл

@ -16,19 +16,19 @@ def should_throw(parser, harness, message, code):
def WebIDLTest(parser, harness): def WebIDLTest(parser, harness):
# The [LenientSetter] extended attribute MUST take no arguments. # The [LegacyLenientSetter] extended attribute MUST take no arguments.
should_throw( should_throw(
parser, parser,
harness, harness,
"no arguments", "no arguments",
""" """
interface I { interface I {
[LenientSetter=X] readonly attribute long A; [LegacyLenientSetter=X] readonly attribute long A;
}; };
""", """,
) )
# An attribute with the [LenientSetter] extended attribute MUST NOT # An attribute with the [LegacyLenientSetter] extended attribute MUST NOT
# also be declared with the [PutForwards] extended attribute. # also be declared with the [PutForwards] extended attribute.
should_throw( should_throw(
parser, parser,
@ -36,7 +36,7 @@ def WebIDLTest(parser, harness):
"PutForwards", "PutForwards",
""" """
interface I { interface I {
[PutForwards=B, LenientSetter] readonly attribute J A; [PutForwards=B, LegacyLenientSetter] readonly attribute J A;
}; };
interface J { interface J {
attribute long B; attribute long B;
@ -44,7 +44,7 @@ def WebIDLTest(parser, harness):
""", """,
) )
# An attribute with the [LenientSetter] extended attribute MUST NOT # An attribute with the [LegacyLenientSetter] extended attribute MUST NOT
# also be declared with the [Replaceable] extended attribute. # also be declared with the [Replaceable] extended attribute.
should_throw( should_throw(
parser, parser,
@ -52,12 +52,12 @@ def WebIDLTest(parser, harness):
"Replaceable", "Replaceable",
""" """
interface I { interface I {
[Replaceable, LenientSetter] readonly attribute J A; [Replaceable, LegacyLenientSetter] readonly attribute J A;
}; };
""", """,
) )
# The [LenientSetter] extended attribute MUST NOT be used on an # The [LegacyLenientSetter] extended attribute MUST NOT be used on an
# attribute that is not read only. # attribute that is not read only.
should_throw( should_throw(
parser, parser,
@ -65,12 +65,12 @@ def WebIDLTest(parser, harness):
"writable attribute", "writable attribute",
""" """
interface I { interface I {
[LenientSetter] attribute long A; [LegacyLenientSetter] attribute long A;
}; };
""", """,
) )
# The [LenientSetter] extended attribute MUST NOT be used on a # The [LegacyLenientSetter] extended attribute MUST NOT be used on a
# static attribute. # static attribute.
should_throw( should_throw(
parser, parser,
@ -78,7 +78,7 @@ def WebIDLTest(parser, harness):
"static attribute", "static attribute",
""" """
interface I { interface I {
[LenientSetter] static readonly attribute long A; [LegacyLenientSetter] static readonly attribute long A;
}; };
""", """,
) )

Просмотреть файл

@ -120,14 +120,16 @@ def WebIDLTest(parser, harness):
parser.parse( parser.parse(
""" """
interface A { interface A {
[LenientSetter] readonly attribute Promise<any> attr; [LegacyLenientSetter] readonly attribute Promise<any> attr;
}; };
""" """
) )
results = parser.finish() results = parser.finish()
except: except:
threw = True threw = True
harness.ok(threw, "Should not allow [LenientSetter] Promise-typed attributes.") harness.ok(
threw, "Should not allow [LegacyLenientSetter] Promise-typed attributes."
)
parser = parser.reset() parser = parser.reset()
threw = False threw = False

Просмотреть файл

@ -290,11 +290,11 @@ partial interface Document {
partial interface Document { partial interface Document {
// Note: Per spec the 'S' in these two is lowercase, but the "Moz" // Note: Per spec the 'S' in these two is lowercase, but the "Moz"
// versions have it uppercase. // versions have it uppercase.
[LenientSetter, Unscopable] [LegacyLenientSetter, Unscopable]
readonly attribute boolean fullscreen; readonly attribute boolean fullscreen;
[BinaryName="fullscreen"] [BinaryName="fullscreen"]
readonly attribute boolean mozFullScreen; readonly attribute boolean mozFullScreen;
[LenientSetter, NeedsCallerType] [LegacyLenientSetter, NeedsCallerType]
readonly attribute boolean fullscreenEnabled; readonly attribute boolean fullscreenEnabled;
[BinaryName="fullscreenEnabled", NeedsCallerType] [BinaryName="fullscreenEnabled", NeedsCallerType]
readonly attribute boolean mozFullScreenEnabled; readonly attribute boolean mozFullScreenEnabled;

Просмотреть файл

@ -29,7 +29,7 @@ interface mixin DocumentOrShadowRoot {
readonly attribute StyleSheetList styleSheets; readonly attribute StyleSheetList styleSheets;
readonly attribute Element? pointerLockElement; readonly attribute Element? pointerLockElement;
[LenientSetter] [LegacyLenientSetter]
readonly attribute Element? fullscreenElement; readonly attribute Element? fullscreenElement;
[BinaryName="fullscreenElement"] [BinaryName="fullscreenElement"]
readonly attribute Element? mozFullScreenElement; readonly attribute Element? mozFullScreenElement;

Просмотреть файл

@ -82,7 +82,7 @@ interface U2F {
// Returns a Function. It's readonly + [LenientSetter] to keep the Google // Returns a Function. It's readonly + [LenientSetter] to keep the Google
// U2F polyfill from stomping on the value. // U2F polyfill from stomping on the value.
[LenientSetter, Pure, Cached, Throws] [LegacyLenientSetter, Pure, Cached, Throws]
readonly attribute object register; readonly attribute object register;
// A way to generate the actual implementation of register() // A way to generate the actual implementation of register()
@ -95,7 +95,7 @@ interface U2F {
// Returns a Function. It's readonly + [LenientSetter] to keep the Google // Returns a Function. It's readonly + [LenientSetter] to keep the Google
// U2F polyfill from stomping on the value. // U2F polyfill from stomping on the value.
[LenientSetter, Pure, Cached, Throws] [LegacyLenientSetter, Pure, Cached, Throws]
readonly attribute object sign; readonly attribute object sign;
// A way to generate the actual implementation of sign() // A way to generate the actual implementation of sign()