diff --git a/src/containers.js b/src/containers.js index 3fc7475..f1e60ac 100644 --- a/src/containers.js +++ b/src/containers.js @@ -68,6 +68,19 @@ async function handle(url, tabId) { delete creatingTabs[tabId]; } let preferences = await PreferenceStorage.getAll(true); + let OPEN_IN_CURRENT_CONTAINER_RAW = preferences.openInCurrentContainer; + //console.debug('Raw configuration variable --> ', OPEN_IN_CURRENT_CONTAINER_RAW); + if (typeof OPEN_IN_CURRENT_CONTAINER_RAW !== 'undefined') { + const OPEN_IN_CURRENT_CONTAINER = '(' + preferences.openInCurrentContainer.replace(/ /g, '') + ')/'; + //console.debug('Formatted configuration variable --> ', OPEN_IN_CURRENT_CONTAINER); + if (OPEN_IN_CURRENT_CONTAINER !== '') { + let OPEN_IN_CURRENT_CONTAINER_REGEX = new RegExp(OPEN_IN_CURRENT_CONTAINER); + if (OPEN_IN_CURRENT_CONTAINER_REGEX.test(url)) { + //console.debug('URL was left in current container due to Regex--> ', url); + return; + } + } + } let [hostMap, identities, currentTab] = await Promise.all([ Storage.get(url, preferences.matchDomainOnly), ContextualIdentity.getAll(), diff --git a/src/ui-preferences/preferences.json b/src/ui-preferences/preferences.json index 3f92f07..8901e79 100644 --- a/src/ui-preferences/preferences.json +++ b/src/ui-preferences/preferences.json @@ -11,6 +11,13 @@ "label": "Keep old tabs", "description": "After a contained tab has been created, the old won't be closed" }, + { + "type": "string", + "name": "openInCurrentContainer", + "label": "Open in current container", + "description": "A list of domains separated by a pipe (|) which will *always* open in the current container that opened them", + "defaultValue": "" + }, { "type": "group", "name": "defaultContainer",