Skip to content
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
11 changes: 11 additions & 0 deletions packages/wxt/src/core/utils/manifest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
37 changes: 37 additions & 0 deletions packages/wxt/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -844,6 +844,38 @@ export type ResolvedPerBrowserOptions<T, TOmitted extends keyof T = never> = {
: 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<FirefoxDataCollectionType | 'none'>;
/**
* Optional data collection permissions. Users can opt in after installation.
* Can include personal data types or "technicalAndInteraction" (which can only be optional).
*/
optional?: Array<FirefoxDataCollectionType | 'technicalAndInteraction'>;
}

/**
* Manifest customization available in the `wxt.config.ts` file. You cannot configure entrypoints
* here, they are configured inline.
Expand Down Expand Up @@ -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;
Expand Down