mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1152902 part 1. Add a way to flag a method in webidl as being identity-testable, so we'll expose such an identity test from bindings to other C++ code. r=peterv
This commit is contained in:
parent
91607f83e6
commit
a9824af70a
@ -8604,6 +8604,26 @@ class CGStaticMethodJitinfo(CGGeneric):
|
||||
IDLToCIdentifier(method.identifier.name))))
|
||||
|
||||
|
||||
class CGMethodIdentityTest(CGAbstractMethod):
|
||||
"""
|
||||
A class to generate a method-identity test for a given IDL operation.
|
||||
"""
|
||||
def __init__(self, descriptor, method):
|
||||
self.method = method
|
||||
name = "Is%sMethod" % MakeNativeName(method.identifier.name)
|
||||
CGAbstractMethod.__init__(self, descriptor, name, 'bool',
|
||||
[Argument('JS::Handle<JSObject*>', 'aObj')])
|
||||
|
||||
def definition_body(self):
|
||||
return dedent(
|
||||
"""
|
||||
MOZ_ASSERT(aObj);
|
||||
return js::IsFunctionObject(aObj) &&
|
||||
js::FunctionObjectIsNative(aObj) &&
|
||||
FUNCTION_VALUE_TO_JITINFO(JS::ObjectValue(*aObj)) == &%s_methodinfo;
|
||||
""" % IDLToCIdentifier(self.method.identifier.name))
|
||||
|
||||
|
||||
def getEnumValueName(value):
|
||||
# Some enum values can be empty strings. Others might have weird
|
||||
# characters in them. Deal with the former by returning "_empty",
|
||||
@ -11200,6 +11220,8 @@ class CGDescriptor(CGThing):
|
||||
cgThings.append(CGMemberJITInfo(descriptor, m))
|
||||
if props.isCrossOriginMethod:
|
||||
crossOriginMethods.add(m.identifier.name)
|
||||
if m.getExtendedAttribute("MethodIdentityTestable"):
|
||||
cgThings.append(CGMethodIdentityTest(descriptor, m))
|
||||
elif m.isAttr():
|
||||
if m.stringifier:
|
||||
raise TypeError("Stringifier attributes not supported yet. "
|
||||
|
@ -4163,7 +4163,8 @@ class IDLMethod(IDLInterfaceMember, IDLScope):
|
||||
identifier == "Func" or
|
||||
identifier == "AvailableIn" or
|
||||
identifier == "CheckPermissions" or
|
||||
identifier == "BinaryName"):
|
||||
identifier == "BinaryName" or
|
||||
identifier == "MethodIdentityTestable"):
|
||||
# Known attributes that we don't need to do anything with here
|
||||
pass
|
||||
else:
|
||||
|
Loading…
Reference in New Issue
Block a user