From 54a2c7186a74cd192c3f04e8eac8511118a01c86 Mon Sep 17 00:00:00 2001 From: Suvesh Moza Date: Thu, 13 Nov 2025 13:26:13 +0530 Subject: [PATCH] feat: add support for Firefox data collection permissions --- packages/wxt/src/core/utils/manifest.ts | 11 ++++++++ packages/wxt/src/types.ts | 37 +++++++++++++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/packages/wxt/src/core/utils/manifest.ts b/packages/wxt/src/core/utils/manifest.ts index 2cfcc11ee..0328d939f 100644 --- a/packages/wxt/src/core/utils/manifest.ts +++ b/packages/wxt/src/core/utils/manifest.ts @@ -118,6 +118,17 @@ export async function generateManifest( ? undefined : versionName; + // Warn if building for Firefox without data_collection_permissions + if ( + wxt.config.browser === 'firefox' && + !userManifest.browser_specific_settings?.gecko?.data_collection_permissions + ) { + wxt.logger.warn( + 'Firefox requires explicit data collection permissions. Consider adding `data_collection_permissions` to your manifest config.\n' + + 'For more details, see: https://extensionworkshop.com/documentation/develop/firefox-builtin-data-consent/#specifying-data-types\n', + ); + } + addEntrypoints(manifest, entrypoints, buildOutput); if (wxt.config.command === 'serve') addDevModeCsp(manifest); diff --git a/packages/wxt/src/types.ts b/packages/wxt/src/types.ts index b1ef253bd..efdf2d94e 100644 --- a/packages/wxt/src/types.ts +++ b/packages/wxt/src/types.ts @@ -844,6 +844,38 @@ export type ResolvedPerBrowserOptions = { : T[key]; } & { [key in TOmitted]: T[key] }; +/** + * Firefox data collection permission types for personal data. + * See: https://extensionworkshop.com/documentation/develop/firefox-builtin-data-consent/#specifying-data-types + */ +export type FirefoxDataCollectionType = + | 'locationInfo' + | 'browsingActivity' + | 'websiteContent' + | 'websiteActivity' + | 'searchTerms' + | 'bookmarksInfo' + | 'healthInfo' + | 'contactInfo' + | 'socialInfo'; + +/** + * Firefox data collection permissions configuration. + * See: https://extensionworkshop.com/documentation/develop/firefox-builtin-data-consent/#specifying-data-types + */ +export interface FirefoxDataCollectionPermissions { + /** + * Required data collection permissions. Users must opt in to use the extension. + * Can include personal data types or "none" to explicitly indicate no data collection. + */ + required?: Array; + /** + * Optional data collection permissions. Users can opt in after installation. + * Can include personal data types or "technicalAndInteraction" (which can only be optional). + */ + optional?: Array; +} + /** * Manifest customization available in the `wxt.config.ts` file. You cannot configure entrypoints * here, they are configured inline. @@ -879,6 +911,11 @@ export type UserManifest = { strict_min_version?: string; strict_max_version?: string; update_url?: string; + /** + * Firefox data collection permissions configuration. + * See: https://extensionworkshop.com/documentation/develop/firefox-builtin-data-consent/#specifying-data-types + */ + data_collection_permissions?: FirefoxDataCollectionPermissions; }; gecko_android?: { strict_min_version?: string;