Skip to content

Commit

Permalink
libunbound: Fix incompatibility with Thunderbird 115 (#364)
Browse files Browse the repository at this point in the history
  • Loading branch information
lieser committed Jun 3, 2023
1 parent e57dff8 commit fc2bf94
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
13 changes: 11 additions & 2 deletions experiments/libunbound.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@
var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
// @ts-expect-error
// eslint-disable-next-line no-var
var { OS } = ChromeUtils.import("resource://gre/modules/osfile.jsm");
var OS;
if (typeof PathUtils === "undefined") {
// TB < 115
({ OS } = ChromeUtils.import("resource://gre/modules/osfile.jsm"));
}

/**
* The result of the query.
Expand Down Expand Up @@ -119,7 +123,12 @@ class LibunboundWorker {
if (this.config.pathRelToProfileDir) {
path = this.config.path.
split(";").
map(e => { return OS.Path.join(OS.Constants.Path.profileDir, e); }).
map(e => {
if (OS) {
return OS.Path.join(OS.Constants.Path.profileDir, e);
}
return PathUtils.join(PathUtils.profileDir, e);
}).
join(";");
} else {
path = this.config.path;
Expand Down
9 changes: 8 additions & 1 deletion experiments/mozilla.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ declare module FileUtils {
function File(path: string): nsIFile;
}

/** JavaScript code module "resource://gre/modules/osfile.jsm" */
/** JavaScript code module "resource://gre/modules/osfile.jsm" (removed in TB >= 115) */
declare module OS {
declare module Path {
function join(path1: string, path2: string, ...paths: string[]): string;
Expand All @@ -174,6 +174,13 @@ declare module OS {
}
}

/** https://searchfox.org/mozilla-central/source/dom/chrome-webidl/PathUtils.webidl */
declare module PathUtils {
function join(path1: string, path2: string, ...paths: string[]): string;

const profileDir: string;
}

/** JavaScript code module "resource://gre/modules/Services.jsm" */
declare module Services {
const appinfo: nsIXULAppInfo;
Expand Down

0 comments on commit fc2bf94

Please sign in to comment.