Bug 1697824 - Don't clear GeckoSession.mOwner instance. r=esawin

Having a null WeakReference<> object is a little unexpected, to avoid confusion
we set mOwner to a WeakReference<>(null) value instead to avoid
a NullPointerException.

Differential Revision: https://phabricator.services.mozilla.com/D110976
This commit is contained in:
Agi Sferro 2021-04-06 22:41:18 +00:00
Родитель ac7b968385
Коммит 356e2d8209
1 изменённых файлов: 2 добавлений и 2 удалений

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

@ -1055,7 +1055,7 @@ public class GeckoSession {
}
mNativeQueue.reset(State.INITIAL);
mNativeQueue = null;
mOwner = null;
mOwner = new WeakReference<>(null);
}
// Detach ourselves from the binder as well, to prevent this window from being
@ -1117,7 +1117,7 @@ public class GeckoSession {
private GeckoResult<Boolean> onLoadRequest(final @NonNull String uri, final int windowType,
final int flags, final @Nullable String triggeringUri,
final boolean hasUserGesture, final boolean isTopLevel) {
final GeckoSession session = (mOwner == null) ? null : mOwner.get();
final GeckoSession session = mOwner.get();
if (session == null) {
// Don't handle any load request if we can't get the session for some reason.
return GeckoResult.fromValue(false);