Bug 856841. Don't pass in an implicit JSContext based on argument or return value types for JS-implemented interfaces. r=mccr8

This commit is contained in:
Boris Zbarsky 2013-04-03 22:22:16 -04:00
parent d1d7bbfca7
commit 0bbbeb9739
2 changed files with 15 additions and 9 deletions

View File

@ -3921,8 +3921,9 @@ if (global.Failed()) {
""" % globalObjectType)) """ % globalObjectType))
argsPre.append("global") argsPre.append("global")
needsCx = needCx(returnType, arguments, self.extendedAttributes, needsCx = (not descriptor.interface.isJSImplemented() and
descriptor) needCx(returnType, arguments, self.extendedAttributes,
descriptor))
if needsCx and not (static and descriptor.workers): if needsCx and not (static and descriptor.workers):
argsPre.append("cx") argsPre.append("cx")
@ -8005,7 +8006,8 @@ class CGJSImplMethod(CGNativeMember):
signature, signature,
descriptor.getExtendedAttributes(method), descriptor.getExtendedAttributes(method),
breakAfter=breakAfter, breakAfter=breakAfter,
variadicIsSequence=True) variadicIsSequence=True,
passCxAsNeeded=False)
self.signature = signature self.signature = signature
if isConstructor: if isConstructor:
self.body = self.getConstructorImpl() self.body = self.getConstructorImpl()
@ -8068,7 +8070,8 @@ class CGJSImplGetter(CGNativeMember):
attr), attr),
(attr.type, []), (attr.type, []),
descriptor.getExtendedAttributes(attr, descriptor.getExtendedAttributes(attr,
getter=True)) getter=True),
passCxAsNeeded=False)
self.body = self.getImpl() self.body = self.getImpl()
def getImpl(self): def getImpl(self):
@ -8083,7 +8086,8 @@ class CGJSImplSetter(CGNativeMember):
(BuiltinTypes[IDLBuiltinType.Types.void], (BuiltinTypes[IDLBuiltinType.Types.void],
[FakeArgument(attr.type, attr)]), [FakeArgument(attr.type, attr)]),
descriptor.getExtendedAttributes(attr, descriptor.getExtendedAttributes(attr,
setter=True)) setter=True),
passCxAsNeeded=False)
self.body = self.getImpl() self.body = self.getImpl()
def getImpl(self): def getImpl(self):

View File

@ -311,22 +311,24 @@ interface TestJSImplInterface {
//void passOptionalNullableTreatAsNullCallback(optional TestTreatAsNullCallback? arg); //void passOptionalNullableTreatAsNullCallback(optional TestTreatAsNullCallback? arg);
void passOptionalNullableTreatAsNullCallbackWithDefaultValue(optional TestTreatAsNullCallback? arg = null); void passOptionalNullableTreatAsNullCallbackWithDefaultValue(optional TestTreatAsNullCallback? arg = null);
/* The rest of these are untested.
// Any types // Any types
void passAny(any arg); void passAny(any arg);
void passOptionalAny(optional any arg); void passOptionalAny(optional any arg);
void passAnyDefaultNull(optional any arg = null); void passAnyDefaultNull(optional any arg = null);
any receiveAny(); any receiveAny();
// object types // object types. Unfortunately, non-nullable object is inconsistently
void passObject(object arg); // represented as either JSObject* (for callbacks) or JSObject& (for
// non-callbacks), so we can't handle those yet. See bug 856911.
//(BUG 856911) void passObject(object arg);
void passNullableObject(object? arg); void passNullableObject(object? arg);
void passOptionalObject(optional object arg); //(BUG 856911) void passOptionalObject(optional object arg);
void passOptionalNullableObject(optional object? arg); void passOptionalNullableObject(optional object? arg);
void passOptionalNullableObjectWithDefaultValue(optional object? arg = null); void passOptionalNullableObjectWithDefaultValue(optional object? arg = null);
object receiveObject(); object receiveObject();
object? receiveNullableObject(); object? receiveNullableObject();
/* The rest of these are untested.
// Union types // Union types
void passUnion((object or long) arg); void passUnion((object or long) arg);
void passUnionWithNullable((object? or long) arg); void passUnionWithNullable((object? or long) arg);