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

Commit

Permalink
Reload affected sessions on all windows
Browse files Browse the repository at this point in the history
  • Loading branch information
MortimerGoro committed Mar 25, 2020
1 parent 2c9c131 commit 3a033a0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import org.mozilla.vrbrowser.db.SitePermission;
import org.mozilla.vrbrowser.ui.viewmodel.SitePermissionViewModel;
import org.mozilla.vrbrowser.ui.widgets.WidgetManagerDelegate;
import org.mozilla.vrbrowser.ui.widgets.WindowWidget;
import org.mozilla.vrbrowser.ui.widgets.dialogs.PermissionWidget;
import org.mozilla.vrbrowser.utils.SystemUtils;
import org.mozilla.vrbrowser.utils.UrlUtils;
Expand Down Expand Up @@ -286,11 +287,20 @@ public void setPermissionAllowed(String uri, @SitePermission.Category int catego
mSitePermissionModel.deleteSite(site);
} else {
if (site == null) {
site = new SitePermission(uri, false, SitePermission.SITE_PERMISSION_WEBXR);
site = new SitePermission(uri, false, category);
mSitePermissions.add(site);
}
site.allowed = false;
mSitePermissionModel.insertSite(site);
}

// Reload URIs with the same domain
for (WindowWidget window: mWidgetManager.getWindows().getCurrentWindows()) {
Session session = window.getSession();
if (uri.equalsIgnoreCase(UrlUtils.getHost(session.getCurrentUri()))) {
session.reload(GeckoSession.LOAD_FLAGS_BYPASS_CACHE);
}
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1181,14 +1181,12 @@ private void toggleQuickPermission(UIButton target, @SitePermission.Category int
public void onBlock() {
SessionStore.get().setPermissionAllowed(uri, aCategory, false);
mQuickPermissionWidget.onDismiss();
mAttachedWindow.getSession().reload();
}

@Override
public void onAllow() {
SessionStore.get().setPermissionAllowed(uri, aCategory, true);
mQuickPermissionWidget.onDismiss();
mAttachedWindow.getSession().reload();
}
});
mQuickPermissionWidget.getPlacement().parentHandle = getHandle();
Expand Down

0 comments on commit 3a033a0

Please sign in to comment.