Skip to content

Prevent feature automatic overriding going forward #2940

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
69 changes: 64 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,63 @@ function isFeatureMissingState(feature) {
return !('state' in feature);
}

// We previously rolled out all features to all platforms, so this is a safety whilst we deprecate that behavior.
// Don't add new items to this list, we should just add fearures to overrides/ files instead with explicit state.
const legacyDisabledFeatures = [
'adBlockExtension',
'androidBrowserConfig',
'androidNewStateKillSwitch',
'ampLinks',
'appTrackerProtection',
'auraExperiment',
'autoconsent',
'autofillService',
'bookmarksSorting',
'brokenSiteReportExperiment',
'changeOmnibarPosition',
'clickToLoad',
'clickToPlay',
'clientBrandHint',
'contextualOnboarding',
'cookie',
'customUserAgent',
'duckPlayer',
'exceptionHandler',
'extendedOnboarding',
'fingerprintingBattery',
'fingerprintingCanvas',
'fingerprintingTemporaryStorage',
'googleRejected',
'harmfulApis',
'incontextSignup',
'mediaPlaybackRequiresUserGesture',
'messageBridge',
'newTabContinueSetUp',
'nonTracking3pCookies',
'privacyDashboard',
'referrer',
'serviceworkerInitiatedRequests',
'settingsPage',
'showOnAppLaunch',
'swipingTabs',
'tabManager',
'textZoom',
'trackingCookies1p',
'trackingCookies3p',
'voiceSearch',
'webViewBlobDownload',
'windowsDownloadLink',
'windowsExternalPreviewReleases',
'windowsFireWindow',
'windowsPermissionUsage',
'windowsPrecisionScroll',
'windowsSpellChecker',
'windowsStartupBoost',
'windowsWaitlist',
'windowsWebViewPermissionsSavesInProfile',
'windowsWebviewFailures',
];

// Handle platform specific overrides and write configs to disk
async function buildPlatforms() {
const platformConfigs = {};
Expand Down Expand Up @@ -230,8 +287,13 @@ async function buildPlatforms() {
}
}

if (isFeatureMissingState(platformConfig.features[key])) {
platformConfig.features[key].state = 'disabled';
if (isFeatureMissingState(platformConfig.features[key], key)) {
if (legacyDisabledFeatures.includes(key)) {
platformConfig.features[key].state = 'disabled';
} else {
// Remove the feature if we're not explicitly enabling it in overrides/
delete platformConfig.features[key];
}
}
}

Expand All @@ -242,9 +304,6 @@ async function buildPlatforms() {
}

platformConfig.features[key] = { ...platformOverride.features[key] };
if (isFeatureMissingState(platformConfig.features[key])) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

iirc this gets caught with schema now.
If the feature doesn't have a "state" in the features file and also not in the platform. Also it'd be deleted above.

platformConfig.features[key].state = 'disabled';
}
}

// Remove appTP feature from platforms that don't use it since it's a large feature
Expand Down
3 changes: 3 additions & 0 deletions overrides/extension-override.json
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,9 @@
}
}
}
},
"webCompat": {
"state": "disabled"
}
},
"unprotectedTemporary": [
Expand Down
20 changes: 10 additions & 10 deletions schema/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,16 @@ export type ConfigV4<VersionType> = {
features: Record<string, Feature<any, VersionType>> & {
// These features have typed settings
apiModification?: APIModificationFeature<VersionType>;
autoconsent: AutoconsentFeature<VersionType>;
autofill: AutofillFeature<VersionType>;
import: ImportFeature<VersionType>;
cookie: CookieFeature<VersionType>;
duckPlayer: DuckPlayerFeature<VersionType>;
duckPlayerNative: DuckPlayerNativeFeature<VersionType>;
trackerAllowlist: TrackerAllowlistFeature<VersionType>;
webCompat: WebCompatFeature<VersionType>;
messageBridge: MessageBridgeFeature<VersionType>;
androidBrowserConfig: AndroidBrowserConfig<VersionType>;
autoconsent?: AutoconsentFeature<VersionType>;
autofill?: AutofillFeature<VersionType>;
import?: ImportFeature<VersionType>;
cookie?: CookieFeature<VersionType>;
duckPlayer?: DuckPlayerFeature<VersionType>;
duckPlayerNative?: DuckPlayerNativeFeature<VersionType>;
trackerAllowlist?: TrackerAllowlistFeature<VersionType>;
webCompat?: WebCompatFeature<VersionType>;
messageBridge?: MessageBridgeFeature<VersionType>;
androidBrowserConfig?: AndroidBrowserConfig<VersionType>;
fingerprintingHardware?: FingerprintingHardwareFeature<VersionType>;
fingerpringtingScreenSize?: FingerprintingScreenSizeFeature<VersionType>;
networkProtection?: NetworkProtection<VersionType>;
Expand Down