Skip to content

Commit

Permalink
feat #303: ask for browsing data permission dynamically
Browse files Browse the repository at this point in the history
  • Loading branch information
rafeerahman committed Aug 27, 2024
1 parent 2cd3829 commit bdae43e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
11 changes: 8 additions & 3 deletions src/js/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -980,7 +980,7 @@ Logic.registerPanel(P_CONTAINER_INFO, {
Utils.alwaysOpenInContainer(identity);
window.close();
});

// Show or not the has-tabs section.
for (let trHasTabs of document.getElementsByClassName("container-info-has-tabs")) { // eslint-disable-line prefer-const
trHasTabs.style.display = !identity.hasHiddenTabs && !identity.hasOpenTabs ? "none" : "";
Expand All @@ -1005,8 +1005,13 @@ Logic.registerPanel(P_CONTAINER_INFO, {
Logic.showPanel(P_CONTAINER_EDIT, identity);
});
const clearContainerStorageButton = document.getElementById("clear-container-storage-info");
Utils.addEnterHandler(clearContainerStorageButton, () => {
Logic.showPanel(P_CLEAR_CONTAINER_STORAGE, identity);
Utils.addEnterHandler(clearContainerStorageButton, async () => {
const requiredPermission = { permissions: ["browsingData"] };
const granted = await browser.permissions.request(requiredPermission);

if (granted) {
Logic.showPanel(P_CLEAR_CONTAINER_STORAGE, identity);
}
});
return this.buildOpenTabTable(tabs);
},
Expand Down
2 changes: 1 addition & 1 deletion src/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
"<all_urls>",
"activeTab",
"cookies",
"browsingData",
"contextMenus",
"contextualIdentities",
"history",
Expand All @@ -27,6 +26,7 @@
],
"optional_permissions": [
"bookmarks",
"browsingData",
"nativeMessaging",
"proxy"
],
Expand Down

0 comments on commit bdae43e

Please sign in to comment.