diff options
author | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2016-02-05 13:27:14 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2016-02-10 14:49:01 +0000 |
commit | 9db27320eda70ec4e4948ae0853dd3f2dd08912b (patch) | |
tree | 78ac95011fc1ac4929439573e931eece166ad9a3 /src/webenginewidgets | |
parent | 776442f2117c4b2d6dac75ab56b42bd82e2ce6d0 (diff) |
Fix double LoadFinished on URL errors
RenderFrameDeleted was called before DidFinishLoad, which meant
m_loadingErrorFrameList was empty and wouldn't detect the page loaded
was an error page. Instead this patch relies on the chromium error-page
url which we already asserted.
Additonally we delay emitting the loadFinished signal until the error
page is also done loading, since the error-page can be considered part
of the load, and we otherwise have a race condition on toPlainText.
Finally we were not getting error-pages when blocking requests because
we reported them as aborted them instead of blocked.
Change-Id: I945eb838b7f080d4e146f18354e8986e1b88b5cd
Task-number: QTBUG-50752
Reviewed-by: Michael BrĂ¼ning <michael.bruning@theqtcompany.com>
Diffstat (limited to 'src/webenginewidgets')
-rw-r--r-- | src/webenginewidgets/api/qwebenginepage.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/webenginewidgets/api/qwebenginepage.cpp b/src/webenginewidgets/api/qwebenginepage.cpp index b1bf33067..458ddae5f 100644 --- a/src/webenginewidgets/api/qwebenginepage.cpp +++ b/src/webenginewidgets/api/qwebenginepage.cpp @@ -200,13 +200,21 @@ void QWebEnginePagePrivate::loadFinished(bool success, const QUrl &url, bool isE Q_UNUSED(errorCode); Q_UNUSED(errorDescription); - if (isErrorPage) + if (isErrorPage) { + Q_ASSERT(settings->testAttribute(QWebEngineSettings::ErrorPageEnabled)); + Q_ASSERT(success); + Q_EMIT q->loadFinished(false); return; + } isLoading = false; if (success) explicitUrl = QUrl(); - Q_EMIT q->loadFinished(success); + // Delay notifying failure until the error-page is done loading. + // Error-pages are not loaded on failures due to abort. + if (success || errorCode == -3 /* ERR_ABORTED*/ || !settings->testAttribute(QWebEngineSettings::ErrorPageEnabled)) { + Q_EMIT q->loadFinished(success); + } updateNavigationActions(); } |