Ignore invalid display directories in FilePicker
Some checks are pending
CI / Test (Windows arm64) (push) Blocked by required conditions
CI / Test (Windows x64) (push) Blocked by required conditions
CI / Utilities Tests (push) Waiting to run
CI / Build, Upload (push) Waiting to run
CI / Detect changes (push) Waiting to run
CI / Test () (push) Blocked by required conditions
CI / Test (macOS NFS) (push) Blocked by required conditions

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).
This commit is contained in:
Dan Stillman 2026-10-01 16:32:36 -04:00
parent 4118f47bc3
commit ae50d52589

View file

@ -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;
},