From cdf754533a1f001196a84406c981040c6e5d095b Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Wed, 11 Sep 2019 21:23:25 +0000 Subject: [PATCH] Bug 1578173 part 5. Remove vestigial binaryNames annotations from Bindings.conf. r=edgar Differential Revision: https://phabricator.services.mozilla.com/D45393 --HG-- extra : moz-landing-system : lando --- dom/bindings/Bindings.conf | 18 ------------------ dom/bindings/Configuration.py | 20 +++++++++++--------- dom/bindings/test/TestBindingHeader.h | 3 --- dom/bindings/test/TestCodeGen.webidl | 8 ++++---- dom/bindings/test/TestExampleGen.webidl | 8 ++++---- dom/bindings/test/TestJSImplGen.webidl | 8 ++++---- dom/webidl/KeyboardEvent.webidl | 1 + 7 files changed, 24 insertions(+), 42 deletions(-) diff --git a/dom/bindings/Bindings.conf b/dom/bindings/Bindings.conf index f5bb91e8371e..8b561312b6a4 100644 --- a/dom/bindings/Bindings.conf +++ b/dom/bindings/Bindings.conf @@ -27,11 +27,6 @@ # wrapping it the right IID needs to be passed in. # Only relevant for callback interfaces. # * register - True if this binding should be registered. Defaults to true. -# * binaryNames - Dict for mapping method and attribute names to different -# names when calling the native methods (defaults to an empty -# dict). The keys are the property names as they appear in the -# .webidl file and the values are the names as they should be -# in the WebIDL. # * wrapperCache: True if this object is a wrapper cache. Objects that are # not can only be returned from a limited set of methods, # cannot be prefable, and must ensure that they disallow @@ -445,10 +440,6 @@ DOMInterfaces = { 'headerFile': 'DOMIntersectionObserver.h', }, -'KeyboardEvent': { - 'binaryNames': { 'constructor': 'ConstructorJS' }, -}, - 'LegacyMozTCPSocket': { 'headerFile': 'TCPSocket.h', 'wrapperCache': False, @@ -1525,9 +1516,6 @@ DOMInterfaces = { # Keep this in sync with TestExampleInterface 'headerFile': 'TestBindingHeader.h', 'register': False, - 'binaryNames': { 'methodRenamedFrom': 'methodRenamedTo', - 'attributeGetterRenamedFrom': 'attributeGetterRenamedTo', - 'attributeRenamedFrom': 'attributeRenamedTo' } }, 'TestParentInterface' : { @@ -1554,9 +1542,6 @@ DOMInterfaces = { # Keep this in sync with TestExampleInterface 'headerFile': 'TestJSImplGenBinding.h', 'register': False, - 'binaryNames': { 'methodRenamedFrom': 'methodRenamedTo', - 'attributeGetterRenamedFrom': 'attributeGetterRenamedTo', - 'attributeRenamedFrom': 'attributeRenamedTo' } }, 'TestJSImplInterface2' : { @@ -1717,9 +1702,6 @@ DOMInterfaces = { # Keep this in sync with TestInterface 'headerFile': 'TestExampleInterface-example.h', 'register': False, - 'binaryNames': { 'methodRenamedFrom': 'methodRenamedTo', - 'attributeGetterRenamedFrom': 'attributeGetterRenamedTo', - 'attributeRenamedFrom': 'attributeRenamedTo' } }, 'TestExampleWorkerInterface' : { diff --git a/dom/bindings/Configuration.py b/dom/bindings/Configuration.py index 1202ffb1545d..fb7f49118c25 100644 --- a/dom/bindings/Configuration.py +++ b/dom/bindings/Configuration.py @@ -561,23 +561,25 @@ class Descriptor(DescriptorProvider): for attribute in ['implicitJSContext']: addExtendedAttribute(attribute, desc.get(attribute, {})) - self._binaryNames = desc.get('binaryNames', {}) + self._binaryNames = {} if not self.interface.isExternal(): - def isTestInterface(iface): - return (iface.identifier.name in ["TestInterface", - "TestJSImplInterface", - "TestRenamedInterface"]) - - for member in self.interface.members: - if not member.isAttr() and not member.isMethod(): - continue + def maybeAddBinaryName(member): binaryName = member.getExtendedAttribute("BinaryName") if binaryName: assert isinstance(binaryName, list) assert len(binaryName) == 1 self._binaryNames.setdefault(member.identifier.name, binaryName[0]) + for member in self.interface.members: + if not member.isAttr() and not member.isMethod(): + continue + maybeAddBinaryName(member); + + ctor = self.interface.ctor() + if ctor: + maybeAddBinaryName(ctor) + # Some default binary names for cases when nothing else got set. self._binaryNames.setdefault('__legacycaller', 'LegacyCall') self._binaryNames.setdefault('__stringifier', 'Stringify') diff --git a/dom/bindings/test/TestBindingHeader.h b/dom/bindings/test/TestBindingHeader.h index 10ae67dc8e73..20074f98b58c 100644 --- a/dom/bindings/test/TestBindingHeader.h +++ b/dom/bindings/test/TestBindingHeader.h @@ -893,13 +893,10 @@ class TestInterface : public nsISupports, public nsWrapperCache { // binaryNames tests void MethodRenamedTo(); - void OtherMethodRenamedTo(); void MethodRenamedTo(int8_t); int8_t AttributeGetterRenamedTo(); int8_t AttributeRenamedTo(); void SetAttributeRenamedTo(int8_t); - int8_t OtherAttributeRenamedTo(); - void SetOtherAttributeRenamedTo(int8_t); // Dictionary tests void PassDictionary(JSContext*, const Dict&); diff --git a/dom/bindings/test/TestCodeGen.webidl b/dom/bindings/test/TestCodeGen.webidl index 42cc1cf65f0d..e59eac85114c 100644 --- a/dom/bindings/test/TestCodeGen.webidl +++ b/dom/bindings/test/TestCodeGen.webidl @@ -791,14 +791,14 @@ interface TestInterface { Promise receiveAddrefedPromise(); // binaryNames tests + [BinaryName="methodRenamedTo"] void methodRenamedFrom(); - [BinaryName="otherMethodRenamedTo"] - void otherMethodRenamedFrom(); + [BinaryName="methodRenamedTo"] void methodRenamedFrom(byte argument); + [BinaryName="attributeGetterRenamedTo"] readonly attribute byte attributeGetterRenamedFrom; + [BinaryName="attributeRenamedTo"] attribute byte attributeRenamedFrom; - [BinaryName="otherAttributeRenamedTo"] - attribute byte otherAttributeRenamedFrom; void passDictionary(optional Dict x = {}); void passDictionary2(Dict x); diff --git a/dom/bindings/test/TestExampleGen.webidl b/dom/bindings/test/TestExampleGen.webidl index 9f74c4504d49..5d8a2b3513ad 100644 --- a/dom/bindings/test/TestExampleGen.webidl +++ b/dom/bindings/test/TestExampleGen.webidl @@ -598,14 +598,14 @@ interface TestExampleInterface { Promise receiveAddrefedPromise(); // binaryNames tests + [BinaryName="methodRenamedTo"] void methodRenamedFrom(); - [BinaryName="otherMethodRenamedTo"] - void otherMethodRenamedFrom(); + [BinaryName="methodRenamedTo"] void methodRenamedFrom(byte argument); + [BinaryName="attributeGetterRenamedTo"] readonly attribute byte attributeGetterRenamedFrom; + [BinaryName="attributeRenamedTo"] attribute byte attributeRenamedFrom; - [BinaryName="otherAttributeRenamedTo"] - attribute byte otherAttributeRenamedFrom; void passDictionary(optional Dict x = {}); void passDictionary2(Dict x); diff --git a/dom/bindings/test/TestJSImplGen.webidl b/dom/bindings/test/TestJSImplGen.webidl index 821fdbb67b3f..064d3f08a544 100644 --- a/dom/bindings/test/TestJSImplGen.webidl +++ b/dom/bindings/test/TestJSImplGen.webidl @@ -612,14 +612,14 @@ interface TestJSImplInterface { Promise receiveAddrefedPromise(); // binaryNames tests + [BinaryName="methodRenamedTo"] void methodRenamedFrom(); - [BinaryName="otherMethodRenamedTo"] - void otherMethodRenamedFrom(); + [BinaryName="methodRenamedTo"] void methodRenamedFrom(byte argument); + [BinaryName="attributeGetterRenamedTo"] readonly attribute byte attributeGetterRenamedFrom; + [BinaryName="attributeRenamedTo"] attribute byte attributeRenamedFrom; - [BinaryName="otherAttributeRenamedTo"] - attribute byte otherAttributeRenamedFrom; void passDictionary(optional Dict x = {}); void passDictionary2(Dict x); diff --git a/dom/webidl/KeyboardEvent.webidl b/dom/webidl/KeyboardEvent.webidl index f667311972ed..f99b189e7b90 100644 --- a/dom/webidl/KeyboardEvent.webidl +++ b/dom/webidl/KeyboardEvent.webidl @@ -6,6 +6,7 @@ interface KeyboardEvent : UIEvent { + [BinaryName="constructorJS"] constructor(DOMString typeArg, optional KeyboardEventInit keyboardEventInitDict= {});