diff --git a/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/NavigationBarWidget.java b/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/NavigationBarWidget.java index c0bf949615..91a1da4b91 100644 --- a/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/NavigationBarWidget.java +++ b/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/NavigationBarWidget.java @@ -491,7 +491,6 @@ public void detachFromWindow() { mViewModel.getIsFullscreen().removeObserver(mIsFullscreenObserver); mViewModel.getIsActiveWindow().removeObserver(mIsActiveWindowObserver); mViewModel.getIsPopUpBlocked().removeObserver(mIsPopUpBlockedListener); - mViewModel.getUrl().removeObserver(mUrlObserver); mViewModel = null; } @@ -518,7 +517,6 @@ public void attachToWindow(@NonNull WindowWidget aWindow) { mViewModel.getIsFullscreen().observeForever( mIsFullscreenObserver); mViewModel.getIsActiveWindow().observeForever(mIsActiveWindowObserver); mViewModel.getIsPopUpBlocked().observeForever(mIsPopUpBlockedListener); - mViewModel.getUrl().observeForever(mUrlObserver); mBinding.navigationBarNavigation.urlBar.attachToWindow(mAttachedWindow); mTrackingDelegate.addListener(mTrackingListener); @@ -803,6 +801,15 @@ private void closeFloatingMenus() { } } + // NavigationDelegate + + @Override + public void onLocationChange(@NonNull GeckoSession geckoSession, @Nullable String s) { + if (getSession() != null && getSession().getGeckoSession() == geckoSession) { + updateTrackingProtection(); + } + } + // Content delegate private Observer mIsFullscreenObserver = isFullScreen -> { @@ -835,8 +842,6 @@ private void closeFloatingMenus() { } }; - private Observer mUrlObserver = sitePermissions -> updateTrackingProtection(); - private Observer mIsActiveWindowObserver = aIsActiveWindow -> updateTrackingProtection(); private Observer mIsPopUpBlockedListener = observableBoolean -> {