From d62f41526e9481ba5a126d051e4c5ff13070466f Mon Sep 17 00:00:00 2001 From: Dirk Steinmetz Date: Sat, 12 Aug 2023 00:34:24 +0200 Subject: [PATCH] osfile: add backward-compatibility with TB 102 This commit reintroduces OS.File into the osfile experiment on older versions of Thunderbird, that do not yet include IOUtils. --- experiments/osfile/parent.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/experiments/osfile/parent.js b/experiments/osfile/parent.js index 054b107..51c81f7 100644 --- a/experiments/osfile/parent.js +++ b/experiments/osfile/parent.js @@ -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 + } }; } }; -- 2.43.0