This is a bit of a mess.
The remove here is needed for linkedin, because clicking on the download button opens the download in a new tab.
The passwordEntered gets triggered for facebook, because the download happens in the same tab where the password was entered. This was added recently to fix the button blinking issue, as the onunload handler does not seem to get triggered (which is needed to call the iframe driver's next() function which would trigger passwordEntered. Originally, I replaced remove with passwordEntered which broke linkedin.
To properly fix this, we would need the following:
- attach fb-fetcher's
next() callback to something other than onunload
- -> we can remove the
passwordEntered here
- instead of always calling
remove, find a way to only trigger it when the download was opened in a new tab. We could hardcode this into the fetcher config or perhaps pass a parameter {closeTab: true} to ctx.redirectDownload(...)
- the
try ... catch above needs to stay for making the download-in-tab special case work together with fb's download-in-password-tab unless we want to do some (major?) refactoring here.
Originally posted by @msuess in #98
This is a bit of a mess.
The
removehere is needed for linkedin, because clicking on the download button opens the download in a new tab.The
passwordEnteredgets triggered for facebook, because the download happens in the same tab where the password was entered. This was added recently to fix the button blinking issue, as theonunloadhandler does not seem to get triggered (which is needed to call the iframe driver'snext()function which would triggerpasswordEntered. Originally, I replacedremovewithpasswordEnteredwhich broke linkedin.To properly fix this, we would need the following:
next()callback to something other thanonunloadpasswordEnteredhereremove, find a way to only trigger it when the download was opened in a new tab. We could hardcode this into the fetcher config or perhaps pass a parameter{closeTab: true}toctx.redirectDownload(...)try ... catchabove needs to stay for making the download-in-tab special case work together with fb's download-in-password-tab unless we want to do some (major?) refactoring here.Originally posted by @msuess in #98