Thunderbird/shim-code
Shim Code ins Add-ons
Shim Code can be used to write code that is both fulfilling the needs for the latest software / platform / programming language changes while remaining backwards compatible. It can also be used to support different host programs (such as Thunderbird / SeaMonkey / Postbox).
If your Add-on uses a chrome manifest file you can use variable content paths and filtering for platform id (essentially the program) app version (version number of program) and platform version (which version of Gecko, which essentially governs what version of JavaScript is supported)
content myAddon chrome://myAddon/content/shimEcmaOld/ application={3550f703-e582-4d05-9a08-453d09bdfdc6} content myAddon chrome://myAddon/content/shimEcma/ application={3550f703-e582-4d05-9a08-453d09bdfdc6} platformversion>=47
these are 2 physically distinct folders within the content path of your Add-on which can have duplicates of the same file, with different implementations.
Within your XUL file, you can now reference the path <script type="application/x-javascript" src="chrome://myAddon/content/myAddon-shim.js" />
and only the relevant Javascript file (shimEcmaOld/myAddon-shim.js or shimEcma/myAddon-shim.js) will be linked. This way you can keep your Add-on compatible without abandoning users of older versions.