Open Bug 682609 (NS_ASSERTION_SUX) Opened 13 years ago Updated 2 months ago

[meta] Tracking bug for NS_ASSERTIONs that should be actual assertions

Categories

(Core :: General, defect, P3)

defect

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.
Alias: NS_ASSERTION_SUXX
Depends on: 682610
Depends on: 678327
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.
NS_PRECONDITION has the same problem as NS_ASSERTION.
Summary: Tracking bug for NS_ASSERTIONs that should be actual assertions → Tracking bug for NS_ASSERTIONs that should be actual assertions (also NS_PRECONDITION)
Depends on: 682614
Depends on: 677273
Alias: NS_ASSERTION_SUXX → NS_ASSERTION_SUX
Depends on: 686398
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.
Depends on: 478135, 749326
Keywords: meta
OS: Linux → All
Priority: -- → P3
Hardware: x86_64 → All
See Also: → 1457813
Summary: Tracking bug for NS_ASSERTIONs that should be actual assertions (also NS_PRECONDITION) → Tracking bug for NS_ASSERTIONs that should be actual assertions

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?

Summary: Tracking bug for NS_ASSERTIONs that should be actual assertions → [meta] Tracking bug for NS_ASSERTIONs that should be actual assertions

(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 by MOZ_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.

Severity: normal → S3
Attachment #9385992 - Attachment is obsolete: true
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: