Bug 1623704 - Fix saveAs option of browser.downloads.download on Thunderbird. r=zombie

Differential Revision: https://phabricator.services.mozilla.com/D70470

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Geoff Lankow 2020-04-15 10:43:18 +00:00
parent 2b97c80ec2
commit c7a24ee34a

View File

@ -741,7 +741,14 @@ this.downloads = class extends ExtensionAPI {
return target; return target;
} }
const window = Services.wm.getMostRecentWindow("navigator:browser"); if (!("windowTracker" in global)) {
return target;
}
// Use windowTracker to find a window, rather than Services.wm,
// so that this doesn't break where navigator:browser isn't the
// main window (e.g. Thunderbird).
const window = global.windowTracker.getTopWindow().window;
const basename = OS.Path.basename(target); const basename = OS.Path.basename(target);
const ext = basename.match(/\.([^.]+)$/); const ext = basename.match(/\.([^.]+)$/);