Make download progress be correctly displayed when the browser cannot re...

...port total size of files (as is the case in compressed downloads), but writing full size to the generated js.

I am not really familiar with python code, so I hope the way I wrote it makes any sense.