зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1708580: When the "quit-application" event fires in GeckoView, annotate the GeckoThread.State and force crash on nightly and early beta; r=agi
AFAICT, all roads lead though [`nsAppStartup::Quit`](https://searchfox.org/mozilla-central/rev/0fec57c05d3996cc00c55a66f20dd5793a9bfb5d/toolkit/components/startup/nsAppStartup.cpp#448), which is responsible for firing the `"quit-application"` observer notification and then posting the `nsAppExitEvent` that causes the `nsAppShell` to break out of its event loop and proceed with shutdown. If we trigger a native crash in the observer, we should be able to capture a symbolicated stack of whatever called `Quit`. We might as well force-crash anyway, since AC is going to throw an exception regardless... Before we crash, we annotate the current `GeckoThread` state to enable us to find out whether we were fully initialized at the time of the shutdown. Differential Revision: https://phabricator.services.mozilla.com/D122256
This commit is contained in:
Родитель
03d4b849e3
Коммит
d8a5c41db0
|
@ -587,6 +587,11 @@ public class GeckoThread extends Thread {
|
|||
return isStateAtLeast(minState) && isStateAtMost(maxState);
|
||||
}
|
||||
|
||||
@WrapForJNI(calledFrom = "gecko")
|
||||
private static int getStateOrdinal() {
|
||||
return ((State)sNativeQueue.getState()).ordinal();
|
||||
}
|
||||
|
||||
@WrapForJNI(calledFrom = "gecko")
|
||||
private static void setState(final State newState) {
|
||||
checkAndSetState(null, newState);
|
||||
|
|
|
@ -298,6 +298,11 @@ ExperimentalFeatures:
|
|||
type: string
|
||||
ping: true
|
||||
|
||||
GeckoViewThreadState:
|
||||
description: >
|
||||
The zero-based ordinal of the GeckoThread.State at the time of the crash.
|
||||
type: integer
|
||||
|
||||
GetHGlobalFromStreamFailure:
|
||||
description: >
|
||||
Error returned when invoking GetHGlobalFromStreamFailure() during the
|
||||
|
|
|
@ -541,6 +541,17 @@ nsAppShell::Observe(nsISupports* aSubject, const char* aTopic,
|
|||
}
|
||||
} else if (!strcmp(aTopic, "quit-application")) {
|
||||
if (jni::IsAvailable()) {
|
||||
#if defined(EARLY_BETA_OR_EARLIER)
|
||||
const int curGeckoThreadState = java::GeckoThread::GetStateOrdinal();
|
||||
CrashReporter::AnnotateCrashReport(
|
||||
CrashReporter::Annotation::GeckoViewThreadState, curGeckoThreadState);
|
||||
|
||||
const char* isInAutomation = PR_GetEnv("MOZ_IN_AUTOMATION");
|
||||
if (!isInAutomation || !(*isInAutomation)) {
|
||||
MOZ_CRASH("Something triggered the \"quit-application\" notification!");
|
||||
}
|
||||
#endif // defined(EARLY_BETA_OR_EARLIER)
|
||||
|
||||
const bool restarting = aData && u"restart"_ns.Equals(aData);
|
||||
java::GeckoThread::SetState(restarting
|
||||
? java::GeckoThread::State::RESTARTING()
|
||||
|
|
Загрузка…
Ссылка в новой задаче