From a8411d11ab770eedb4a445da7e6e7fd41e80c97a Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Thu, 1 Oct 2026 16:32:36 -0400 Subject: [PATCH] Ignore invalid display directories in FilePicker As of Firefox 140.17/153.4 (Bug 2068406), setting nsIFilePicker's displayDirectory to a directory that doesn't exist or isn't readable throws instead of being ignored. This broke callers that pass a saved path that may be stale (e.g., choosing a PDF/EPUB handler after the old app's folder was removed, or a missing Scaffold translators directory). (cherry picked from commit ae50d5258992b49d4eeac274e10996039b0bd909) --- chrome/content/zotero/modules/filePicker.mjs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/chrome/content/zotero/modules/filePicker.mjs b/chrome/content/zotero/modules/filePicker.mjs index 441d255766..b298750ebc 100644 --- a/chrome/content/zotero/modules/filePicker.mjs +++ b/chrome/content/zotero/modules/filePicker.mjs @@ -175,6 +175,13 @@ FilePicker.prototype.filterVideo = 0x200; if (prop == 'displayDirectory') { // Convert to nsIFile val = new lazy.FileUtils.File(val); + // As of Firefox 140.17/153.4, this throws if the directory doesn't exist or + // isn't readable. Ignore that and let the platform pick the initial directory. + try { + this._fp[prop] = val; + } + catch {} + return; } this._fp[prop] = val; },