|
1 |
| -const { ExtensionCommon } = ChromeUtils.importESModule("resource://gre/modules/ExtensionCommon.sys.mjs"); |
2 |
| - |
3 |
| -const { ExtensionSupport } = function() { |
4 |
| - for (const module of [ |
5 |
| - "resource:///modules/ExtensionSupport.sys.mjs", // v128 |
6 |
| - "resource:///modules/ExtensionSupport.jsm", // v115.10 |
7 |
| - ]) { |
8 |
| - try { |
9 |
| - const m = ChromeUtils.importESModule(module); |
10 |
| - console.log("ThreadPaneColumns", module); |
11 |
| - return m; |
12 |
| - } catch (ex) { |
13 |
| - console.log("ThreadPaneColumns", module, ex); |
14 |
| - } |
15 |
| - } |
16 |
| - return undefined; |
17 |
| -}(); |
| 1 | +function loadSystemModule(newPath, oldPath) { |
| 2 | + const errors = [] |
| 3 | + try { |
| 4 | + return ChromeUtils.importESModule(newPath); |
| 5 | + } catch (ex) { |
| 6 | + errors.push(ex); |
| 7 | + } |
| 8 | + try { |
| 9 | + return ChromeUtils.import(oldPath); |
| 10 | + } catch (ex) { |
| 11 | + errors.push(ex); |
| 12 | + } |
| 13 | + throw new Error(`Could not load system module: ${errors}`); |
| 14 | +} |
18 | 15 |
|
| 16 | +const { ExtensionSupport } = loadSystemModule("resource:///modules/ExtensionSupport.sys.mjs", "resource:///modules/ExtensionSupport.jsm"); |
| 17 | +const { ExtensionCommon } = loadSystemModule("resource://gre/modules/ExtensionCommon.sys.mjs", "resource://gre/modules/ExtensionCommon.jsm"); |
19 | 18 | const { ThreadPaneColumns } = function() {
|
20 |
| - for (const module of [ |
21 |
| - "chrome://messenger/content/ThreadPaneColumns.mjs", // v128 |
22 |
| - "chrome://messenger/content/thread-pane-columns.mjs", // v115.10 |
23 |
| - ]) { |
24 |
| - try { |
25 |
| - const m = ChromeUtils.importESModule(module); |
26 |
| - console.log("ThreadPaneColumns", module); |
27 |
| - return m; |
28 |
| - } catch (ex) { |
29 |
| - console.log("ThreadPaneColumns", module, ex); |
30 |
| - } |
31 |
| - } |
32 |
| - return undefined; |
| 19 | + const errors = [] |
| 20 | + for (const module of [ |
| 21 | + "chrome://messenger/content/ThreadPaneColumns.mjs", // v128 |
| 22 | + "chrome://messenger/content/thread-pane-columns.mjs", // v115.10 |
| 23 | + ]) { |
| 24 | + try { |
| 25 | + return ChromeUtils.importESModule(module); |
| 26 | + } catch (ex) { |
| 27 | + errors.push(ex); |
| 28 | + } |
| 29 | + } |
| 30 | + throw new Error(`Could not load system module: ${errors}`); |
33 | 31 | }();
|
34 | 32 |
|
35 | 33 |
|
|
0 commit comments