Closed Bug 1606214 Opened 6 years ago Closed 6 years ago

browser.downloads.download throws exception

Categories

(Thunderbird :: Add-Ons: Extensions API, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1623704

People

(Reporter: Sebastian, Unassigned)

Details

User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.131 Safari/537.36

Steps to reproduce:

i try to update an add on that used the file picker:

var fp = Components.classes["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);

and re-implement it as a web-extension within a background.js:

var csv = 'foo,bar,baz'
var blob = new Blob([csv], {type: "text/csv;charset=utf-8"})
browser.downloads.download({url:URL.createObjectURL(blob),filename:"test.csv",saveAs:true});

Actual results:

Throws an exception:

Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIFilePicker.init]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: chrome://extensions/content/parent/ext-downloads.js :: createTarget :: line 698" data: no]

with the recent stable Thunderbrid 68.2.2.

Expected results:

the file picker dialog should pop up.

Status: UNCONFIRMED → RESOLVED
Closed: 6 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.