зеркало из https://github.com/mozilla/gecko-dev.git
Fix for bug 759278 (Support binarynames for attributes too in new DOM bindings). r=bz.
--HG-- extra : rebase_source : 352a4d33db77dd80915700db335799bb8c19ac72
This commit is contained in:
Родитель
61427b43eb
Коммит
1b4c59974f
|
@ -29,6 +29,11 @@
|
|||
# * notflattened - The native type does not have nsIClassInfo, so when
|
||||
# wrapping it the right IID needs to be passed in.
|
||||
# * 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.
|
||||
#
|
||||
# The following fields are either a string, an array (defaults to an empty
|
||||
# array) or a dictionary with three possible keys (all, getterOnly and
|
||||
|
@ -250,7 +255,10 @@ DOMInterfaces = {
|
|||
'receiveWeakCastableObjectSequence',
|
||||
'receiveWeakNullableCastableObjectSequence',
|
||||
'receiveWeakCastableObjectNullableSequence',
|
||||
'receiveWeakNullableCastableObjectNullableSequence' ]
|
||||
'receiveWeakNullableCastableObjectNullableSequence' ],
|
||||
'binaryNames': { 'methodRenamedFrom': 'methodRenamedTo',
|
||||
'attributeGetterRenamedFrom': 'attributeGetterRenamedTo',
|
||||
'attributeRenamedFrom': 'attributeRenamedTo' }
|
||||
},
|
||||
|
||||
'TestNonCastableInterface' : {
|
||||
|
|
|
@ -578,8 +578,8 @@ class CGClassConstructHook(CGAbstractStaticMethod):
|
|||
"""
|
||||
preArgs = ["global"]
|
||||
|
||||
name = MakeNativeName(self._ctor.identifier.name)
|
||||
nativeName = self.descriptor.binaryNames.get(name, name)
|
||||
name = self._ctor.identifier.name
|
||||
nativeName = MakeNativeName(self.descriptor.binaryNames.get(name, name))
|
||||
callGenerator = CGMethodCall(preArgs, nativeName, True,
|
||||
self.descriptor, self._ctor)
|
||||
return preamble + callGenerator.define();
|
||||
|
@ -2703,7 +2703,7 @@ class CGNativeMethod(CGAbstractBindingMethod):
|
|||
CGAbstractBindingMethod.__init__(self, descriptor, baseName, args)
|
||||
def generate_code(self):
|
||||
name = self.method.identifier.name
|
||||
nativeName = self.descriptor.binaryNames.get(name, MakeNativeName(name))
|
||||
nativeName = MakeNativeName(self.descriptor.binaryNames.get(name, name))
|
||||
return CGMethodCall([], nativeName, self.method.isStatic(),
|
||||
self.descriptor, self.method)
|
||||
|
||||
|
@ -2729,9 +2729,9 @@ class CGNativeGetter(CGAbstractBindingMethod):
|
|||
CGGeneric("%s* self;" % self.descriptor.nativeType))
|
||||
|
||||
def generate_code(self):
|
||||
|
||||
nativeMethodName = "Get" + MakeNativeName(self.attr.identifier.name)
|
||||
return CGIndenter(CGGetterCall(self.attr.type, nativeMethodName, self.descriptor,
|
||||
name = self.attr.identifier.name
|
||||
nativeName = "Get" + MakeNativeName(self.descriptor.binaryNames.get(name, name))
|
||||
return CGIndenter(CGGetterCall(self.attr.type, nativeName, self.descriptor,
|
||||
self.attr))
|
||||
|
||||
class CGNativeSetter(CGAbstractBindingMethod):
|
||||
|
@ -2758,8 +2758,9 @@ class CGNativeSetter(CGAbstractBindingMethod):
|
|||
CGGeneric("%s* self;" % self.descriptor.nativeType))
|
||||
|
||||
def generate_code(self):
|
||||
nativeMethodName = "Set" + MakeNativeName(self.attr.identifier.name)
|
||||
return CGIndenter(CGSetterCall(self.attr.type, nativeMethodName, self.descriptor,
|
||||
name = self.attr.identifier.name
|
||||
nativeName = "Set" + MakeNativeName(self.descriptor.binaryNames.get(name, name))
|
||||
return CGIndenter(CGSetterCall(self.attr.type, nativeName, self.descriptor,
|
||||
self.attr))
|
||||
|
||||
def getEnumValueName(value):
|
||||
|
|
|
@ -267,6 +267,13 @@ public:
|
|||
JSObject* ReceiveObject(JSContext*, ErrorResult&);
|
||||
JSObject* ReceiveNullableObject(JSContext*, ErrorResult&);
|
||||
|
||||
// binaryNames tests
|
||||
void MethodRenamedTo(ErrorResult&);
|
||||
void MethodRenamedTo(int8_t, ErrorResult&);
|
||||
int8_t GetAttributeGetterRenamedTo(ErrorResult&);
|
||||
int8_t GetAttributeRenamedTo(ErrorResult&);
|
||||
void SetAttributeRenamedTo(int8_t, ErrorResult&);
|
||||
|
||||
private:
|
||||
// We add signatures here that _could_ start matching if the codegen
|
||||
// got data types wrong. That way if it ever does we'll have a call
|
||||
|
|
|
@ -211,4 +211,10 @@ interface TestInterface {
|
|||
void passOptionalNullableObjectWithDefaultValue(optional object? arg = null);
|
||||
object receiveObject();
|
||||
object? receiveNullableObject();
|
||||
|
||||
// binaryNames tests
|
||||
void methodRenamedFrom();
|
||||
void methodRenamedFrom(byte argument);
|
||||
readonly attribute byte attributeGetterRenamedFrom;
|
||||
attribute byte attributeRenamedFrom;
|
||||
};
|
||||
|
|
Загрузка…
Ссылка в новой задаче