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

Commit

Permalink
Update tracking protection on location change instead of url change
Browse files Browse the repository at this point in the history
  • Loading branch information
keianhzo committed Apr 22, 2020
1 parent bf8e768 commit aad8e91
Showing 1 changed file with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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);
Expand Down Expand Up @@ -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<ObservableBoolean> mIsFullscreenObserver = isFullScreen -> {
Expand Down Expand Up @@ -835,8 +842,6 @@ private void closeFloatingMenus() {
}
};

private Observer<Spannable> mUrlObserver = sitePermissions -> updateTrackingProtection();

private Observer<ObservableBoolean> mIsActiveWindowObserver = aIsActiveWindow -> updateTrackingProtection();

private Observer<ObservableBoolean> mIsPopUpBlockedListener = observableBoolean -> {
Expand Down

0 comments on commit aad8e91

Please sign in to comment.