Bug 1727842: Do not crash if off the main thread. r=freddyb

Differential Revision: https://phabricator.services.mozilla.com/D123866
This commit is contained in:
Tom Ritter 2021-08-30 14:13:35 +00:00
Родитель 97c7517b35
Коммит d58ff28a67
1 изменённых файлов: 7 добавлений и 0 удалений

Просмотреть файл

@ -477,6 +477,13 @@ void PossiblyCrash(const char* aPrefSuffix, const char* aUnsafeCrashString,
// pref-writing works.
return;
}
if (!NS_IsMainThread()) {
// Setting a pref off the main thread causes ContentParent to observe the
// pref set, resulting in a Release Assertion when it tries to update the
// child off main thread. So don't do any of this off main thread. (Which
// is a bit of a blind spot for this purpose...)
return;
}
nsCString previous_crashes("security.crash_tracking.");
previous_crashes.Append(aPrefSuffix);