зеркало из https://github.com/mozilla/pjs.git
Part 12 of fix for bug 560273 (Stop using DOM tearoffs from quickstubs) - switch default 'canFail' value for custom QS from False to True and allow missing 'code'. r=jst.
--HG-- extra : rebase_source : d5d5cd5c863856176b77a82309bb9a029d84b224
This commit is contained in:
Родитель
90c8898e77
Коммит
d2a54600b6
|
@ -547,7 +547,7 @@ nsIDOMHTMLDocument_Write_customMethodCallCode = """
|
|||
"""
|
||||
|
||||
nsIDOMStorage_Clear_customMethodCallCode = """
|
||||
nsresult rv = self->Clear();
|
||||
rv = self->Clear();
|
||||
if (NS_SUCCEEDED(rv))
|
||||
JS_ClearScope(cx, obj);
|
||||
"""
|
||||
|
@ -575,32 +575,37 @@ CUSTOM_QS_TN = {
|
|||
customMethodCalls = {
|
||||
'nsIDOMNode_GetNextSibling': {
|
||||
'thisType': 'nsINode',
|
||||
'code': ' nsINode *result = self->GetSibling(1);'
|
||||
'code': ' nsINode *result = self->GetSibling(1);',
|
||||
'canFail': False
|
||||
},
|
||||
'nsIDOMNode_GetFirstChild': {
|
||||
'thisType': 'nsINode',
|
||||
'code': ' nsINode *result = self->GetChildAt(0);'
|
||||
'code': ' nsINode *result = self->GetChildAt(0);',
|
||||
'canFail': False
|
||||
},
|
||||
'nsIDOMNode_GetChildNodes': {
|
||||
'thisType': 'nsINode',
|
||||
'code': nsIDOMNode_GetChildNodes_customMethodCallCode,
|
||||
'canFail': True
|
||||
'code': nsIDOMNode_GetChildNodes_customMethodCallCode
|
||||
},
|
||||
'nsIDOMNode_GetPreviousSibling': {
|
||||
'thisType': 'nsINode',
|
||||
'code': ' nsINode *result = self->GetSibling(-1);'
|
||||
'code': ' nsINode *result = self->GetSibling(-1);',
|
||||
'canFail': False
|
||||
},
|
||||
'nsIDOMNode_GetLastChild': {
|
||||
'thisType': 'nsINode',
|
||||
'code': ' nsINode *result = self->GetLastChild();'
|
||||
'code': ' nsINode *result = self->GetLastChild();',
|
||||
'canFail': False
|
||||
},
|
||||
'nsIDOMNode_GetOwnerDocument': {
|
||||
'thisType': 'nsINode',
|
||||
'code': ' nsIDocument *result = self->GetOwnerDocument();'
|
||||
'code': ' nsIDocument *result = self->GetOwnerDocument();',
|
||||
'canFail': False
|
||||
},
|
||||
'nsIDOMNode_GetParentNode': {
|
||||
'thisType': 'nsINode',
|
||||
'code': ' nsINode *result = self->GetNodeParent();'
|
||||
'code': ' nsINode *result = self->GetNodeParent();',
|
||||
'canFail': False
|
||||
},
|
||||
'nsIDOMNode_InsertBefore': {
|
||||
'thisType': 'nsINode',
|
||||
|
@ -608,8 +613,7 @@ customMethodCalls = {
|
|||
'arg1Type': 'nsINode',
|
||||
'code': ' nsINode *result = self->InsertBefore(arg0, arg1, &rv);\n'
|
||||
' if(NS_FAILED(rv))\n'
|
||||
' result = nsnull;',
|
||||
'canFail': True
|
||||
' result = nsnull;'
|
||||
},
|
||||
'nsIDOMNode_ReplaceChild': {
|
||||
'thisType': 'nsINode',
|
||||
|
@ -617,35 +621,31 @@ customMethodCalls = {
|
|||
'arg1Type': 'nsINode',
|
||||
'code': ' nsINode *result = self->ReplaceChild(arg0, arg1, &rv);\n'
|
||||
' if(NS_FAILED(rv))\n'
|
||||
' result = nsnull;',
|
||||
'canFail': True
|
||||
' result = nsnull;'
|
||||
},
|
||||
'nsIDOMNode_RemoveChild': {
|
||||
'thisType': 'nsINode',
|
||||
'arg0Type': 'nsINode',
|
||||
'code': ' rv = self->RemoveChild(arg0);\n'
|
||||
' nsINode *result = NS_SUCCEEDED(rv) ? arg0 : nsnull;',
|
||||
'canFail': True
|
||||
' nsINode *result = NS_SUCCEEDED(rv) ? arg0 : nsnull;'
|
||||
},
|
||||
'nsIDOMNode_AppendChild': {
|
||||
'thisType': 'nsINode',
|
||||
'arg0Type': 'nsINode',
|
||||
'code': ' nsINode *result = self->AppendChild(arg0, &rv);\n'
|
||||
' if(NS_FAILED(rv))\n'
|
||||
' result = nsnull;',
|
||||
'canFail': True
|
||||
' result = nsnull;'
|
||||
},
|
||||
'nsIDOMNodeList_Item': {
|
||||
'thisType': 'nsINodeList',
|
||||
'code': ' nsINode *result = self->GetNodeAt(arg0);'
|
||||
'code': ' nsINode *result = self->GetNodeAt(arg0);',
|
||||
'canFail': False
|
||||
},
|
||||
'nsIDOMHTMLDocument_Write': {
|
||||
'code': nsIDOMHTMLDocument_Write_customMethodCallCode % 'Write',
|
||||
'canFail': True
|
||||
'code': nsIDOMHTMLDocument_Write_customMethodCallCode % 'Write'
|
||||
},
|
||||
'nsIDOMHTMLDocument_Writeln': {
|
||||
'code': nsIDOMHTMLDocument_Write_customMethodCallCode % 'Writeln',
|
||||
'canFail': True
|
||||
'code': nsIDOMHTMLDocument_Write_customMethodCallCode % 'Writeln'
|
||||
},
|
||||
'nsIDOMStorage_Clear': {
|
||||
'code': nsIDOMStorage_Clear_customMethodCallCode
|
||||
|
|
|
@ -782,9 +782,11 @@ def writeQuickStub(f, customMethodCalls, member, stubName, isSetter=False):
|
|||
else:
|
||||
code = customMethodCall['setter_code']
|
||||
stubName = templateName
|
||||
else:
|
||||
code = None
|
||||
else:
|
||||
callTemplate = ""
|
||||
code = customMethodCall['code']
|
||||
code = customMethodCall.get('code', None)
|
||||
|
||||
# Function prolog.
|
||||
|
||||
|
@ -888,16 +890,17 @@ def writeQuickStub(f, customMethodCalls, member, stubName, isSetter=False):
|
|||
nullBehavior=member.null,
|
||||
undefinedBehavior=member.undefined)
|
||||
|
||||
canFail = customMethodCall is None or customMethodCall.get('canFail', False)
|
||||
canFail = customMethodCall is None or customMethodCall.get('canFail', True)
|
||||
if canFail and not rvdeclared:
|
||||
f.write(" nsresult rv;\n")
|
||||
rvdeclared = True
|
||||
|
||||
if customMethodCall is not None:
|
||||
if code is not None:
|
||||
f.write("%s\n" % code)
|
||||
|
||||
if customMethodCall is None or (isGetter and callTemplate is ""):
|
||||
if customMethodCall is not None:
|
||||
if code is None or (isGetter and callTemplate is ""):
|
||||
debugGetter = code is not None
|
||||
if debugGetter:
|
||||
f.write("#ifdef DEBUG\n")
|
||||
f.write(" nsresult debug_rv;\n")
|
||||
f.write(" nsCOMPtr<%s> debug_self = do_QueryInterface(self);\n"
|
||||
|
@ -930,10 +933,12 @@ def writeQuickStub(f, customMethodCalls, member, stubName, isSetter=False):
|
|||
else:
|
||||
args = "arg0"
|
||||
|
||||
f.write(" %s = %s->%s(%s);\n"
|
||||
% (nsresultname, selfname, comName, args))
|
||||
f.write(" ")
|
||||
if canFail or debugGetter:
|
||||
f.write("%s = " % nsresultname)
|
||||
f.write("%s->%s(%s);\n" % (selfname, comName, args))
|
||||
|
||||
if customMethodCall is not None:
|
||||
if debugGetter:
|
||||
checkSuccess = "NS_SUCCEEDED(debug_rv)"
|
||||
if canFail:
|
||||
checkSuccess += " == NS_SUCCEEDED(rv)"
|
||||
|
@ -1275,12 +1280,14 @@ def writeTraceableQuickStub(f, customMethodCalls, member, stubName):
|
|||
rvdeclared)
|
||||
argNames.append(argName)
|
||||
|
||||
if customMethodCall is not None:
|
||||
canFail = customMethodCall is None or customMethodCall.get('canFail', True)
|
||||
if canFail and not rvdeclared:
|
||||
f.write(" nsresult rv;\n")
|
||||
rvdeclared = True
|
||||
|
||||
if customMethodCall is not None and 'code' in customMethodCall:
|
||||
f.write("%s\n" % customMethodCall['code'])
|
||||
else:
|
||||
if not rvdeclared:
|
||||
f.write(" nsresult rv;\n")
|
||||
rvdeclared = True
|
||||
prefix = ''
|
||||
|
||||
resultname = prefix + 'result'
|
||||
|
@ -1296,9 +1303,12 @@ def writeTraceableQuickStub(f, customMethodCalls, member, stubName):
|
|||
argNames.append(outParamForm(resultname, member.realtype))
|
||||
args = ', '.join(argNames)
|
||||
|
||||
f.write(" %s = %s->%s(%s);\n"
|
||||
% (nsresultname, selfname, comName, args))
|
||||
f.write(" ")
|
||||
if canFail:
|
||||
f.write("%s = " % nsresultname)
|
||||
f.write("%s->%s(%s);\n" % (selfname, comName, args))
|
||||
|
||||
if canFail:
|
||||
# Check for errors.
|
||||
f.write(" if (NS_FAILED(rv)) {\n")
|
||||
if haveCcx:
|
||||
|
|
Загрузка…
Ссылка в новой задаче