Bug 864727 part 7. Make the WebIDL binding Wrap methods take a handle for the scope object and use a Rooted for the parent. r=ms2ger

This commit is contained in:
Boris Zbarsky 2013-04-25 12:29:55 -04:00
Родитель c62295c2f9
Коммит 1f2af992c7
1 изменённых файлов: 8 добавлений и 5 удалений

Просмотреть файл

@ -2023,7 +2023,8 @@ class CGWrapWithCacheMethod(CGAbstractMethod):
"""
def __init__(self, descriptor, properties):
assert descriptor.interface.hasInterfacePrototypeObject()
args = [Argument('JSContext*', 'aCx'), Argument('JSObject*', 'aScopeArg'),
args = [Argument('JSContext*', 'aCx'),
Argument('JS::Handle<JSObject*>', 'aScope'),
Argument(descriptor.nativeType + '*', 'aObject'),
Argument('nsWrapperCache*', 'aCache')]
CGAbstractMethod.__init__(self, descriptor, 'Wrap', 'JSObject*', args)
@ -2041,8 +2042,8 @@ class CGWrapWithCacheMethod(CGAbstractMethod):
assertISupportsInheritance = ""
return """%s
%s
JS::Rooted<JSObject*> aScope(aCx, aScopeArg); // Temporary!
JSObject* parent = WrapNativeParent(aCx, aScope, aObject->GetParentObject());
JS::Rooted<JSObject*> parent(aCx,
WrapNativeParent(aCx, aScope, aObject->GetParentObject()));
if (!parent) {
return NULL;
}
@ -2077,7 +2078,8 @@ class CGWrapMethod(CGAbstractMethod):
def __init__(self, descriptor):
# XXX can we wrap if we don't have an interface prototype object?
assert descriptor.interface.hasInterfacePrototypeObject()
args = [Argument('JSContext*', 'aCx'), Argument('JSObject*', 'aScope'),
args = [Argument('JSContext*', 'aCx'),
Argument('JS::Handle<JSObject*>', 'aScope'),
Argument('T*', 'aObject')]
CGAbstractMethod.__init__(self, descriptor, 'Wrap', 'JSObject*', args, inline=True, templateArgs=["class T"])
@ -2094,7 +2096,8 @@ class CGWrapNonWrapperCacheMethod(CGAbstractMethod):
def __init__(self, descriptor, properties):
# XXX can we wrap if we don't have an interface prototype object?
assert descriptor.interface.hasInterfacePrototypeObject()
args = [Argument('JSContext*', 'aCx'), Argument('JSObject*', 'aScope'),
args = [Argument('JSContext*', 'aCx'),
Argument('JS::Handle<JSObject*>', 'aScope'),
Argument(descriptor.nativeType + '*', 'aObject')]
if descriptor.nativeOwnership == 'owned':
args.append(Argument('bool*', 'aTookOwnership'))