From 28e4a4a348207ca9f398dc3faabffc24b5178820 Mon Sep 17 00:00:00 2001 From: Ximi1970 Date: Sat, 8 Feb 2025 16:23:53 +0100 Subject: [PATCH] Fix API changes again --- webext/js/windowEvent.js | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/webext/js/windowEvent.js b/webext/js/windowEvent.js index e2393a2..d56b8a2 100644 --- a/webext/js/windowEvent.js +++ b/webext/js/windowEvent.js @@ -5,15 +5,32 @@ // Using a closure to not leak anything but the API to the outside world. (function (exports) { + var ExtensionCommon; + var ExtensionSupport; + if (typeof ChromeUtils.import === "function") { + ExtensionCommon = ChromeUtils.import("resource://gre/modules/ExtensionCommon.jsm").ExtensionCommon; + ExtensionSupport = ChromeUtils.import("resource:///modules/ExtensionSupport.jsm").ExtensionSupport; + } + else + { + // TB136+ + ExtensionCommon = ChromeUtils.importESModule("resource://gre/modules/ExtensionCommon.sys.mjs").ExtensionCommon; + ExtensionSupport = ChromeUtils.importESModule("resource:///modules/ExtensionSupport.sys.mjs").ExtensionSupport; + } + +/* + The old ways... + // Get various parts of the WebExtension framework that we need. var { ExtensionCommon } = ChromeUtils.import("resource://gre/modules/ExtensionCommon.jsm"); // You probably already know what this does. // var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm"); +// var Services = globalThis.Services || ChromeUtils.import("resource://gre/modules/Services.jsm").Services; // A helpful class for listening to windows opening and closing. var { ExtensionSupport } = ChromeUtils.import("resource:///modules/ExtensionSupport.jsm"); - +*/ /** * This object is just what we're using to listen for toolbar clicks. The implementation