Bug 1401737 - 1. Add a diagnostic crash; r=me

Add a diagnostic crash for the unexpected case where
GeckoService.register() is called a second time. We know the stack for
the second call, but we want to know the stack for the first call, so we
introduce this intentional crash. r=me for trivial diagnostic patch
which will be backed out ASAP.

MozReview-Commit-ID: HobtPiVSSTR
This commit is contained in:
Jim Chen 2017-09-21 23:41:22 -04:00
Родитель b7cd7c515d
Коммит fc16f11c89
1 изменённых файлов: 12 добавлений и 0 удалений

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

@ -71,10 +71,22 @@ public class GeckoService extends Service {
private static final EventListener EVENT_LISTENER = new EventListener();
private static RuntimeException bug1401737Diag;
public static void register() {
if (DEBUG) {
Log.d(LOGTAG, "Registered listener");
}
// Diagnose bug 1401737. register() is unexpectedly getting called a second time.
// We know the stack for the second call, but we want to collect stack for the first call.
if (bug1401737Diag == null) {
bug1401737Diag = new IllegalStateException("Bug 1401737 diagnostic crash");
} else {
Log.e(LOGTAG, "register() is called a second time", new Exception());
throw bug1401737Diag;
}
EventDispatcher.getInstance().registerGeckoThreadListener(EVENT_LISTENER,
"Gecko:ScheduleRun");
}