diff --git a/doc/changelog.asciidoc b/doc/changelog.asciidoc index 448aa1be3..da814e2ce 100644 --- a/doc/changelog.asciidoc +++ b/doc/changelog.asciidoc @@ -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 ~~~~~~~ diff --git a/qutebrowser/browser/webengine/webenginedownloads.py b/qutebrowser/browser/webengine/webenginedownloads.py index fac04686a..ca18d7df8 100644 --- a/qutebrowser/browser/webengine/webenginedownloads.py +++ b/qutebrowser/browser/webengine/webenginedownloads.py @@ -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 diff --git a/tests/end2end/features/downloads.feature b/tests/end2end/features/downloads.feature index 26e3421a1..da5b0b5ae 100644 --- a/tests/end2end/features/downloads.feature +++ b/tests/end2end/features/downloads.feature @@ -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