Commit b4b59b7 1 parent 86397b2 commit b4b59b7 Copy full SHA for b4b59b7
File tree 2 files changed +21
-4
lines changed
2 files changed +21
-4
lines changed Original file line number Diff line number Diff line change 3
3
4
4
"use strict" ;
5
5
6
- const { ExtensionCommon} = ChromeUtils . import ( "resource://gre/modules/ExtensionCommon.jsm" ) ;
7
6
const Services = globalThis . Services || ChromeUtils . import ( "resource://gre/modules/Services.jsm" ) . Services ;
8
7
const [ majorVersion ] = Services . appinfo . platformVersion . split ( "." , 1 ) ;
9
8
10
- // eslint-disable-next-line no-var
9
+ /**
10
+ * Dynamically imports a module based on the Thunderbird version.
11
+ *
12
+ * For Thunderbird 136 and above, it imports the ESM version of the module.
13
+ * For older versions, it imports the JSM version.
14
+ *
15
+ * @param {string } name - The name of the module to import.
16
+ * @returns {* } The exported module object.
17
+ */
18
+ function importModule ( name ) {
19
+ const moduleSubdir = name === "ExtensionSupport" ? "" : "gre" ;
20
+ return majorVersion >= 136
21
+ ? ChromeUtils . importESModule ( "resource://" + moduleSubdir + "/modules/" + name + ".sys.mjs" ) [ name ]
22
+ : ChromeUtils . import ( "resource://" + moduleSubdir + "/modules/" + name + ".jsm" ) [ name ] ;
23
+ }
24
+
25
+ const ExtensionCommon = importModule ( "ExtensionCommon" ) ;
26
+
27
+ // eslint-disable-next-line no-var, vars-on-top
11
28
var displayReceivedHeader = class extends ExtensionCommon . ExtensionAPI {
12
29
getAPI ( context ) {
13
30
function getDocumentByTabIndex ( windowId , tabIndex ) {
Original file line number Diff line number Diff line change 4
4
"gecko" : {
5
5
"id" : " received@alexander.moisseev" ,
6
6
"strict_min_version" : " 78.0" ,
7
- "strict_max_version" : " 129 .*"
7
+ "strict_max_version" : " 136 .*"
8
8
}
9
9
},
10
10
"name" : " Received" ,
11
11
"description" : " Displays the \" Received\" header parsed with a regular expression." ,
12
- "version" : " 2.6.0 " ,
12
+ "version" : " 2.6.1 " ,
13
13
"author" : " Alexander Moisseev (moiseev@mezonplus.ru)" ,
14
14
"homepage_url" : " https://github.com/moisseev/received" ,
15
15
"icons" : {
You can’t perform that action at this time.
0 commit comments