Skip to content

Commit

Permalink
Distribute unprotected-temporary domains also on platform overrides (#…
Browse files Browse the repository at this point in the history
…1329)

* Distribute unprotectedTemp domains on platform overrides as well

* Zap commented out line

* Make requested changes

* Refactor global-add-exceptions function

---------

Co-authored-by: Brad Slayter <[email protected]>
Co-authored-by: Jonathan Kingston <[email protected]>
  • Loading branch information
3 people authored Oct 5, 2023
1 parent d40c408 commit 3431a99
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,22 +113,26 @@ const excludedFeaturesFromUnprotectedTempExceptions = [
'duckPlayer',
'incontextSignup',
'incrementalRolloutTest',
'incrementalRolloutTest2',
'networkProtection',
'newTabContinueSetUp',
'voiceSearch',
'windowsPermissionUsage',
'windowsWaitlist',
'windowsDownloadLink'
]
for (const key of Object.keys(defaultConfig.features)) {
if (!(excludedFeaturesFromUnprotectedTempExceptions.includes(key))) {
defaultConfig.features[key].exceptions = defaultConfig.features[key].exceptions.concat(listData.exceptions)
function applyGlobalUnprotectedTempExceptionsToFeatures (key, baseConfig, globalExceptions) {
if (!excludedFeaturesFromUnprotectedTempExceptions.includes(key)) {
baseConfig.features[key].exceptions = baseConfig.features[key].exceptions.concat(globalExceptions)
}
if (key === 'customUserAgent') {
defaultConfig.features[key].settings.omitApplicationSites = defaultConfig.features[key].settings.omitApplicationSites.concat(listData.exceptions)
defaultConfig.features[key].settings.omitVersionSites = defaultConfig.features[key].settings.omitVersionSites.concat(listData.exceptions)
if (key === 'customUserAgent' && !(baseConfig.features[key].settings.webViewDefault)) {
baseConfig.features[key].settings.omitApplicationSites = baseConfig.features[key].settings.omitApplicationSites.concat(globalExceptions)
baseConfig.features[key].settings.omitVersionSites = baseConfig.features[key].settings.omitVersionSites.concat(globalExceptions)
}
}
for (const key of Object.keys(defaultConfig.features)) {
applyGlobalUnprotectedTempExceptionsToFeatures(key, defaultConfig, listData.exceptions)
}

// Create generated directory
mkdirIfNeeded(GENERATED_DIR)
Expand Down Expand Up @@ -232,7 +236,9 @@ async function buildPlatforms () {

if (platformOverride.unprotectedTemporary) {
addExceptionsToUnprotected(platformOverride.unprotectedTemporary)
platformConfig.unprotectedTemporary = platformConfig.unprotectedTemporary.concat(platformOverride.unprotectedTemporary)
for (const key of Object.keys(platformOverride.features)) {
applyGlobalUnprotectedTempExceptionsToFeatures(key, platformConfig, platformOverride.unprotectedTemporary)
}
}

addCnameEntriesToAllowlist(tds, platformConfig.features.trackerAllowlist.settings.allowlistedTrackers)
Expand Down

0 comments on commit 3431a99

Please sign in to comment.