diff --git a/src/_locales b/src/_locales index d3301069..93c87c7a 160000 --- a/src/_locales +++ b/src/_locales @@ -1 +1 @@ -Subproject commit d3301069f51262e8cf493a86aa2785cf3261141e +Subproject commit 93c87c7aa80d7709d5263de1d39468b675720d94 diff --git a/src/css/popup.css b/src/css/popup.css index 5980894c..d3b5f6c6 100644 --- a/src/css/popup.css +++ b/src/css/popup.css @@ -228,6 +228,7 @@ body { /* Hack for menu icons to use a light color without affecting container icons */ [data-theme="light"] img.delete-assignment, +[data-theme="dark"] img.reset-assignment, [data-theme="dark"] .trash-button, [data-theme="dark"] img.menu-icon, [data-theme="dark"] .menu-icon > img, @@ -287,7 +288,7 @@ table { /* effect borrowed from tabs in firefox, ensure that the element flexes to the full width */ .truncate-text { - inline-size: calc(100vw - 80px); + inline-size: calc(100vw - 100px); overflow: hidden; position: relative; white-space: nowrap; @@ -2314,7 +2315,8 @@ input { * rules grouped together at the beginning of the file */ /* stylelint-disable no-descending-specificity */ -.trash-button { +.trash-button, +.reset-button { display: inline-block; block-size: 20px; inline-size: 20px; @@ -2323,11 +2325,21 @@ input { text-align: center; } -tr > td > .trash-button { +.reset-button { + margin-right: 8px; +} + +.tooltip-wrapper:hover .site-settings-tooltip { + display: block; +} + +tr > td > .trash-button, +tr > td > .reset-button { display: none; } -tr:hover > td > .trash-button { +tr:hover > td > .trash-button, +tr:hover > td > .reset-button { display: block; } diff --git a/src/js/background/assignManager.js b/src/js/background/assignManager.js index 1226cba4..80a2325c 100644 --- a/src/js/background/assignManager.js +++ b/src/js/background/assignManager.js @@ -571,6 +571,18 @@ window.assignManager = { return true; }, + async _resetCookiesForSite(pageUrl, cookieStoreId) { + const url = new URL(pageUrl); + // Remove 'www.' from the domain value + const domain = url.hostname.replace(/^www\./, ""); + const cookies = await browser.cookies.getAll({domain: domain, storeId: cookieStoreId}); + for (const cookie of cookies) { + const domain = cookie.domain.startsWith(".") ? cookie.domain.slice(1) : cookie.domain; + const cookieUrl = `${cookie.secure ? "https" : "http"}://${domain}${cookie.path}`; + await browser.cookies.remove({ url: cookieUrl, name: cookie.name, storeId: cookie.storeId }); + } + }, + async _setOrRemoveAssignment(tabId, pageUrl, userContextId, remove) { let actionName; // https://github.com/mozilla/testpilot-containers/issues/626 diff --git a/src/js/background/messageHandler.js b/src/js/background/messageHandler.js index 5d644b60..bb588957 100644 --- a/src/js/background/messageHandler.js +++ b/src/js/background/messageHandler.js @@ -45,6 +45,9 @@ const messageHandler = { // m.url is the assignment to be removed/added response = assignManager._setOrRemoveAssignment(m.tabId, m.url, m.userContextId, m.value); break; + case "resetCookiesForSite": + response = assignManager._resetCookiesForSite(m.pageUrl, m.cookieStoreId); + break; case "sortTabs": backgroundLogic.sortTabs(); break; diff --git a/src/js/popup.js b/src/js/popup.js index 236e393e..bba41eaa 100644 --- a/src/js/popup.js +++ b/src/js/popup.js @@ -1450,11 +1450,14 @@ Logic.registerPanel(P_CONTAINER_ASSIGNMENTS, { /* As we don't have the full or correct path the best we can assume is the path is HTTPS and then replace with a broken icon later if it doesn't load. This is pending a better solution for favicons from web extensions */ const assumedUrl = `https://${site.hostname}/favicon.ico`; + const resetSiteCookiesInfo = browser.i18n.getMessage("resetSiteCookiesTooltipInfo"); + const deleteSiteInfo = browser.i18n.getMessage("deleteSiteTooltipInfo"); trElement.innerHTML = Utils.escaped`