Bug 1289064 - eliminate null check on |iid| in XPCConvert::NativeInterface2JSObject. r?bholley draft
authorAndi-Bogdan Postelnicu <bpostelnicu@mozilla.com>
Mon, 25 Jul 2016 13:13:19 +0300
changeset 392295 ce291ea36c63ba6702bbbe56b1ca2f2430a99ee3
parent 390029 d224fc999cb6accb208af0a105f14433375e2e77
child 526308 fc5e9263c54b7ef99365a45595109ede0af9f17f
push id23998
push userbmo:bpostelnicu@mozilla.com
push dateMon, 25 Jul 2016 10:14:42 +0000
reviewersbholley
bugs1289064
milestone50.0a1
Bug 1289064 - eliminate null check on |iid| in XPCConvert::NativeInterface2JSObject. r?bholley MozReview-Commit-ID: EtiVWiHlYx5
js/xpconnect/src/XPCConvert.cpp
--- a/js/xpconnect/src/XPCConvert.cpp
+++ b/js/xpconnect/src/XPCConvert.cpp
@@ -818,28 +818,26 @@ XPCConvert::NativeInterface2JSObject(Mut
         if (!JS_WrapObject(cx, &cpow))
             return false;
         d.setObject(*cpow);
         return true;
     }
 
     // Go ahead and create an XPCWrappedNative for this object.
     AutoMarkingNativeInterfacePtr iface(cx);
-    if (iid) {
-        if (Interface)
-            iface = *Interface;
+    if (Interface)
+        iface = *Interface;
 
-        if (!iface) {
-            iface = XPCNativeInterface::GetNewOrUsed(iid);
-            if (!iface)
-                return false;
+    if (!iface) {
+        iface = XPCNativeInterface::GetNewOrUsed(iid);
+        if (!iface)
+            return false;
 
-            if (Interface)
-                *Interface = iface;
-        }
+        if (Interface)
+            *Interface = iface;
     }
 
     RefPtr<XPCWrappedNative> wrapper;
     nsresult rv = XPCWrappedNative::GetNewOrUsed(aHelper, xpcscope, iface,
                                                  getter_AddRefs(wrapper));
     if (NS_FAILED(rv) && pErr)
         *pErr = rv;