From 9888e0befcfd1f0daa770dbad505ee460a375389 Mon Sep 17 00:00:00 2001 From: Emiliano Heyns Date: Mon, 20 May 2024 15:08:58 +0200 Subject: [PATCH 1/2] nobody actually uses this --- setup/shims/path.js | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/setup/shims/path.js b/setup/shims/path.js index 16245f41a9..bae85cc205 100644 --- a/setup/shims/path.js +++ b/setup/shims/path.js @@ -1,20 +1,7 @@ export function join(path, ...args) { if (!args.length) return path - - if (typeof OS !== 'undefined') return OS.Path.join(...arguments) - - const platformSlash = Services.appinfo.OS == 'WINNT' ? '\\' : '/' - try { - if (args.length == 1 && args[0].includes(platformSlash)) return PathUtils.joinRelative(path, ...args) - return PathUtils.join(path, ...args); - } - catch (e) { - if (e.message.includes('NS_ERROR_FILE_UNRECOGNIZED_PATH')) { - Cu.reportError("WARNING: " + e.message + " -- update for IOUtils") - return [path, ...args].join(platformSlash); - } - throw e - } + var platformSlash = Services.appinfo.OS == 'WINNT' ? '\\' : '/'; + return [path, ...args].join(platformSlash); } export function dirname(filename) { From f07bcbf0a7a1b95c97ad05cc491691b8ca94658d Mon Sep 17 00:00:00 2001 From: Emiliano Heyns Date: Mon, 20 May 2024 15:24:41 +0200 Subject: [PATCH 2/2] only display race message when race is lost --- content/translators.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/content/translators.ts b/content/translators.ts index 76ea18a469..4d97026e43 100644 --- a/content/translators.ts +++ b/content/translators.ts @@ -6,14 +6,19 @@ const $OS = is7 ? Shim : OS import merge from 'lodash.merge' async function guard(run: Promise): Promise { - const timeout = async () => { + let timeout = true + + const delay = async () => { await Zotero.Promise.delay(20000) - log.debug('installing translators: raced to timeout!') - throw { timeout: true, message: 'timeout' } // eslint-disable-line no-throw-literal + if (timeout) { + log.debug('installing translators: raced to timeout!') + throw { timeout: true, message: 'timeout' } // eslint-disable-line no-throw-literal + } } try { - await Promise.race([run, timeout()]) + await Promise.race([run, delay()]) + timeout = false log.debug('installing translators: guard OK') return true }