Bug 1441205 - XPTMethodDescriptor::result is unused. r=njn
This sounds weird, but either:
1) A method is notxpcom, so it can't be called from script and the XPT
information is unused.
2) A method is not notxpcom, in which case the result type is nsresult.
MozReview-Commit-ID: a7SRJn8PlP
--- a/xpcom/reflect/xptinfo/xptinfo.h
+++ b/xpcom/reflect/xptinfo/xptinfo.h
@@ -193,16 +193,14 @@ public:
const char* GetName() const {return name;}
uint8_t GetParamCount() const {return num_args;}
/* idx was index before I got _sick_ of the warnings on Unix, sorry jband */
const nsXPTParamInfo GetParam(uint8_t idx) const
{
NS_PRECONDITION(idx < GetParamCount(),"bad arg");
return params[idx];
}
- const nsXPTParamInfo GetResult() const
- {return result;}
private:
nsXPTMethodInfo(); // no implementation
// NO DATA - this a flyweight wrapper
};
#endif /* xptiinfo_h___ */
--- a/xpcom/typelib/xpt/xpt_struct.cpp
+++ b/xpcom/typelib/xpt/xpt_struct.cpp
@@ -311,17 +311,22 @@ DoMethodDescriptor(XPTArena *arena, NotN
return false;
}
for(i = 0; i < md->num_args; i++) {
if (!DoParamDescriptor(arena, cursor, &md->params[i], id))
return false;
}
- if (!DoParamDescriptor(arena, cursor, &md->result, id))
+ // |result| appears in the on-disk format but it isn't used,
+ // because a method is either notxpcom, in which case it can't be
+ // called from script so the XPT information is irrelevant, or the
+ // result type is nsresult.
+ XPTParamDescriptor result;
+ if (!DoParamDescriptor(arena, cursor, &result, id))
return false;
return true;
}
bool
DoParamDescriptor(XPTArena *arena, NotNull<XPTCursor*> cursor,
XPTParamDescriptor *pd, XPTInterfaceDescriptor *id)
--- a/xpcom/typelib/xpt/xpt_struct.h
+++ b/xpcom/typelib/xpt/xpt_struct.h
@@ -281,17 +281,17 @@ struct XPTParamDescriptor {
/*
* A MethodDescriptor is a variable-size record used to describe a single
* interface method.
*/
struct XPTMethodDescriptor {
char *name;
XPTParamDescriptor *params;
- XPTParamDescriptor result;
+ //XPTParamDescriptor result; // Present on disk, omitted here.
uint8_t flags;
uint8_t num_args;
};
/* flag bits */
#define XPT_MD_GETTER 0x80
#define XPT_MD_SETTER 0x40
#define XPT_MD_NOTXPCOM 0x20