Bug 816842. Clean up jsval return values in quickstubs a bit. r=bholley

This commit is contained in:
Boris Zbarsky 2012-12-06 15:21:18 -05:00
parent b3142f98f8
commit f6e486d716

View File

@ -590,7 +590,8 @@ def writeResultDecl(f, type, varname):
f.write(" nsString %s;\n" % varname)
return
elif name == '[jsval]':
return # nothing to declare; see special case in outParamForm
f.write(" jsval %s;\n" % varname)
return
elif t.kind in ('interface', 'forward'):
f.write(" nsCOMPtr<%s> %s;\n" % (type.name, varname))
return
@ -600,15 +601,11 @@ def writeResultDecl(f, type, varname):
def outParamForm(name, type):
type = unaliasType(type)
# If we start allowing [jsval] return types here, we need to tack
# the return value onto the arguments list in the callers,
# possibly, and handle properly returning it too. See bug 604198.
assert getBuiltinOrNativeTypeName(type) is not '[jsval]'
if type.kind == 'builtin':
return '&' + name
elif type.kind == 'native':
if getBuiltinOrNativeTypeName(type) == '[jsval]':
return 'vp'
return '&' + name
elif type.modifier == 'ref':
return name
else:
@ -667,9 +664,8 @@ resultConvTemplates = {
" return xpc::StringToJsval(cx, result, ${jsvalPtr});\n",
'[jsval]':
# Here there's nothing to convert, because the result has already been
# written directly to *rv. See the special case in outParamForm.
" return JS_TRUE;\n"
" ${jsvalRef} = result;\n"
" return JS_WrapValue(cx, ${jsvalPtr});\n"
}
def isVariantType(t):