buggyj / savetiddlers

108 stars 14 forks source link

Register chrome.downloads.onDeterminingFilename.addListener to get chance to specify filename. #54

Open PassionZhao opened 1 year ago

PassionZhao commented 1 year ago

If there are some existing extensions using the chrome.downloads.onDeterminingFilename API, then savetiddlers can not name it's downloads at all.

Register chrome.downloads.onDeterminingFilename.addListener in this extension to get chance to specify filename.

buggyj commented 1 year ago

Hi @PassionZhao, thanks for the pull request. I do have some doubts about this. The chrome api documention says this:

"If more than one extension overrides the filename, then the last extension installed whose listener passes a suggestion object to suggest wins. In order to avoid confusion regarding which extension will win, users should not install extensions that may conflict."

It is not obvious to me that confusion over filename renaming is resolvable, I see that you are registering and removing the event listener dynamically, and this may work now, but in general, event listeners can be can invoked in any order.

PassionZhao commented 1 year ago

Hi buggyj,

Thanks for sharing your thoughts, I agree this patch is only required when we have installed other conflict extensions (iMacros in my case), meanwhile this patch makes savetiddlers itself become a potential conflict to others. I'll keep it in downstream branch.

buggyj commented 1 year ago

It appears that 'onDeterminingFilename' is still not support on firefox

https://bugzilla.mozilla.org/show_bug.cgi?id=1245652