Bug 1532599 - Force expected crashes on unexpected magic values. a=RyanVM
authorNicolas B. Pierron <nicolas.b.pierron@nbp.name>
Fri, 08 Mar 2019 10:34:48 +0100
changeset 450978 0da96d1212e3281e518b7540d3122871a29e07bf
parent 450977 e04b9507d08639f5537ab9db90e22d220eadd52d
child 450979 05cf99a95206ec1e43e408b3ae0a78e5b5b03372
push id359
push userarchaeopteryx@coole-files.de
push dateFri, 08 Mar 2019 11:58:31 +0000
treeherdermozilla-esr60@05cf99a95206 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersRyanVM
bugs1532599
milestone60.5.3
Bug 1532599 - Force expected crashes on unexpected magic values. a=RyanVM Differential Revision: https://phabricator.services.mozilla.com/D22477
js/public/Value.h
--- a/js/public/Value.h
+++ b/js/public/Value.h
@@ -579,18 +579,21 @@ class MOZ_NON_PARAM alignas(8) Value {
   bool isFalse() const {
     return data.asBits ==
            bitsFromTagAndPayload(JSVAL_TAG_BOOLEAN, uint32_t(false));
   }
 
   bool isMagic() const { return toTag() == JSVAL_TAG_MAGIC; }
 
   bool isMagic(JSWhyMagic why) const {
-    MOZ_ASSERT_IF(isMagic(), data.s.payload.why == why);
-    return isMagic();
+    if (!isMagic()) {
+      return false;
+    }
+    MOZ_RELEASE_ASSERT(data.s.payload.why == why);
+    return true;
   }
 
   JS::TraceKind traceKind() const {
     MOZ_ASSERT(isGCThing());
     static_assert((JSVAL_TAG_STRING & 0x03) == size_t(JS::TraceKind::String),
                   "Value type tags must correspond with JS::TraceKinds.");
     static_assert((JSVAL_TAG_SYMBOL & 0x03) == size_t(JS::TraceKind::Symbol),
                   "Value type tags must correspond with JS::TraceKinds.");