autocontainmode: "strict" | "relaxed"

The prior (and still default) autocontain behaviour is to intercept all
page loads that match an aucon pattern, and may even replace a tab to do
so. "relaxed" mode is introduced here as a way to only apply the rules
when opening a new tab.
This commit is contained in:
arcnmx 2019-10-15 16:56:45 -07:00
parent 2f28555ac6
commit fec571d748
2 changed files with 10 additions and 0 deletions

View file

@ -77,6 +77,9 @@ export class AutoContain implements IAutoContain {
): Promise<browser.webRequest.BlockingResponse> => {
if (!this.autocontainConfigured()) return { cancel: false }
// Only handle in strict mode.
if (Config.get("autocontainmode") === "relaxed") return { cancel: false }
// Only handle http requests.
if (details.url.search("^https?://") < 0) return { cancel: false }

View file

@ -439,6 +439,13 @@ export class default_config {
// "youtube.com": "google",
})
/**
* Strict mode will always ensure a domain is open in the correct container, replacing the current tab if necessary.
*
* Relaxed mode is less aggressive and instead treats container domains as a default when opening a new tab.
*/
autocontainmode: "strict" | "relaxed" = "strict"
/**
* Aliases for the commandline.
*