Bug 776224 - CheckPref should always initialize its outparam; r=peterv

This commit is contained in:
Ms2ger 2012-08-04 09:44:00 +02:00
Родитель 86de6cd109
Коммит 917dc99198
1 изменённых файлов: 7 добавлений и 4 удалений

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

@ -1213,24 +1213,27 @@ def CheckPref(descriptor, globalName, varName, retval, wrapperCache = None):
""" """
if not descriptor.prefable: if not descriptor.prefable:
return "" return ""
if wrapperCache: if wrapperCache:
wrapperCache = " %s->ClearIsDOMBinding();\n" % (wrapperCache) wrapperCache = " %s->ClearIsDOMBinding();\n" % (wrapperCache)
else: else:
wrapperCache = "" wrapperCache = ""
failureCode = (" %s = false;\n" +
" return %s;") % (varName, retval)
return """ return """
{ {
XPCWrappedNativeScope* scope = XPCWrappedNativeScope* scope =
XPCWrappedNativeScope::FindInJSObjectScope(aCx, %s); XPCWrappedNativeScope::FindInJSObjectScope(aCx, %s);
if (!scope) { if (!scope) {
return %s; %s
} }
if (!scope->ExperimentalBindingsEnabled()) { if (!scope->ExperimentalBindingsEnabled()) {
%s %s = false; %s%s
return %s;
} }
} }
""" % (globalName, retval, wrapperCache, varName, retval) """ % (globalName, failureCode, wrapperCache, failureCode)
class CGDefineDOMInterfaceMethod(CGAbstractMethod): class CGDefineDOMInterfaceMethod(CGAbstractMethod):
""" """