Support retrying downloads with Qt 5.10

Fixes #2787
This commit is contained in:
Florian Bruhin 2018-02-07 11:19:41 +01:00
parent 5fd3943ebc
commit 054b92bbe8
3 changed files with 23 additions and 6 deletions

View File

@ -25,6 +25,7 @@ Added
- A new `qute://bindings` page, opened by `:bind`, shows all keybindings.
- `:session-load` has a new `--delete` flag which deletes the
session after loading it.
- QtWebEngine: Retrying downloads is now supported with Qt 5.10 or newer.
Changed
~~~~~~~

View File

@ -96,9 +96,15 @@ class DownloadItem(downloads.AbstractDownloadItem):
self._qt_item.cancel()
def retry(self):
# https://bugreports.qt.io/browse/QTBUG-56840
raise downloads.UnsupportedOperationError(
"Retrying downloads is unsupported with QtWebEngine")
state = self._qt_item.state()
assert state == QWebEngineDownloadItem.DownloadInterrupted, state
try:
self._qt_item.resume()
except AttributeError:
raise downloads.UnsupportedOperationError(
"Retrying downloads is unsupported with QtWebEngine on "
"Qt/PyQt < 5.10")
def _get_open_filename(self):
return self._filename

View File

@ -193,13 +193,23 @@ Feature: Downloading things from a website.
does-not-exist
does-not-exist
@qtwebkit_skip
Scenario: Retrying a failed download with QtWebEngine
@qtwebkit_skip @qt<5.10
Scenario: Retrying a failed download with QtWebEngine (Qt < 5.10)
When I open data/downloads/issue2298.html
And I run :click-element id download
And I wait for "Download error: *" in the log
And I run :download-retry
Then the error "Retrying downloads is unsupported with QtWebEngine" should be shown
Then the error "Retrying downloads is unsupported *" should be shown
@qtwebkit_skip @qt>=5.10
Scenario: Retrying a failed download with QtWebEngine (Qt >= 5.10)
When I open data/downloads/issue2298.html
And I run :click-element id download
And I wait for "Download error: *" in the log
And I run :download-retry
# For some reason it doesn't actually try again here, but let's hope it
# works e.g. on a connection loss, which we can't test automatically.
Then "Retrying downloads is unsupported *" should not be logged
Scenario: Retrying with count
When I run :download http://localhost:(port)/data/downloads/download.bin