When giving the path to a FIFO or other special file qutebrowser would
completely hang, and has to be killed.
Tested:
- Asks for overwrite: file, symlink to file
- Saves in dir: dir, symlink to dir
- Aborts: block dev, char dev, fifo, socket, and a symlink to all of these
I thought I put this in here before, but apparently I did not. So here it is,
together with a new test to verify it. Other tests needed to be updated with a
mock for os.path.expandvars.
In function File.validate the try-except block has been re-written to
differentiate raised errors.
In function File.transform there was a check for validity of the file path that
is alraedy performed by File.validate under the same conditions. This check has
been removed.
When downloading a bunch (7 or 8) of files I noticed qutebrowser was using a lot
of CPU (>60%).
I did some looking, and in the `downloadProgress` callback qutebrower emits the
updated signal which causes everything to be updated. We don't really need this,
since _update_speed() calls it every 500ms anyway.
I tested by downloading 3 copies of the 1GB file [on this
page]( http://www.thinkbroadband.com/download.html ) qutebrowser consistently
pulls about 25% CPU on my system.
When removing this call, the system pulls about 17% CPU. Not a great amount, but
still significant enough to warrant a pull request ;-)
Some other notes:
- wget uses about 1.5%-2% for each process when downloading.
- When not doing any UI updates & speed calculations qutebrowser uses about 15%.
- Doing some quick profiling and strategic commenting seems to indicate there
isn't any other low hanging fruit to be improved on here.
This hopefully fixes this warning on Windows:
QWindowsWindow::setGeometryDp: Unable to set geometry 113x16+192+124 on
QWidgetWindow/'ProgressClassWindow'. Resulting geometry: 124x16+192+124
(frame: 8, 31, 8, 8, custom margin: 0, 0, 0, 0, minimum size: 0x0, maximum
size: 16777215x16777215).