Bug 1301033 - add assert cx on generated code in order to prevent false-positive from static analysis tools. r?baku draft
authorAndi-Bogdan Postelnicu <bpostelnicu@mozilla.com>
Wed, 07 Sep 2016 15:32:02 +0300
changeset 411003 a48544d73a0f998131ddde8c83304050388eeaff
parent 410870 91c2b9d5c1354ca79e5b174591dbb03b32b15bbf
child 530654 98df37dc48633ac652bc0512787ef753eb2c06d2
push id28816
push userbmo:bpostelnicu@mozilla.com
push dateWed, 07 Sep 2016 12:32:58 +0000
reviewersbaku
bugs1301033
milestone51.0a1
Bug 1301033 - add assert cx on generated code in order to prevent false-positive from static analysis tools. r?baku MozReview-Commit-ID: ELTP8E3zRNf
dom/bindings/Codegen.py
--- a/dom/bindings/Codegen.py
+++ b/dom/bindings/Codegen.py
@@ -12316,16 +12316,17 @@ class CGDictionary(CGThing):
         if memberInits:
             body += fill(
                 """
                 bool isNull = val.isNullOrUndefined();
                 // We only need these if !isNull, in which case we have |cx|.
                 Maybe<JS::Rooted<JSObject *> > object;
                 Maybe<JS::Rooted<JS::Value> > temp;
                 if (!isNull) {
+                  MOZ_ASSERT(cx);
                   object.emplace(cx, &val.toObject());
                   temp.emplace(cx);
                 }
                 $*{memberInits}
                 """,
                 memberInits="\n".join(memberInits))
 
         body += "return true;\n"