Bug 1441205 - XPTMethodDescriptor::result is unused. r=njn draft
authorAndrew McCreight <continuation@gmail.com>
Mon, 26 Feb 2018 08:49:19 -0800
changeset 759828 4ee93db26e075b4a641f40f1abcd4bceffade098
parent 758791 f7c5598e45c323547dc6d030bf8442850c15813b
child 759829 a30c0eaa9402df71d2b7105094c3918e36931182
push id100477
push userbmo:continuation@gmail.com
push dateMon, 26 Feb 2018 17:26:39 +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