]> GeneralSync Git - oss/thunderbird-experiments.git/commitdiff
authorDirk Steinmetz <ds@generalsync.com>
Fri, 11 Aug 2023 22:34:24 +0000 (00:34 +0200)
committerDirk Steinmetz <ds@generalsync.com>
Fri, 11 Aug 2023 22:34:24 +0000 (00:34 +0200)
This commit reintroduces OS.File into the osfile experiment on
older versions of Thunderbird, that do not yet include IOUtils.

experiments/osfile/parent.js

index 054b107481cee0ed50ceaa0356805781804c4f43..51c81f784d00044c3317fce20ad0dcd546a9a453 100644 (file)
@@ -1,8 +1,14 @@
 var ex_osfile = class extends ExtensionCommon.ExtensionAPI {
   getAPI(context) {
     return {
-      // our API is a true subset of IOUtils, so we can be lazy:
-      ex_osfile: IOUtils
+      ex_osfile: {
+        read: (
+          // Thunderbird 115 and later
+          globalThis.IOUtils
+          // Thunderbird 102 and earlier
+          || ChromeUtils.import("resource://gre/modules/osfile.jsm").OS.File
+        ).read
+      }
     };
   }
 };