Bug 1353941: Convert a MOZ_RELEASE_ASSERT() expression to "if" + MOZ_CRASH(), to work around clang 3.8 segfault. r=froydnj
MozReview-Commit-ID: Bq2DM61YvQ3
--- a/xpcom/ds/nsExpirationTracker.h
+++ b/xpcom/ds/nsExpirationTracker.h
@@ -112,19 +112,24 @@ public:
, mName(aName)
, mEventTarget(aEventTarget)
{
static_assert(K >= 2 && K <= nsExpirationState::NOT_TRACKED,
"Unsupported number of generations (must be 2 <= K <= 15)");
MOZ_ASSERT(NS_IsMainThread());
if (mEventTarget) {
bool current = false;
- MOZ_RELEASE_ASSERT(
- NS_SUCCEEDED(mEventTarget->IsOnCurrentThread(¤t)) && current,
- "Provided event target must be on the main thread");
+ // NOTE: The following check+crash could be condensed into a
+ // MOZ_RELEASE_ASSERT, but that triggers a segfault during compilation in
+ // clang 3.8. Once we don't have to care about clang 3.8 anymore, though,
+ // we can convert to MOZ_RELEASE_ASSERT here.
+ if (MOZ_UNLIKELY(NS_FAILED(mEventTarget->IsOnCurrentThread(¤t)) ||
+ !current)) {
+ MOZ_CRASH("Provided event target must be on the main thread");
+ }
}
mObserver = new ExpirationTrackerObserver();
mObserver->Init(this);
}
virtual ~ExpirationTrackerImpl()
{
MOZ_ASSERT(NS_IsMainThread());