Skip to content

Commit

Permalink
fix #2603: remember choice to always open in default containers
Browse files Browse the repository at this point in the history
  • Loading branch information
rafeerahman committed Jul 23, 2024
1 parent 1537e9f commit 5164527
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
5 changes: 5 additions & 0 deletions src/js/background/assignManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,11 @@ window.assignManager = {
_neverAsk(m) {
const pageUrl = m.pageUrl;
if (m.neverAsk === true) {
if (m.defaultContainer === true) {
this.storageArea.remove(pageUrl);
return;
}

// If we have existing data and for some reason it hasn't been
// deleted etc lets update it
this.storageArea.get(pageUrl).then((siteSettings) => {
Expand Down
18 changes: 15 additions & 3 deletions src/js/confirm-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ async function load() {

document.getElementById("deny").addEventListener("click", (e) => {
e.preventDefault();
denySubmit(redirectUrl);
denySubmit(redirectUrl, currentCookieStoreId)

Check failure on line 12 in src/js/confirm-page.js

View workflow job for this annotation

GitHub Actions / Run tests

Missing semicolon
});

document.getElementById("deny-no-container").addEventListener("click", (e) => {
e.preventDefault();
denySubmit(redirectUrl);
denySubmit(redirectUrl, currentCookieStoreId)

Check failure on line 17 in src/js/confirm-page.js

View workflow job for this annotation

GitHub Actions / Run tests

Missing semicolon
});

const container = await browser.contextualIdentities.get(cookieStoreId);
Expand Down Expand Up @@ -72,8 +72,20 @@ function getCurrentTab() {
});
}

async function denySubmit(redirectUrl) {
async function denySubmit(redirectUrl, currentCookieStoreId) {
const tab = await getCurrentTab();
const currentContainer = currentCookieStoreId ? await browser.contextualIdentities.get(currentCookieStoreId) : null;
const neverAsk = document.getElementById("never-ask").checked;

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

await browser.runtime.sendMessage({
method: "exemptContainerAssignment",
tabId: tab[0].id,
Expand Down

0 comments on commit 5164527

Please sign in to comment.