Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exempt tabs from container rechecking when they are opened from the same host #1192

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions src/js/background/assignManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,23 @@ const assignManager = {
this.deleteContainer(siteSettings.userContextId);
return {};
}

// If a page has been opened in a nonstandard container, the exemption flag for that
// tab will have been set, so following links in the same tab will not trigger new
// prompts about the container in which to open the page. However, opening links
// in a new tab will not be subject to this protection.
// To prevent this, explicitly allow requests that don't change host to go through.
if(options.originUrl) {
const originUrl = new window.URL(options.originUrl);
const newUrl = new window.URL(options.url);
if(originUrl.hostname === newUrl.hostname) {
// in fact, set this URL-tab combo exempted so future manual browsing
// within it does also not trigger new prompts
this.storageArea.setExempted(options.url, options.tabId);
return {};
}
}

const userContextId = this.getUserContextIdFromCookieStore(tab);
if (!siteSettings
|| userContextId === siteSettings.userContextId
Expand Down