@@ -81,11 +81,12 @@ for (const srcFilePath of getAllFilesInDir('./extension', /\.ts$/)) {
81
81
const expectedPermissions : chrome . runtime . ManifestPermissions [ ] = [ 'alarms' , 'scripting' , 'storage' , 'tabs' , 'unlimitedStorage' ] ;
82
82
const expectedConsumerHostPermissions = [ 'https://*.google.com/*' , 'https://www.googleapis.com/*' , 'https://flowcrypt.com/*' ] ;
83
83
const 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' ] ) {
85
85
const manifest = JSON . parse ( readFileSync ( `./build/${ buildType } /manifest.json` ) . toString ( ) ) as chrome . runtime . Manifest ;
86
+ const isManifestV3Build = buildType . includes ( 'chrome' ) || buildType . includes ( 'firefox' ) ;
86
87
const expectedHostPermissions = buildType . includes ( 'consumer' ) ? expectedConsumerHostPermissions : expectedEnterpriseHostPermissions ;
87
88
for ( const expectedHostPermission of expectedHostPermissions ) {
88
- if ( ! manifest . host_permissions . includes ( expectedHostPermission ) ) {
89
+ if ( isManifestV3Build && ! manifest . host_permissions . includes ( expectedHostPermission ) ) {
89
90
console . error ( `Missing host permission '${ expectedHostPermission } ' in ${ buildType } /manifest.json` ) ;
90
91
errsFound ++ ;
91
92
}
@@ -98,9 +99,31 @@ for (const buildType of ['chrome-consumer', 'chrome-enterprise']) {
98
99
}
99
100
}
100
101
}
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` ) ;
104
127
errsFound ++ ;
105
128
}
106
129
}
0 commit comments