feat #303: ask for browsing data permission dynamically
This commit is contained in:
parent
2cd38299e2
commit
c644a60e46
5 changed files with 27 additions and 16 deletions
|
@ -1 +1 @@
|
|||
Subproject commit 29e6ef5dfe50f69f0de356b014db6311f684f05f
|
||||
Subproject commit bdaa01291b7367a5e815470fd263ea36c862fe32
|
|
@ -294,11 +294,11 @@ table {
|
|||
border-radius: 4px;
|
||||
font-size: 12px;
|
||||
position: absolute;
|
||||
inset-block-start: 0;
|
||||
inset-inline-start: 0;
|
||||
padding-block: 8px;
|
||||
inset-block-start: 0;
|
||||
inset-inline-start: 0;
|
||||
padding-block: 8px;
|
||||
padding-inline: 8px;
|
||||
margin-block: 8px;
|
||||
margin-block: 8px;
|
||||
margin-inline: 8px;
|
||||
inline-size: calc(100vw - 25px);
|
||||
background-color: var(--button-bg-active-color-secondary);
|
||||
|
@ -1531,7 +1531,8 @@ input[type=text] {
|
|||
min-block-size: 500px;
|
||||
}
|
||||
|
||||
.delete-container-panel, .clear-container-storage-panel {
|
||||
.delete-container-panel,
|
||||
.clear-container-storage-panel {
|
||||
min-block-size: 500px;
|
||||
}
|
||||
|
||||
|
@ -1820,12 +1821,14 @@ manage things like container crud */
|
|||
margin-inline-end: 0;
|
||||
}
|
||||
|
||||
.delete-container-confirm, .clear-container-storage-confirm {
|
||||
.delete-container-confirm,
|
||||
.clear-container-storage-confirm {
|
||||
padding-inline-end: 20px;
|
||||
padding-inline-start: 20px;
|
||||
}
|
||||
|
||||
.delete-container-confirm-title, .clear-container-storage-confirm-title {
|
||||
.delete-container-confirm-title,
|
||||
.clear-container-storage-confirm-title {
|
||||
color: var(--text-color-primary);
|
||||
font-size: var(--font-size-heading);
|
||||
}
|
||||
|
@ -2334,7 +2337,8 @@ input {
|
|||
font-weight: bolder;
|
||||
}
|
||||
|
||||
.delete-warning, .clear-container-storage-warning {
|
||||
.delete-warning,
|
||||
.clear-container-storage-warning {
|
||||
padding-block-end: 8px;
|
||||
padding-block-start: 8px;
|
||||
padding-inline-end: 0;
|
||||
|
|
|
@ -572,7 +572,7 @@ window.assignManager = {
|
|||
},
|
||||
|
||||
async _resetCookiesForSite(hostname, cookieStoreId) {
|
||||
const hostNameTruncated = hostname.replace(/^www\./, ''); // Remove "www." from the hostname
|
||||
const hostNameTruncated = hostname.replace(/^www\./, ""); // Remove "www." from the hostname
|
||||
await browser.browsingData.removeCookies({
|
||||
cookieStoreId: cookieStoreId,
|
||||
hostnames: [hostNameTruncated] // This does not remove cookies from associated domains. To remove all cookies, we have a container storage removal option.
|
||||
|
|
|
@ -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" : "";
|
||||
|
@ -1005,8 +1005,11 @@ 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 granted = await browser.permissions.request({ permissions: ["browsingData"] });
|
||||
if (granted) {
|
||||
Logic.showPanel(P_CLEAR_CONTAINER_STORAGE, identity);
|
||||
}
|
||||
});
|
||||
return this.buildOpenTabTable(tabs);
|
||||
},
|
||||
|
@ -1491,6 +1494,10 @@ Logic.registerPanel(P_CONTAINER_ASSIGNMENTS, {
|
|||
const resetButton = trElement.querySelector(".reset-button");
|
||||
Utils.addEnterHandler(resetButton, async () => {
|
||||
const cookieStoreId = Logic.currentCookieStoreId();
|
||||
const granted = await browser.permissions.request({ permissions: ["browsingData"] });
|
||||
if (!granted) {
|
||||
return;
|
||||
}
|
||||
const result = await Utils.resetCookiesForSite(site.hostname, cookieStoreId);
|
||||
if (result === true) {
|
||||
Logic.notify({messageId: "cookiesClearedSuccess", placeholders: [site.hostname]});
|
||||
|
@ -2292,7 +2299,7 @@ Logic.registerPanel(P_CLEAR_CONTAINER_STORAGE, {
|
|||
});
|
||||
Utils.addEnterHandler(document.querySelector("#clear-container-storage-ok-link"), async () => {
|
||||
const identity = Logic.currentIdentity();
|
||||
const userContextId = Utils.userContextId(identity.cookieStoreId)
|
||||
const userContextId = Utils.userContextId(identity.cookieStoreId);
|
||||
const result = await browser.runtime.sendMessage({
|
||||
method: "deleteContainerDataOnly",
|
||||
message: { userContextId }
|
||||
|
@ -2300,7 +2307,7 @@ Logic.registerPanel(P_CLEAR_CONTAINER_STORAGE, {
|
|||
if (result.done === true) {
|
||||
Logic.notify({messageId: "storageWasClearedConfirmation", placeholders: [identity.name]});
|
||||
}
|
||||
Logic.showPanel(P_CONTAINER_INFO, identity, false, false)
|
||||
Logic.showPanel(P_CONTAINER_INFO, identity, false, false);
|
||||
});
|
||||
},
|
||||
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
"<all_urls>",
|
||||
"activeTab",
|
||||
"cookies",
|
||||
"browsingData",
|
||||
"contextMenus",
|
||||
"contextualIdentities",
|
||||
"history",
|
||||
|
@ -27,6 +26,7 @@
|
|||
],
|
||||
"optional_permissions": [
|
||||
"bookmarks",
|
||||
"browsingData",
|
||||
"nativeMessaging",
|
||||
"proxy"
|
||||
],
|
||||
|
|
Loading…
Add table
Reference in a new issue