From 074001023ef2b1fe9f44d3549162ef209d7fd04b Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Sun, 11 Apr 2021 03:13:32 +0000 Subject: [PATCH] Bug 1631581 - Part 6: Rename LenientSetter to LegacyLenientSetter r=edgar Differential Revision: https://phabricator.services.mozilla.com/D111214 --- dom/bindings/Codegen.py | 8 ++++---- dom/bindings/parser/WebIDL.py | 19 +++++++++--------- .../parser/tests/test_lenientSetter.py | 20 +++++++++---------- dom/bindings/parser/tests/test_promise.py | 6 ++++-- dom/webidl/Document.webidl | 4 ++-- dom/webidl/DocumentOrShadowRoot.webidl | 2 +- dom/webidl/U2F.webidl | 4 ++-- 7 files changed, 33 insertions(+), 30 deletions(-) diff --git a/dom/bindings/Codegen.py b/dom/bindings/Codegen.py index 6af98399bde9..8c4b546da04a 100644 --- a/dom/bindings/Codegen.py +++ b/dom/bindings/Codegen.py @@ -3165,7 +3165,7 @@ class AttrDefiner(PropertyDefiner): attr.readonly and attr.getExtendedAttribute("PutForwards") is None and attr.getExtendedAttribute("Replaceable") is None - and attr.getExtendedAttribute("LenientSetter") is None + and attr.getExtendedAttribute("LegacyLenientSetter") is None ): return "nullptr, nullptr" if crossOriginOnly and not attr.getExtendedAttribute("CrossOriginWritable"): @@ -11732,7 +11732,7 @@ class CGMemberJITInfo(CGThing): not self.member.readonly or self.member.getExtendedAttribute("PutForwards") 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( self.member.identifier.name @@ -16111,7 +16111,7 @@ def memberProperties(m, descriptor): if m.getExtendedAttribute("CrossOriginWritable"): props.isCrossOriginSetter = True elif m.getExtendedAttribute("Replaceable") or m.getExtendedAttribute( - "LenientSetter" + "LegacyLenientSetter" ): if m.getExtendedAttribute("CrossOriginWritable"): props.isCrossOriginSetter = True @@ -16216,7 +16216,7 @@ class CGDescriptor(CGThing): needCrossOriginPropertyArrays = True elif m.getExtendedAttribute("Replaceable"): 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. cgThings.append(CGSpecializedLenientSetter(descriptor, m)) if ( diff --git a/dom/bindings/parser/WebIDL.py b/dom/bindings/parser/WebIDL.py index 75dea9ff6f5c..7c82df0f6f7f 100644 --- a/dom/bindings/parser/WebIDL.py +++ b/dom/bindings/parser/WebIDL.py @@ -5292,35 +5292,36 @@ class IDLAttribute(IDLInterfaceMember): "appear on the same attribute", [attr.location, self.location], ) - elif identifier == "LenientSetter": + elif identifier == "LegacyLenientSetter": if not attr.noArguments(): raise WebIDLError( - "[LenientSetter] must take no arguments", [attr.location] + "[LegacyLenientSetter] must take no arguments", [attr.location] ) if not self.readonly: raise WebIDLError( - "[LenientSetter] is only allowed on readonly " "attributes", + "[LegacyLenientSetter] is only allowed on readonly " "attributes", [attr.location, self.location], ) if self.type.isPromise(): raise WebIDLError( - "[LenientSetter] is not allowed on " "Promise-typed attributes", + "[LegacyLenientSetter] is not allowed on " + "Promise-typed attributes", [attr.location, self.location], ) if self.isStatic(): raise WebIDLError( - "[LenientSetter] is only allowed on non-static " "attributes", + "[LegacyLenientSetter] is only allowed on non-static " "attributes", [attr.location, self.location], ) if self.getExtendedAttribute("PutForwards") is not None: raise WebIDLError( - "[LenientSetter] and [PutForwards] can't both " + "[LegacyLenientSetter] and [PutForwards] can't both " "appear on the same attribute", [attr.location, self.location], ) if self.getExtendedAttribute("Replaceable") is not None: raise WebIDLError( - "[LenientSetter] and [Replaceable] can't both " + "[LegacyLenientSetter] and [Replaceable] can't both " "appear on the same attribute", [attr.location, self.location], ) @@ -6309,9 +6310,9 @@ class IDLMethod(IDLInterfaceMember, IDLScope): raise WebIDLError( "Only attributes support [PutForwards]", [attr.location, self.location] ) - elif identifier == "LenientSetter": + elif identifier == "LegacyLenientSetter": raise WebIDLError( - "Only attributes support [LenientSetter]", + "Only attributes support [LegacyLenientSetter]", [attr.location, self.location], ) elif identifier == "LenientFloat": diff --git a/dom/bindings/parser/tests/test_lenientSetter.py b/dom/bindings/parser/tests/test_lenientSetter.py index e4584e704c19..9d2230c3bec5 100644 --- a/dom/bindings/parser/tests/test_lenientSetter.py +++ b/dom/bindings/parser/tests/test_lenientSetter.py @@ -16,19 +16,19 @@ def should_throw(parser, harness, message, code): def WebIDLTest(parser, harness): - # The [LenientSetter] extended attribute MUST take no arguments. + # The [LegacyLenientSetter] extended attribute MUST take no arguments. should_throw( parser, harness, "no arguments", """ 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. should_throw( parser, @@ -36,7 +36,7 @@ def WebIDLTest(parser, harness): "PutForwards", """ interface I { - [PutForwards=B, LenientSetter] readonly attribute J A; + [PutForwards=B, LegacyLenientSetter] readonly attribute J A; }; interface J { 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. should_throw( parser, @@ -52,12 +52,12 @@ def WebIDLTest(parser, harness): "Replaceable", """ 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. should_throw( parser, @@ -65,12 +65,12 @@ def WebIDLTest(parser, harness): "writable attribute", """ 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. should_throw( parser, @@ -78,7 +78,7 @@ def WebIDLTest(parser, harness): "static attribute", """ interface I { - [LenientSetter] static readonly attribute long A; + [LegacyLenientSetter] static readonly attribute long A; }; """, ) diff --git a/dom/bindings/parser/tests/test_promise.py b/dom/bindings/parser/tests/test_promise.py index 1dac59dfd112..0829a105e549 100644 --- a/dom/bindings/parser/tests/test_promise.py +++ b/dom/bindings/parser/tests/test_promise.py @@ -120,14 +120,16 @@ def WebIDLTest(parser, harness): parser.parse( """ interface A { - [LenientSetter] readonly attribute Promise attr; + [LegacyLenientSetter] readonly attribute Promise attr; }; """ ) results = parser.finish() except: 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() threw = False diff --git a/dom/webidl/Document.webidl b/dom/webidl/Document.webidl index f0e93c4b2107..5c03ff60676b 100644 --- a/dom/webidl/Document.webidl +++ b/dom/webidl/Document.webidl @@ -290,11 +290,11 @@ partial interface Document { partial interface Document { // Note: Per spec the 'S' in these two is lowercase, but the "Moz" // versions have it uppercase. - [LenientSetter, Unscopable] + [LegacyLenientSetter, Unscopable] readonly attribute boolean fullscreen; [BinaryName="fullscreen"] readonly attribute boolean mozFullScreen; - [LenientSetter, NeedsCallerType] + [LegacyLenientSetter, NeedsCallerType] readonly attribute boolean fullscreenEnabled; [BinaryName="fullscreenEnabled", NeedsCallerType] readonly attribute boolean mozFullScreenEnabled; diff --git a/dom/webidl/DocumentOrShadowRoot.webidl b/dom/webidl/DocumentOrShadowRoot.webidl index dd4177c86fc5..8f61e61ee3ae 100644 --- a/dom/webidl/DocumentOrShadowRoot.webidl +++ b/dom/webidl/DocumentOrShadowRoot.webidl @@ -29,7 +29,7 @@ interface mixin DocumentOrShadowRoot { readonly attribute StyleSheetList styleSheets; readonly attribute Element? pointerLockElement; - [LenientSetter] + [LegacyLenientSetter] readonly attribute Element? fullscreenElement; [BinaryName="fullscreenElement"] readonly attribute Element? mozFullScreenElement; diff --git a/dom/webidl/U2F.webidl b/dom/webidl/U2F.webidl index 81d122921b5d..94e7c9091932 100644 --- a/dom/webidl/U2F.webidl +++ b/dom/webidl/U2F.webidl @@ -82,7 +82,7 @@ interface U2F { // Returns a Function. It's readonly + [LenientSetter] to keep the Google // U2F polyfill from stomping on the value. - [LenientSetter, Pure, Cached, Throws] + [LegacyLenientSetter, Pure, Cached, Throws] readonly attribute object 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 // U2F polyfill from stomping on the value. - [LenientSetter, Pure, Cached, Throws] + [LegacyLenientSetter, Pure, Cached, Throws] readonly attribute object sign; // A way to generate the actual implementation of sign()