Bug 1307142 - correlate MOZ_ASSERT_IF with logic from IsConvertibleToDictionary. r=peterv
authorAndi-Bogdan Postelnicu <bpostelnicu@mozilla.com>
Mon, 03 Oct 2016 18:40:36 +0300
changeset 325530 534bd8b7b6d62b190a7c5725807a81c6f1950012
parent 325529 bacf701ce65c1062fa41cf537a7e8daebcf31767
child 325531 14af02e8f075e70020f149f81cc40bd6f664253a
push id24
push usermaklebus@msu.edu
push dateTue, 20 Dec 2016 03:11:33 +0000
reviewerspeterv
bugs1307142
milestone53.0a1
Bug 1307142 - correlate MOZ_ASSERT_IF with logic from IsConvertibleToDictionary. r=peterv MozReview-Commit-ID: 9cPblJOOf8U
dom/bindings/Codegen.py
--- a/dom/bindings/Codegen.py
+++ b/dom/bindings/Codegen.py
@@ -12552,17 +12552,19 @@ class CGDictionary(CGThing):
         we can avoid atomizing strings all the time, then we just spit
         out the getMemberConversion() output for each member,
         separated by newlines.
 
         """
         body = dedent("""
             // Passing a null JSContext is OK only if we're initing from null,
             // Since in that case we will not have to do any property gets
-            MOZ_ASSERT_IF(!cx, val.isNull());
+            // Also evaluate isNullOrUndefined in order to avoid false-positive
+            // checkers by static analysis tools
+            MOZ_ASSERT_IF(!cx, val.isNull() && val.isNullOrUndefined());
             """)
 
         if self.needToInitIds:
             body += fill(
                 """
                 ${dictName}Atoms* atomsCache = nullptr;
                 if (cx) {
                   atomsCache = GetAtomCache<${dictName}Atoms>(cx);