Bug 1441205 - XPTMethodDescriptor::result is unused. r=njn
authorAndrew McCreight <continuation@gmail.com>
Mon, 26 Feb 2018 08:49:19 -0800
changeset 760287 f9658f61fbe2b6b46647f8fed78269627e60b856
parent 760286 1d5ae4b0b826feea18dfb162d5b03bfbd652f547
child 760288 0921ebb252629a328ad61a4e4b6dbf3ab922fc1b
push id100603
push userjcristau@mozilla.com
push dateTue, 27 Feb 2018 11:10:29 +0000
reviewersnjn
bugs1441205
milestone60.0a1
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
xpcom/reflect/xptinfo/xptinfo.h
xpcom/typelib/xpt/xpt_struct.cpp
xpcom/typelib/xpt/xpt_struct.h
--- 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