feat #303: ask for browsing data permission dynamically
This commit is contained in:
+1
-1
Submodule src/_locales updated: 29e6ef5dfe...bdaa01291b
+8
-4
@@ -1531,7 +1531,8 @@ input[type=text] {
|
|||||||
min-block-size: 500px;
|
min-block-size: 500px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.delete-container-panel, .clear-container-storage-panel {
|
.delete-container-panel,
|
||||||
|
.clear-container-storage-panel {
|
||||||
min-block-size: 500px;
|
min-block-size: 500px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1820,12 +1821,14 @@ manage things like container crud */
|
|||||||
margin-inline-end: 0;
|
margin-inline-end: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.delete-container-confirm, .clear-container-storage-confirm {
|
.delete-container-confirm,
|
||||||
|
.clear-container-storage-confirm {
|
||||||
padding-inline-end: 20px;
|
padding-inline-end: 20px;
|
||||||
padding-inline-start: 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);
|
color: var(--text-color-primary);
|
||||||
font-size: var(--font-size-heading);
|
font-size: var(--font-size-heading);
|
||||||
}
|
}
|
||||||
@@ -2334,7 +2337,8 @@ input {
|
|||||||
font-weight: bolder;
|
font-weight: bolder;
|
||||||
}
|
}
|
||||||
|
|
||||||
.delete-warning, .clear-container-storage-warning {
|
.delete-warning,
|
||||||
|
.clear-container-storage-warning {
|
||||||
padding-block-end: 8px;
|
padding-block-end: 8px;
|
||||||
padding-block-start: 8px;
|
padding-block-start: 8px;
|
||||||
padding-inline-end: 0;
|
padding-inline-end: 0;
|
||||||
|
|||||||
@@ -572,7 +572,7 @@ window.assignManager = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
async _resetCookiesForSite(hostname, cookieStoreId) {
|
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({
|
await browser.browsingData.removeCookies({
|
||||||
cookieStoreId: cookieStoreId,
|
cookieStoreId: cookieStoreId,
|
||||||
hostnames: [hostNameTruncated] // This does not remove cookies from associated domains. To remove all cookies, we have a container storage removal option.
|
hostnames: [hostNameTruncated] // This does not remove cookies from associated domains. To remove all cookies, we have a container storage removal option.
|
||||||
|
|||||||
+11
-4
@@ -1005,8 +1005,11 @@ Logic.registerPanel(P_CONTAINER_INFO, {
|
|||||||
Logic.showPanel(P_CONTAINER_EDIT, identity);
|
Logic.showPanel(P_CONTAINER_EDIT, identity);
|
||||||
});
|
});
|
||||||
const clearContainerStorageButton = document.getElementById("clear-container-storage-info");
|
const clearContainerStorageButton = document.getElementById("clear-container-storage-info");
|
||||||
Utils.addEnterHandler(clearContainerStorageButton, () => {
|
Utils.addEnterHandler(clearContainerStorageButton, async () => {
|
||||||
Logic.showPanel(P_CLEAR_CONTAINER_STORAGE, identity);
|
const granted = await browser.permissions.request({ permissions: ["browsingData"] });
|
||||||
|
if (granted) {
|
||||||
|
Logic.showPanel(P_CLEAR_CONTAINER_STORAGE, identity);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
return this.buildOpenTabTable(tabs);
|
return this.buildOpenTabTable(tabs);
|
||||||
},
|
},
|
||||||
@@ -1491,6 +1494,10 @@ Logic.registerPanel(P_CONTAINER_ASSIGNMENTS, {
|
|||||||
const resetButton = trElement.querySelector(".reset-button");
|
const resetButton = trElement.querySelector(".reset-button");
|
||||||
Utils.addEnterHandler(resetButton, async () => {
|
Utils.addEnterHandler(resetButton, async () => {
|
||||||
const cookieStoreId = Logic.currentCookieStoreId();
|
const cookieStoreId = Logic.currentCookieStoreId();
|
||||||
|
const granted = await browser.permissions.request({ permissions: ["browsingData"] });
|
||||||
|
if (!granted) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const result = await Utils.resetCookiesForSite(site.hostname, cookieStoreId);
|
const result = await Utils.resetCookiesForSite(site.hostname, cookieStoreId);
|
||||||
if (result === true) {
|
if (result === true) {
|
||||||
Logic.notify({messageId: "cookiesClearedSuccess", placeholders: [site.hostname]});
|
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 () => {
|
Utils.addEnterHandler(document.querySelector("#clear-container-storage-ok-link"), async () => {
|
||||||
const identity = Logic.currentIdentity();
|
const identity = Logic.currentIdentity();
|
||||||
const userContextId = Utils.userContextId(identity.cookieStoreId)
|
const userContextId = Utils.userContextId(identity.cookieStoreId);
|
||||||
const result = await browser.runtime.sendMessage({
|
const result = await browser.runtime.sendMessage({
|
||||||
method: "deleteContainerDataOnly",
|
method: "deleteContainerDataOnly",
|
||||||
message: { userContextId }
|
message: { userContextId }
|
||||||
@@ -2300,7 +2307,7 @@ Logic.registerPanel(P_CLEAR_CONTAINER_STORAGE, {
|
|||||||
if (result.done === true) {
|
if (result.done === true) {
|
||||||
Logic.notify({messageId: "storageWasClearedConfirmation", placeholders: [identity.name]});
|
Logic.notify({messageId: "storageWasClearedConfirmation", placeholders: [identity.name]});
|
||||||
}
|
}
|
||||||
Logic.showPanel(P_CONTAINER_INFO, identity, false, false)
|
Logic.showPanel(P_CONTAINER_INFO, identity, false, false);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -13,7 +13,6 @@
|
|||||||
"<all_urls>",
|
"<all_urls>",
|
||||||
"activeTab",
|
"activeTab",
|
||||||
"cookies",
|
"cookies",
|
||||||
"browsingData",
|
|
||||||
"contextMenus",
|
"contextMenus",
|
||||||
"contextualIdentities",
|
"contextualIdentities",
|
||||||
"history",
|
"history",
|
||||||
@@ -27,6 +26,7 @@
|
|||||||
],
|
],
|
||||||
"optional_permissions": [
|
"optional_permissions": [
|
||||||
"bookmarks",
|
"bookmarks",
|
||||||
|
"browsingData",
|
||||||
"nativeMessaging",
|
"nativeMessaging",
|
||||||
"proxy"
|
"proxy"
|
||||||
],
|
],
|
||||||
|
|||||||
Reference in New Issue
Block a user