Bug 1292602 - Set notification client before launching Gecko to avoid crash on notification r=sebastian

Gecko could potentially send notifications via ShowAlertNotification (or any related method). It's possible
for this to happen very soon after launching Gecko, so we need to set the GeckoAppShell's notificationClient
before launching Gecko to ensure that it can handle notifications (this also avoids the associated crash - we
could try to do null-checks instead, but that would result in dropped notifications, which doesn't seem
useful).

MozReview-Commit-ID: 5MG8bBnt12M

--HG--
extra : rebase_source : 0723bbf987cf7f1f8dd5a612fb3e5cc81c6e1f78
This commit is contained in:
Andrzej Hunt 2016-08-19 09:51:37 -07:00
parent 1a22b3ba23
commit ec70caf659

View File

@ -1158,6 +1158,9 @@ public abstract class GeckoApp
GeckoAppShell.setContextGetter(this);
GeckoAppShell.setApplicationContext(getApplicationContext());
GeckoAppShell.setGeckoInterface(this);
// We need to set the notification client before launching Gecko, since Gecko could start
// sending notifications immediately after startup, which we don't want to lose/crash on.
GeckoAppShell.setNotificationClient(makeNotificationClient());
Tabs.getInstance().attachToContext(this);
try {
@ -1431,7 +1434,6 @@ public abstract class GeckoApp
}
});
GeckoAppShell.setNotificationClient(makeNotificationClient());
IntentHelper.init(this);
}