Skip to content

Commit

Permalink
fix #2603: remember choice when choosing 'previous' (deny) container …
Browse files Browse the repository at this point in the history
…option
  • Loading branch information
rafeerahman committed Aug 23, 2024
1 parent cd343ab commit 6bde0a7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/js/background/assignManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ window.assignManager = {
this.storageArea.get(pageUrl).then((siteSettings) => {
if (siteSettings) {
siteSettings.neverAsk = true;
siteSettings.userContextId = backgroundLogic.getUserContextIdFromCookieStoreId(m.cookieStoreId);
this.storageArea.set(pageUrl, siteSettings);
}
}).catch((e) => {
Expand Down
11 changes: 8 additions & 3 deletions src/js/confirm-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ async function load() {
redirectUrlElement.textContent = redirectUrl;
appendFavicon(redirectUrl, redirectUrlElement);

// Option for staying on the previous container
document.getElementById("deny").addEventListener("click", (e) => {
e.preventDefault();
denySubmit(redirectUrl, currentCookieStoreId);
});

// Option for going to the default container (no container)
document.getElementById("deny-no-container").addEventListener("click", (e) => {
e.preventDefault();
denySubmit(redirectUrl, currentCookieStoreId);
Expand All @@ -27,6 +29,7 @@ async function load() {
el.textContent = browser.i18n.getMessage(elementData.messageId, containerName);
});

// Option for going to newly selected container
document.getElementById("confirm").addEventListener("click", (e) => {
e.preventDefault();
confirmSubmit(redirectUrl, cookieStoreId);
Expand Down Expand Up @@ -59,6 +62,7 @@ function confirmSubmit(redirectUrl, cookieStoreId) {
browser.runtime.sendMessage({
method: "neverAsk",
neverAsk: true,
cookieStoreId: cookieStoreId,
pageUrl: redirectUrl
});
}
Expand All @@ -77,12 +81,13 @@ async function denySubmit(redirectUrl, currentCookieStoreId) {
const currentContainer = currentCookieStoreId ? await browser.contextualIdentities.get(currentCookieStoreId) : null;
const neverAsk = document.getElementById("never-ask").checked;

if (neverAsk && !currentContainer) {
if (neverAsk) {
await browser.runtime.sendMessage({
method: "neverAsk",
neverAsk: true,
defaultContainer: true,
pageUrl: redirectUrl
cookieStoreId: currentCookieStoreId,
pageUrl: redirectUrl,
defaultContainer: !currentContainer
});
}

Expand Down

0 comments on commit 6bde0a7

Please sign in to comment.