@@ -81,11 +81,12 @@ for (const srcFilePath of getAllFilesInDir('./extension', /\.ts$/)) {
8181const expectedPermissions : chrome . runtime . ManifestPermissions [ ] = [ 'alarms' , 'scripting' , 'storage' , 'tabs' , 'unlimitedStorage' ] ;
8282const expectedConsumerHostPermissions = [ 'https://*.google.com/*' , 'https://www.googleapis.com/*' , 'https://flowcrypt.com/*' ] ;
8383const expectedEnterpriseHostPermissions = [ 'https://*.google.com/*' , 'https://*.googleapis.com/*' , 'https://flowcrypt.com/*' ] ;
84- for ( const buildType of [ 'chrome-consumer' , 'chrome-enterprise' ] ) {
84+ for ( const buildType of [ 'chrome-consumer' , 'chrome-enterprise' , 'thunderbird-consumer' , 'firefox-consumer' ] ) {
8585 const manifest = JSON . parse ( readFileSync ( `./build/${ buildType } /manifest.json` ) . toString ( ) ) as chrome . runtime . Manifest ;
86+ const isManifestV3Build = buildType . includes ( 'chrome' ) || buildType . includes ( 'firefox' ) ;
8687 const expectedHostPermissions = buildType . includes ( 'consumer' ) ? expectedConsumerHostPermissions : expectedEnterpriseHostPermissions ;
8788 for ( const expectedHostPermission of expectedHostPermissions ) {
88- if ( ! manifest . host_permissions . includes ( expectedHostPermission ) ) {
89+ if ( isManifestV3Build && ! manifest . host_permissions . includes ( expectedHostPermission ) ) {
8990 console . error ( `Missing host permission '${ expectedHostPermission } ' in ${ buildType } /manifest.json` ) ;
9091 errsFound ++ ;
9192 }
@@ -98,9 +99,31 @@ for (const buildType of ['chrome-consumer', 'chrome-enterprise']) {
9899 }
99100 }
100101 }
101- const gmailCs = manifest . content_scripts ?. find ( cs => cs . matches ?. includes ( 'https://mail.google.com/*' ) ) ;
102- if ( ! gmailCs ?. css ?. length || ! gmailCs . js ?. length ) {
103- console . error ( `Missing content_scripts declaration for Gmail in ${ buildType } /manifest.json` ) ;
102+ if ( buildType === 'thunderbird-consumer' ) {
103+ if ( manifest . manifest_version !== 2 ) {
104+ console . error ( `${ buildType } - The manifest version is not 2` ) ;
105+ errsFound ++ ;
106+ }
107+ if ( ! Array . isArray ( manifest . web_accessible_resources ) ) {
108+ console . error ( `${ buildType } - The web_accessible_resources should be an array` ) ;
109+ errsFound ++ ;
110+ }
111+ if ( typeof manifest . content_security_policy !== 'string' ) {
112+ console . error ( `${ buildType } - The content_security_policy should be a string` ) ;
113+ errsFound ++ ;
114+ }
115+ const thunderbirdExpectedPermissions = [ 'compose' , 'messagesRead' , 'messagesUpdate' , 'messagesModify' , 'accountsRead' ] ;
116+ const buildHostPermissions = isManifestV3Build ? manifest . host_permissions : manifest . permissions ;
117+ for ( const expectedHostPermission of thunderbirdExpectedPermissions ) {
118+ if ( ! buildHostPermissions ?. includes ( expectedHostPermission ) ) {
119+ console . error ( `${ buildType } - Missing permission ${ expectedHostPermission } in ${ buildType } /manifest.json` ) ;
120+ errsFound ++ ;
121+ }
122+ }
123+ }
124+ const extensionContentScript = manifest . content_scripts ?. find ( cs => cs . matches ?. includes ( 'https://mail.google.com/*' ) ) ;
125+ if ( ! extensionContentScript ?. css ?. length || ! extensionContentScript . js ?. length ) {
126+ console . error ( `Missing content_scripts declaration for the extension in ${ buildType } /manifest.json` ) ;
104127 errsFound ++ ;
105128 }
106129}
0 commit comments