Bug 1307142 - correlate MOZ_ASSERT_IF with logic from IsConvertibleToDictionary. r?peterv draft
authorAndi-Bogdan Postelnicu <bpostelnicu@mozilla.com>
Mon, 03 Oct 2016 18:40:36 +0300
changeset 448159 89a8bd5d9b319c411e3a6e7d83b5ac3d2dab377a
parent 447934 d8f63b2935af0915a6a24b3ea8e27d9a09f66416
child 539240 be753d2e46b4834420398192d4fe897e95866072
push id38288
push userbmo:bpostelnicu@mozilla.com
push dateFri, 09 Dec 2016 14:01: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
@@ -12550,17 +12550,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);