When using browser.downloads.download, Firefox throws an exception in console when the file finishes downloading.
In the background js file, I got this. Note: msg.doc is passed from the content_script, and it contains the inner HTML from the body tag, which is what I want to download.
var doc = msg.doc;
var blob = new Blob([doc], {type: "text/html"});
var url = URL.createObjectURL(blob);
var download = browser.downloads.download({
url: url,
filename: "test.html",
saveAs: true
});
And this is what Firefox throws:
[Exception... "Component returned failure code: 0x80070057 (NS_ERROR_ILLEGAL_VALUE) [nsIAnnotationService.setPageAnnotation]" nsresult: "0x80070057 (NS_ERROR_ILLEGAL_VALUE)" location: "JS frame :: resource:///modules/DownloadsCommon.jsm :: onDownloadChanged :: line 764" data:no]
As mentioned, the file is downloaded succesfully. This error is shown in the console after the entire process.
User contributions licensed under CC BY-SA 3.0