Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Commit

Permalink
Do not handle fullscreen updates if Window is not attached yet (#3124)
Browse files Browse the repository at this point in the history
  • Loading branch information
keianhzo authored Apr 7, 2020
1 parent bd03af2 commit fc8a207
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ public interface NavigationListener {
private Executor mUIThreadExecutor;
private ArrayList<NavigationListener> mNavigationListeners;
private TrackingProtectionStore mTrackingDelegate;
private boolean mIsWindowAttached;

public NavigationBarWidget(Context aContext) {
super(aContext);
Expand All @@ -138,6 +139,8 @@ private void initialize(@NonNull Context aContext) {

updateUI();

mIsWindowAttached = false;

mAppContext = aContext.getApplicationContext();

mUIThreadExecutor = ((VRBrowserApplication)aContext.getApplicationContext()).getExecutors().mainThread();
Expand Down Expand Up @@ -489,6 +492,8 @@ public void detachFromWindow() {
mViewModel.getUrl().removeObserver(mUrlObserver);
mViewModel = null;
}

mIsWindowAttached = false;
}

@Override
Expand Down Expand Up @@ -524,6 +529,8 @@ public void attachToWindow(@NonNull WindowWidget aWindow) {
setUpSession(getSession());
}
handleWindowResize();

mIsWindowAttached = true;
}

private Session getSession() {
Expand Down Expand Up @@ -798,6 +805,10 @@ private void closeFloatingMenus() {
// Content delegate

private Observer<ObservableBoolean> mIsFullscreenObserver = isFullScreen -> {
if (!mIsWindowAttached) {
return;
}

if (isFullScreen.get()) {
enterFullScreenMode();

Expand Down

0 comments on commit fc8a207

Please sign in to comment.