Yes it asks you normally outside of WebExtensions. However, if that code is part of the settings menu in a WebExtension, then it just displays the output without asking to save or open. Here’s what I did to test:
That is a typo. It’s suppose to be target = '_blank', but it doesn’t matter though since Firefox displays the text file anyway in the same tab.
Using something like FileSaver.js, the file could not download under WebExtensions, while normally it works.
I have a feeling that it might be a bug in the WebExtension sandbox since the protocol for the options menu is moz-extension://{extension ID here}/settings.html. I’ll try out the zip file later but my workaround so far is to create a link tag saying “Right click to save as”. It’s not ideal but at least it won’t be confusing to the user.
For me, it gets stuck loading and doesn’t display anything. Did you open the page directly or open the preference page from the test extension? It should have the prefix “moz-extension://” in the URL bar.
Finally I replicate your code with the @NilkasG’s options and it doesn’t work, like you said “it gets stuck loading…” I don’t know, probably WebExtension has a bug
I have actually noticed this behavior months ago when I developed this extension. It did however only happen on one of my machines and none of the others, which made it difficult to debug. Over time, more and more of my machines have been experiencing this behavior though.