[meta] Tracking bug for NS_ASSERTIONs that should be actual assertions
Categories
(Core :: General, defect, P3)
Tracking
()
People
(Reporter: bjacob, Unassigned)
References
(Depends on 2 open bugs)
Details
(Keywords: meta)
Attachments
(1 obsolete file)
Our codebase is plagued by the NS_ASSERTION macro whose name wrongly suggests that it's an assertion, which it currently isn't by default (only is with XPCOM_DEBUG_BREAK set to a suitable value). As a result, we have lots of bugs that are harder than necessary to track down, because people have been relying on NS_ASSERTION for stuff that should have been fatal. Lately there's been discussion on dev-platform about that, and I don't know what the conclusions were; the present bug will serve as a tracking bug for all the places where NS_ASSERTION is used where a real assert is needed.
Reporter | ||
Updated•13 years ago
|
Reporter | ||
Comment 1•13 years ago
|
||
David: bug 678327 comment 5 says that you are working on resolving this general issue. Is there a bug filed for that? The present bug is only a tracking bug for places where NS_ASSERTION is used and its current default behavior is unsuitable.
Reporter | ||
Comment 2•13 years ago
|
||
NS_PRECONDITION has the same problem as NS_ASSERTION.
Reporter | ||
Updated•13 years ago
|
Comment 3•6 years ago
|
||
Bug 1457813 will replace 1436 non-asserting NS_PRECONDITIONs with MOZ_ASSERT and two asserting NS_PRECONDITIONs with NS_ASSERTIONS: bug 478135 and bug 749326.
Comment 4•4 years ago
|
||
This was raised again in https://phabricator.services.mozilla.com/D69858#inline-414015. Am I understanding right that an NS_ASSERTION
should be replaced by MOZ_ASSERT
unless doing so causes a crash?
Updated•4 years ago
|
Comment 5•4 years ago
|
||
(In reply to Kagami :saschanaz from comment #4)
This was raised again in https://phabricator.services.mozilla.com/D69858#inline-414015. Am I understanding right that an
NS_ASSERTION
should be replaced byMOZ_ASSERT
unless doing so causes a crash?
New code should prefer MOZ_ASSERT
over NS_ASSERTION
.
MOZ_ASSERT
will abort in debug builds so we can find and fix assertion failures hit during automated tests. NS_ASSERTION
will just print a warning which is easy to miss. Some of our test runners will detect NS_ASSERTION
warnings and treat them as test failures, but I don't know if all the test runners do.
Updated•2 years ago
|
Comment hidden (spam) |
Updated•2 months ago
|
Description
•