MAR download stalls when about dialog is opened
In #28885 (moved), Georg encountered a bug that causes the browser update to stall. Here are the steps that Kathy and I used to reproduce it:
- Start a clean copy of Tor Browser 8.5a5 on a 64-bit Linux system.
- Set
app.update.auto
tofalse
andapp.update.log
totrue
. - Open the about dialog and click "Update to 8.5a6" to begin downloading the MAR file.
- Quickly close and reopen the about dialog. The download will stall and not make any further progress.
The following was logged to the browser console: AUS:SVC UpdateService:downloadUpdate - no support for downloading more than one update at a time
This problem is fallout from the fact that when the about dialog is opened, the browser cancels the download and starts a new one. Here is the code from the startDownload()
function inside browser/base/content/aboutDialog-appUpdater.js
:
...
this.aus.pauseDownload();
let state = this.aus.downloadUpdate(this.update, false);
...
Looking at the code in toolkit/mozapps/update/nsUpdateService.js
, we see that pauseDownload()
cancels the first download via nsIRequest.cancel()
, which does not take effect immediately. Cleanup of the Downloader
occurs inside an onStopRequest()
listener and that entire process is asynchronous.
One possible fix is to not pause and restart the download when the about dialog is opened. Kathy and I do not yet know if that would introduce other problems.