Bug 958887 part 1. Add support for doing BinaryName annotations in IDL. r=peterv

This commit is contained in:
Boris Zbarsky 2014-09-19 22:58:26 -04:00
parent abb6120f93
commit b959467c6e
6 changed files with 29 additions and 2 deletions

View File

@ -470,6 +470,16 @@ class Descriptor(DescriptorProvider):
m.getExtendedAttribute("AvailableIn") == "PrivilegedApps"):
self.featureDetectibleThings.add("%s.%s" % (self.interface.identifier.name, m.identifier.name))
for member in self.interface.members:
if not member.isAttr() and not member.isMethod():
continue
binaryName = member.getExtendedAttribute("BinaryName")
if binaryName:
assert isinstance(binaryName, list)
assert len(binaryName) == 1
self._binaryNames.setdefault(member.identifier.name,
binaryName[0])
# Build the prototype chain.
self.prototypeChain = []
parent = interface

View File

@ -3362,7 +3362,8 @@ class IDLAttribute(IDLInterfaceMember):
identifier == "AvailableIn" or
identifier == "NewObject" or
identifier == "UnsafeInPrerendering" or
identifier == "CheckPermissions"):
identifier == "CheckPermissions" or
identifier == "BinaryName"):
# Known attributes that we don't need to do anything with here
pass
else:
@ -3963,7 +3964,8 @@ class IDLMethod(IDLInterfaceMember, IDLScope):
identifier == "Pref" or
identifier == "Func" or
identifier == "AvailableIn" or
identifier == "CheckPermissions"):
identifier == "CheckPermissions" or
identifier == "BinaryName"):
# Known attributes that we don't need to do anything with here
pass
else:

View File

@ -689,10 +689,13 @@ public:
// 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&);

View File

@ -656,9 +656,13 @@ interface TestInterface {
// binaryNames tests
void methodRenamedFrom();
[BinaryName="otherMethodRenamedTo"]
void otherMethodRenamedFrom();
void methodRenamedFrom(byte argument);
readonly attribute byte attributeGetterRenamedFrom;
attribute byte attributeRenamedFrom;
[BinaryName="otherAttributeRenamedTo"]
attribute byte otherAttributeRenamedFrom;
void passDictionary(optional Dict x);
[Cached, Pure]

View File

@ -520,9 +520,13 @@ interface TestExampleInterface {
// binaryNames tests
void methodRenamedFrom();
[BinaryName="otherMethodRenamedTo"]
void otherMethodRenamedFrom();
void methodRenamedFrom(byte argument);
readonly attribute byte attributeGetterRenamedFrom;
attribute byte attributeRenamedFrom;
[BinaryName="otherAttributeRenamedTo"]
attribute byte otherAttributeRenamedFrom;
void passDictionary(optional Dict x);
[Cached, Pure]

View File

@ -536,9 +536,13 @@ interface TestJSImplInterface {
// binaryNames tests
void methodRenamedFrom();
[BinaryName="otherMethodRenamedTo"]
void otherMethodRenamedFrom();
void methodRenamedFrom(byte argument);
readonly attribute byte attributeGetterRenamedFrom;
attribute byte attributeRenamedFrom;
[BinaryName="otherAttributeRenamedTo"]
attribute byte otherAttributeRenamedFrom;
void passDictionary(optional Dict x);
[Cached, Pure]