From 0bbbeb97398531b64f688f3e202c01f5f46be646 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Wed, 3 Apr 2013 22:22:16 -0400 Subject: [PATCH] Bug 856841. Don't pass in an implicit JSContext based on argument or return value types for JS-implemented interfaces. r=mccr8 --- dom/bindings/Codegen.py | 14 +++++++++----- dom/bindings/test/TestJSImplGen.webidl | 10 ++++++---- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/dom/bindings/Codegen.py b/dom/bindings/Codegen.py index 74a52fd065d..b7e1b339241 100644 --- a/dom/bindings/Codegen.py +++ b/dom/bindings/Codegen.py @@ -3921,8 +3921,9 @@ if (global.Failed()) { """ % globalObjectType)) argsPre.append("global") - needsCx = needCx(returnType, arguments, self.extendedAttributes, - descriptor) + needsCx = (not descriptor.interface.isJSImplemented() and + needCx(returnType, arguments, self.extendedAttributes, + descriptor)) if needsCx and not (static and descriptor.workers): argsPre.append("cx") @@ -8005,7 +8006,8 @@ class CGJSImplMethod(CGNativeMember): signature, descriptor.getExtendedAttributes(method), breakAfter=breakAfter, - variadicIsSequence=True) + variadicIsSequence=True, + passCxAsNeeded=False) self.signature = signature if isConstructor: self.body = self.getConstructorImpl() @@ -8068,7 +8070,8 @@ class CGJSImplGetter(CGNativeMember): attr), (attr.type, []), descriptor.getExtendedAttributes(attr, - getter=True)) + getter=True), + passCxAsNeeded=False) self.body = self.getImpl() def getImpl(self): @@ -8083,7 +8086,8 @@ class CGJSImplSetter(CGNativeMember): (BuiltinTypes[IDLBuiltinType.Types.void], [FakeArgument(attr.type, attr)]), descriptor.getExtendedAttributes(attr, - setter=True)) + setter=True), + passCxAsNeeded=False) self.body = self.getImpl() def getImpl(self): diff --git a/dom/bindings/test/TestJSImplGen.webidl b/dom/bindings/test/TestJSImplGen.webidl index 42edf973abd..977b9016b7c 100644 --- a/dom/bindings/test/TestJSImplGen.webidl +++ b/dom/bindings/test/TestJSImplGen.webidl @@ -311,22 +311,24 @@ interface TestJSImplInterface { //void passOptionalNullableTreatAsNullCallback(optional TestTreatAsNullCallback? arg); void passOptionalNullableTreatAsNullCallbackWithDefaultValue(optional TestTreatAsNullCallback? arg = null); -/* The rest of these are untested. // Any types void passAny(any arg); void passOptionalAny(optional any arg); void passAnyDefaultNull(optional any arg = null); any receiveAny(); - // object types - void passObject(object arg); + // object types. Unfortunately, non-nullable object is inconsistently + // 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 passOptionalObject(optional object arg); + //(BUG 856911) void passOptionalObject(optional object arg); void passOptionalNullableObject(optional object? arg); void passOptionalNullableObjectWithDefaultValue(optional object? arg = null); object receiveObject(); object? receiveNullableObject(); +/* The rest of these are untested. // Union types void passUnion((object or long) arg); void passUnionWithNullable((object? or long) arg);