summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKari Oikarinen <kari.oikarinen@qt.io>2019-02-20 12:39:08 +0200
committerKari Oikarinen <kari.oikarinen@qt.io>2019-02-20 12:39:08 +0200
commit0cdb13d0b66a2489fe2343ce2eaa536a3eae7adb (patch)
tree28f20cce7fed95aef697be6457b552e618163f8a
parentcfaa49a9e5ec5e01c57a5621702c881ae07ab515 (diff)
parent7537526093c92e89672d1e952a9baceecaa91730 (diff)
Merge 5.12 into 5.12.2
-rw-r--r--src/core/browser_accessibility_manager_qt.cpp6
-rw-r--r--src/core/browser_accessibility_manager_qt.h3
-rw-r--r--src/core/browser_accessibility_qt.cpp3
-rw-r--r--src/webengine/api/qquickwebenginedownloaditem.cpp26
-rw-r--r--src/webengine/api/qquickwebenginedownloaditem_p_p.h1
-rw-r--r--src/webengine/api/qquickwebengineprofile.cpp28
-rw-r--r--src/webengine/api/qquickwebengineprofile_p.h4
-rw-r--r--src/webenginewidgets/api/qwebenginedownloaditem.cpp23
-rw-r--r--src/webenginewidgets/api/qwebenginedownloaditem_p.h4
-rw-r--r--src/webenginewidgets/api/qwebengineprofile.cpp30
-rw-r--r--src/webenginewidgets/api/qwebengineprofile_p.h2
-rw-r--r--tests/auto/quick/publicapi/tst_publicapi.cpp46
-rw-r--r--tests/auto/widgets/qwebenginedownloaditem/tst_qwebenginedownloaditem.cpp32
13 files changed, 165 insertions, 43 deletions
diff --git a/src/core/browser_accessibility_manager_qt.cpp b/src/core/browser_accessibility_manager_qt.cpp
index 644a0a9f..7fb1386c 100644
--- a/src/core/browser_accessibility_manager_qt.cpp
+++ b/src/core/browser_accessibility_manager_qt.cpp
@@ -76,6 +76,12 @@ BrowserAccessibilityManagerQt::BrowserAccessibilityManagerQt(
, m_parentObject(parentObject)
{
Initialize(initialTree);
+ m_valid = true; // BrowserAccessibilityQt can start using the AXTree
+}
+
+BrowserAccessibilityManagerQt::~BrowserAccessibilityManagerQt()
+{
+ m_valid = false; // BrowserAccessibilityQt should stop using the AXTree
}
QAccessibleInterface *BrowserAccessibilityManagerQt::rootParentAccessible()
diff --git a/src/core/browser_accessibility_manager_qt.h b/src/core/browser_accessibility_manager_qt.h
index a2d6db45..87c8875b 100644
--- a/src/core/browser_accessibility_manager_qt.h
+++ b/src/core/browser_accessibility_manager_qt.h
@@ -57,14 +57,17 @@ public:
const ui::AXTreeUpdate& initialTree,
BrowserAccessibilityDelegate* delegate,
BrowserAccessibilityFactory* factory = new BrowserAccessibilityFactory());
+ ~BrowserAccessibilityManagerQt() override;
void FireBlinkEvent(ax::mojom::Event event_type,
BrowserAccessibility* node) override;
QAccessibleInterface *rootParentAccessible();
+ bool isValid() const { return m_valid; }
private:
Q_DISABLE_COPY(BrowserAccessibilityManagerQt)
QObject *m_parentObject;
+ bool m_valid = false;
};
}
diff --git a/src/core/browser_accessibility_qt.cpp b/src/core/browser_accessibility_qt.cpp
index a672ccc0..29fbbc54 100644
--- a/src/core/browser_accessibility_qt.cpp
+++ b/src/core/browser_accessibility_qt.cpp
@@ -68,7 +68,8 @@ BrowserAccessibilityQt::BrowserAccessibilityQt()
bool BrowserAccessibilityQt::isValid() const
{
- return true;
+ auto managerQt = static_cast<BrowserAccessibilityManagerQt *>(manager_);
+ return managerQt && managerQt->isValid();
}
QObject *BrowserAccessibilityQt::object() const
diff --git a/src/webengine/api/qquickwebenginedownloaditem.cpp b/src/webengine/api/qquickwebenginedownloaditem.cpp
index a80f163d..981d1163 100644
--- a/src/webengine/api/qquickwebenginedownloaditem.cpp
+++ b/src/webengine/api/qquickwebenginedownloaditem.cpp
@@ -185,10 +185,8 @@ void QQuickWebEngineDownloadItemPrivate::update(const ProfileAdapterClient::Down
Q_EMIT q->totalBytesChanged();
}
- if (info.done != downloadFinished) {
- downloadFinished = info.done;
- Q_EMIT q->isFinishedChanged();
- }
+ if (info.done)
+ setFinished();
if (info.paused != downloadPaused) {
downloadPaused = info.paused;
@@ -206,6 +204,17 @@ void QQuickWebEngineDownloadItemPrivate::updateState(QQuickWebEngineDownloadItem
}
}
+void QQuickWebEngineDownloadItemPrivate::setFinished()
+{
+ Q_Q(QQuickWebEngineDownloadItem);
+
+ if (downloadFinished)
+ return;
+
+ downloadFinished = true;
+ Q_EMIT q->isFinishedChanged();
+}
+
/*!
\qmlmethod void WebEngineDownloadItem::accept()
@@ -255,6 +264,7 @@ void QQuickWebEngineDownloadItem::cancel()
return;
d->updateState(QQuickWebEngineDownloadItem::DownloadCancelled);
+ d->setFinished();
// We directly cancel the download if the user cancels before
// it even started, so no need to notify the profile here.
@@ -593,12 +603,14 @@ bool QQuickWebEngineDownloadItem::isPaused() const
}
/*!
- \qmlproperty bool WebEngineDownloadItem::view
+ \qmlproperty WebEngineView WebEngineDownloadItem::view
\readonly
\since QtWebEngine 1.8
Returns the view the download was requested on. If the download was not triggered by content in a view,
\c nullptr is returned.
+
+ \sa WebEngineView
*/
QQuickWebEngineView *QQuickWebEngineDownloadItem::view() const
{
@@ -615,8 +627,8 @@ QQuickWebEngineDownloadItem::QQuickWebEngineDownloadItem(QQuickWebEngineDownload
QQuickWebEngineDownloadItem::~QQuickWebEngineDownloadItem()
{
- if (d_ptr->profile)
- d_ptr->profile->d_ptr->profileAdapter()->removeDownload(d_ptr->downloadId);
+ if (!isFinished())
+ cancel();
}
QT_END_NAMESPACE
diff --git a/src/webengine/api/qquickwebenginedownloaditem_p_p.h b/src/webengine/api/qquickwebenginedownloaditem_p_p.h
index 4b89335b..f444c04a 100644
--- a/src/webengine/api/qquickwebenginedownloaditem_p_p.h
+++ b/src/webengine/api/qquickwebenginedownloaditem_p_p.h
@@ -85,6 +85,7 @@ public:
void update(const QtWebEngineCore::ProfileAdapterClient::DownloadItemInfo &info);
void updateState(QQuickWebEngineDownloadItem::DownloadState newState);
+ void setFinished();
};
QT_END_NAMESPACE
diff --git a/src/webengine/api/qquickwebengineprofile.cpp b/src/webengine/api/qquickwebengineprofile.cpp
index ddc71602..26fcf28f 100644
--- a/src/webengine/api/qquickwebengineprofile.cpp
+++ b/src/webengine/api/qquickwebengineprofile.cpp
@@ -175,13 +175,6 @@ QQuickWebEngineProfilePrivate::~QQuickWebEngineProfilePrivate()
m_profileAdapter->removeClient(this);
}
- for (QQuickWebEngineDownloadItem *download : qAsConst(m_ongoingDownloads)) {
- if (download)
- download->cancel();
- }
-
- m_ongoingDownloads.clear();
-
if (m_profileAdapter != QtWebEngineCore::ProfileAdapter::defaultProfileAdapter())
delete m_profileAdapter;
}
@@ -215,6 +208,23 @@ void QQuickWebEngineProfilePrivate::cancelDownload(quint32 downloadId)
void QQuickWebEngineProfilePrivate::downloadDestroyed(quint32 downloadId)
{
m_ongoingDownloads.remove(downloadId);
+ if (m_profileAdapter)
+ m_profileAdapter->removeDownload(downloadId);
+}
+
+void QQuickWebEngineProfilePrivate::cleanDownloads()
+{
+ for (auto download : m_ongoingDownloads.values()) {
+ if (!download)
+ continue;
+
+ if (!download->isFinished())
+ download->cancel();
+
+ if (m_profileAdapter)
+ m_profileAdapter->removeDownload(download->id());
+ }
+ m_ongoingDownloads.clear();
}
void QQuickWebEngineProfilePrivate::downloadRequested(DownloadItemInfo &info)
@@ -239,6 +249,7 @@ void QQuickWebEngineProfilePrivate::downloadRequested(DownloadItemInfo &info)
QQuickWebEngineDownloadItem *download = new QQuickWebEngineDownloadItem(itemPrivate, q);
m_ongoingDownloads.insert(info.id, download);
+ QObject::connect(download, &QQuickWebEngineDownloadItem::destroyed, q, [id = info.id, this] () { downloadDestroyed(id); });
QQmlEngine::setObjectOwnership(download, QQmlEngine::JavaScriptOwnership);
Q_EMIT q->downloadRequested(download);
@@ -252,7 +263,6 @@ void QQuickWebEngineProfilePrivate::downloadRequested(DownloadItemInfo &info)
if (state == QQuickWebEngineDownloadItem::DownloadRequested) {
// Delete unaccepted downloads.
info.accepted = false;
- m_ongoingDownloads.remove(info.id);
delete download;
}
}
@@ -275,7 +285,6 @@ void QQuickWebEngineProfilePrivate::downloadUpdated(const DownloadItemInfo &info
if (info.state != ProfileAdapterClient::DownloadInProgress) {
Q_EMIT q->downloadFinished(download);
- m_ongoingDownloads.remove(info.id);
}
}
@@ -380,6 +389,7 @@ QQuickWebEngineProfile::QQuickWebEngineProfile(QQuickWebEngineProfilePrivate *pr
*/
QQuickWebEngineProfile::~QQuickWebEngineProfile()
{
+ d_ptr->cleanDownloads();
}
/*!
diff --git a/src/webengine/api/qquickwebengineprofile_p.h b/src/webengine/api/qquickwebengineprofile_p.h
index d31ded0e..2b1a5b13 100644
--- a/src/webengine/api/qquickwebengineprofile_p.h
+++ b/src/webengine/api/qquickwebengineprofile_p.h
@@ -53,7 +53,7 @@
#include "profile_adapter_client.h"
#include "profile_adapter.h"
-#include "qquickwebengineprofile_p.h"
+#include "qquickwebengineprofile.h"
#include <QExplicitlySharedDataPointer>
#include <QMap>
@@ -80,6 +80,8 @@ public:
void cancelDownload(quint32 downloadId);
void downloadDestroyed(quint32 downloadId);
+ void cleanDownloads();
+
void downloadRequested(DownloadItemInfo &info) override;
void downloadUpdated(const DownloadItemInfo &info) override;
diff --git a/src/webenginewidgets/api/qwebenginedownloaditem.cpp b/src/webenginewidgets/api/qwebenginedownloaditem.cpp
index 55d4fcca..deb92bfd 100644
--- a/src/webenginewidgets/api/qwebenginedownloaditem.cpp
+++ b/src/webenginewidgets/api/qwebenginedownloaditem.cpp
@@ -197,11 +197,8 @@ void QWebEngineDownloadItemPrivate::update(const ProfileAdapterClient::DownloadI
Q_EMIT q->downloadProgress(receivedBytes, totalBytes);
}
- if (info.done != downloadFinished) {
- downloadFinished = info.done;
- if (downloadFinished)
- Q_EMIT q->finished();
- }
+ if (info.done)
+ setFinished();
if (downloadPaused != info.paused) {
downloadPaused = info.paused;
@@ -209,6 +206,15 @@ void QWebEngineDownloadItemPrivate::update(const ProfileAdapterClient::DownloadI
}
}
+void QWebEngineDownloadItemPrivate::setFinished()
+{
+ if (downloadFinished)
+ return;
+
+ downloadFinished = true;
+ Q_EMIT q_ptr->finished();
+}
+
/*!
Accepts the current download request, which will start the download.
@@ -262,6 +268,7 @@ void QWebEngineDownloadItem::cancel()
} else {
d->downloadState = QWebEngineDownloadItem::DownloadCancelled;
Q_EMIT stateChanged(d->downloadState);
+ d->setFinished();
}
}
@@ -653,8 +660,10 @@ QWebEngineDownloadItem::QWebEngineDownloadItem(QWebEngineDownloadItemPrivate *p,
*/
QWebEngineDownloadItem::~QWebEngineDownloadItem()
{
- if (auto profileAdapter = d_ptr->profile->profileAdapter())
- profileAdapter->removeDownload(d_ptr->downloadId);
+ // MEMO Items are owned by profile by default and will be destroyed on profile's destruction
+ // It's not safe to access profile in that case, so we rely on profile to clean up items
+ if (!isFinished())
+ cancel();
}
QT_END_NAMESPACE
diff --git a/src/webenginewidgets/api/qwebenginedownloaditem_p.h b/src/webenginewidgets/api/qwebenginedownloaditem_p.h
index bdcda5be..b3bc8a3f 100644
--- a/src/webenginewidgets/api/qwebenginedownloaditem_p.h
+++ b/src/webenginewidgets/api/qwebenginedownloaditem_p.h
@@ -53,7 +53,7 @@
#include "qtwebenginewidgetsglobal.h"
-#include "qwebenginedownloaditem_p.h"
+#include "qwebenginedownloaditem.h"
#include "qwebengineprofile_p.h"
#include <QString>
@@ -84,6 +84,8 @@ public:
QWebEnginePage *page;
void update(const QtWebEngineCore::ProfileAdapterClient::DownloadItemInfo &info);
+
+ void setFinished();
};
QT_END_NAMESPACE
diff --git a/src/webenginewidgets/api/qwebengineprofile.cpp b/src/webenginewidgets/api/qwebengineprofile.cpp
index 03ce5e0b..0d12fdae 100644
--- a/src/webenginewidgets/api/qwebengineprofile.cpp
+++ b/src/webenginewidgets/api/qwebengineprofile.cpp
@@ -175,13 +175,6 @@ QWebEngineProfilePrivate::~QWebEngineProfilePrivate()
m_profileAdapter->removeClient(this);
}
- for (QWebEngineDownloadItem *download : qAsConst(m_ongoingDownloads)) {
- if (download)
- download->cancel();
- }
-
- m_ongoingDownloads.clear();
-
if (m_profileAdapter != QtWebEngineCore::ProfileAdapter::defaultProfileAdapter())
delete m_profileAdapter;
@@ -196,6 +189,23 @@ ProfileAdapter* QWebEngineProfilePrivate::profileAdapter() const
void QWebEngineProfilePrivate::downloadDestroyed(quint32 downloadId)
{
m_ongoingDownloads.remove(downloadId);
+ if (m_profileAdapter)
+ m_profileAdapter->removeDownload(downloadId);
+}
+
+void QWebEngineProfilePrivate::cleanDownloads()
+{
+ for (auto download : m_ongoingDownloads.values()) {
+ if (!download)
+ continue;
+
+ if (!download->isFinished())
+ download->cancel();
+
+ if (m_profileAdapter)
+ m_profileAdapter->removeDownload(download->id());
+ }
+ m_ongoingDownloads.clear();
}
void QWebEngineProfilePrivate::downloadRequested(DownloadItemInfo &info)
@@ -219,6 +229,7 @@ void QWebEngineProfilePrivate::downloadRequested(DownloadItemInfo &info)
QWebEngineDownloadItem *download = new QWebEngineDownloadItem(itemPrivate, q);
m_ongoingDownloads.insert(info.id, download);
+ QObject::connect(download, &QWebEngineDownloadItem::destroyed, q, [id = info.id, this] () { downloadDestroyed(id); });
Q_EMIT q->downloadRequested(download);
@@ -232,7 +243,6 @@ void QWebEngineProfilePrivate::downloadRequested(DownloadItemInfo &info)
if (state == QWebEngineDownloadItem::DownloadRequested) {
// Delete unaccepted downloads.
info.accepted = false;
- m_ongoingDownloads.remove(info.id);
delete download;
}
}
@@ -250,9 +260,6 @@ void QWebEngineProfilePrivate::downloadUpdated(const DownloadItemInfo &info)
}
download->d_func()->update(info);
-
- if (download->isFinished())
- m_ongoingDownloads.remove(info.id);
}
/*!
@@ -301,6 +308,7 @@ QWebEngineProfile::QWebEngineProfile(QWebEngineProfilePrivate *privatePtr, QObje
*/
QWebEngineProfile::~QWebEngineProfile()
{
+ d_ptr->cleanDownloads();
}
/*!
diff --git a/src/webenginewidgets/api/qwebengineprofile_p.h b/src/webenginewidgets/api/qwebengineprofile_p.h
index 9ff8df84..4a76f457 100644
--- a/src/webenginewidgets/api/qwebengineprofile_p.h
+++ b/src/webenginewidgets/api/qwebengineprofile_p.h
@@ -81,6 +81,8 @@ public:
void downloadDestroyed(quint32 downloadId);
+ void cleanDownloads();
+
void downloadRequested(DownloadItemInfo &info) override;
void downloadUpdated(const DownloadItemInfo &info) override;
diff --git a/tests/auto/quick/publicapi/tst_publicapi.cpp b/tests/auto/quick/publicapi/tst_publicapi.cpp
index 0e48e280..59973f7d 100644
--- a/tests/auto/quick/publicapi/tst_publicapi.cpp
+++ b/tests/auto/quick/publicapi/tst_publicapi.cpp
@@ -134,8 +134,28 @@ static const QStringList expectedAPI = QStringList()
<< "QQuickWebEngineCertificateError.url --> QUrl"
<< "QQuickWebEngineColorDialogRequest.accepted --> bool"
<< "QQuickWebEngineColorDialogRequest.color --> QColor"
+ << "QQuickWebEngineContextMenuRequest.CanUndo --> EditFlags"
+ << "QQuickWebEngineContextMenuRequest.CanRedo --> EditFlags"
+ << "QQuickWebEngineContextMenuRequest.CanCut --> EditFlags"
+ << "QQuickWebEngineContextMenuRequest.CanCopy --> EditFlags"
+ << "QQuickWebEngineContextMenuRequest.CanPaste --> EditFlags"
+ << "QQuickWebEngineContextMenuRequest.CanDelete --> EditFlags"
+ << "QQuickWebEngineContextMenuRequest.CanSelectAll --> EditFlags"
+ << "QQuickWebEngineContextMenuRequest.CanTranslate --> EditFlags"
+ << "QQuickWebEngineContextMenuRequest.CanEditRichly --> EditFlags"
<< "QQuickWebEngineColorDialogRequest.dialogAccept(QColor) --> void"
<< "QQuickWebEngineColorDialogRequest.dialogReject() --> void"
+ << "QQuickWebEngineContextMenuRequest.editFlags --> EditFlags"
+ << "QQuickWebEngineContextMenuRequest.MediaInError --> MediaFlags"
+ << "QQuickWebEngineContextMenuRequest.MediaPaused --> MediaFlags"
+ << "QQuickWebEngineContextMenuRequest.MediaMuted --> MediaFlags"
+ << "QQuickWebEngineContextMenuRequest.MediaLoop --> MediaFlags"
+ << "QQuickWebEngineContextMenuRequest.MediaCanSave --> MediaFlags"
+ << "QQuickWebEngineContextMenuRequest.MediaHasAudio --> MediaFlags"
+ << "QQuickWebEngineContextMenuRequest.MediaCanToggleControls --> MediaFlags"
+ << "QQuickWebEngineContextMenuRequest.MediaControls --> MediaFlags"
+ << "QQuickWebEngineContextMenuRequest.MediaCanPrint --> MediaFlags"
+ << "QQuickWebEngineContextMenuRequest.MediaCanRotate --> MediaFlags"
<< "QQuickWebEngineContextMenuRequest.MediaTypeAudio --> MediaType"
<< "QQuickWebEngineContextMenuRequest.MediaTypeCanvas --> MediaType"
<< "QQuickWebEngineContextMenuRequest.MediaTypeFile --> MediaType"
@@ -147,6 +167,7 @@ static const QStringList expectedAPI = QStringList()
<< "QQuickWebEngineContextMenuRequest.isContentEditable --> bool"
<< "QQuickWebEngineContextMenuRequest.linkText --> QString"
<< "QQuickWebEngineContextMenuRequest.linkUrl --> QUrl"
+ << "QQuickWebEngineContextMenuRequest.mediaFlags --> MediaFlags"
<< "QQuickWebEngineContextMenuRequest.mediaType --> MediaType"
<< "QQuickWebEngineContextMenuRequest.mediaUrl --> QUrl"
<< "QQuickWebEngineContextMenuRequest.misspelledWord --> QString"
@@ -218,6 +239,7 @@ static const QStringList expectedAPI = QStringList()
<< "QQuickWebEngineDownloadItem.totalBytesChanged() --> void"
<< "QQuickWebEngineDownloadItem.type --> DownloadType"
<< "QQuickWebEngineDownloadItem.typeChanged() --> void"
+ << "QQuickWebEngineDownloadItem.view --> QQuickWebEngineView*"
<< "QQuickWebEngineFileDialogRequest.FileModeOpen --> FileMode"
<< "QQuickWebEngineFileDialogRequest.FileModeOpenMultiple --> FileMode"
<< "QQuickWebEngineFileDialogRequest.FileModeSave --> FileMode"
@@ -344,6 +366,8 @@ static const QStringList expectedAPI = QStringList()
<< "QQuickWebEngineSettings.autoLoadImagesChanged() --> void"
<< "QQuickWebEngineSettings.defaultTextEncoding --> QString"
<< "QQuickWebEngineSettings.defaultTextEncodingChanged() --> void"
+ << "QQuickWebEngineSettings.dnsPrefetchEnabled --> bool"
+ << "QQuickWebEngineSettings.dnsPrefetchEnabledChanged() --> void"
<< "QQuickWebEngineSettings.errorPageEnabled --> bool"
<< "QQuickWebEngineSettings.errorPageEnabledChanged() --> void"
<< "QQuickWebEngineSettings.focusOnNavigationEnabled --> bool"
@@ -356,6 +380,8 @@ static const QStringList expectedAPI = QStringList()
<< "QQuickWebEngineSettings.javascriptCanAccessClipboardChanged() --> void"
<< "QQuickWebEngineSettings.javascriptCanOpenWindows --> bool"
<< "QQuickWebEngineSettings.javascriptCanOpenWindowsChanged() --> void"
+ << "QQuickWebEngineSettings.javascriptCanPaste --> bool"
+ << "QQuickWebEngineSettings.javascriptCanPasteChanged() --> void"
<< "QQuickWebEngineSettings.javascriptEnabled --> bool"
<< "QQuickWebEngineSettings.javascriptEnabledChanged() --> void"
<< "QQuickWebEngineSettings.linksIncludedInFocusChain --> bool"
@@ -650,6 +676,7 @@ static const QStringList expectedAPI = QStringList()
<< "QQuickWebEngineView.navigationRequested(QQuickWebEngineNavigationRequest*) --> void"
<< "QQuickWebEngineView.newViewRequested(QQuickWebEngineNewViewRequest*) --> void"
<< "QQuickWebEngineView.pdfPrintingFinished(QString,bool) --> void"
+ << "QQuickWebEngineView.printRequested() --> void"
<< "QQuickWebEngineView.printToPdf(QJSValue) --> void"
<< "QQuickWebEngineView.printToPdf(QJSValue,PrintedPageSizeId) --> void"
<< "QQuickWebEngineView.printToPdf(QJSValue,PrintedPageSizeId,PrintedPageOrientation) --> void"
@@ -675,8 +702,10 @@ static const QStringList expectedAPI = QStringList()
<< "QQuickWebEngineView.setActiveFocusOnPress(bool) --> void"
<< "QQuickWebEngineView.settings --> QQuickWebEngineSettings*"
<< "QQuickWebEngineView.stop() --> void"
+#if QT_CONFIG(webengine_testsupport)
<< "QQuickWebEngineView.testSupport --> QQuickWebEngineTestSupport*"
<< "QQuickWebEngineView.testSupportChanged() --> void"
+#endif
<< "QQuickWebEngineView.title --> QString"
<< "QQuickWebEngineView.titleChanged() --> void"
<< "QQuickWebEngineView.triggerWebAction(WebAction) --> void"
@@ -792,18 +821,23 @@ void tst_publicapi::publicAPI()
// for (const QString &actual : qAsConst(sortedAPI))
// printf(" << \"%s\"\n", qPrintable(actual));
+ bool apiMatch = true;
// Make sure that nothing slips in the public API unintentionally.
for (const QString &actual : qAsConst(actualAPI)) {
- if (!expectedAPI.contains(actual))
- QEXPECT_FAIL("", qPrintable("Expected list is not up-to-date: " + actual), Continue);
- QVERIFY2(expectedAPI.contains(actual), qPrintable(actual));
+ if (!expectedAPI.contains(actual)) {
+ QWARN(qPrintable("Expected list is not up-to-date: " + actual));
+ apiMatch = false;
+ }
}
// Make sure that the expected list is up-to-date with intentionally added APIs.
for (const QString &expected : expectedAPI) {
- if (!actualAPI.contains(expected))
- QEXPECT_FAIL("", qPrintable("Not implemented: " + expected), Continue);
- QVERIFY2(actualAPI.contains(expected), qPrintable(expected));
+ if (!actualAPI.contains(expected)) {
+ apiMatch = false;
+ QWARN(qPrintable("Not implemented: " + expected));
+ }
}
+
+ QVERIFY2(apiMatch, "Unexpected, missing or misspelled API!");
}
QTEST_MAIN(tst_publicapi)
diff --git a/tests/auto/widgets/qwebenginedownloaditem/tst_qwebenginedownloaditem.cpp b/tests/auto/widgets/qwebenginedownloaditem/tst_qwebenginedownloaditem.cpp
index 2af81892..b30fc725 100644
--- a/tests/auto/widgets/qwebenginedownloaditem/tst_qwebenginedownloaditem.cpp
+++ b/tests/auto/widgets/qwebenginedownloaditem/tst_qwebenginedownloaditem.cpp
@@ -69,6 +69,7 @@ private Q_SLOTS:
void downloadFileNot1();
void downloadFileNot2();
void downloadDeleted();
+ void downloadDeletedByProfile();
private:
void saveLink(QPoint linkPos);
@@ -812,5 +813,36 @@ void tst_QWebEngineDownloadItem::downloadDeleted()
QTRY_COMPARE(finishedCount, 1);
}
+void tst_QWebEngineDownloadItem::downloadDeletedByProfile()
+{
+ m_server->setExpectError(true);
+
+ QPointer<QWebEngineProfile> profile(new QWebEngineProfile);
+ profile->setHttpCacheType(QWebEngineProfile::NoCache);
+ profile->settings()->setAttribute(QWebEngineSettings::AutoLoadIconsForPage, false);
+
+ bool downloadFinished = false;
+ QPointer<QWebEngineDownloadItem> downloadItem;
+ connect(profile, &QWebEngineProfile::downloadRequested, [&] (QWebEngineDownloadItem *item) {
+ connect(item, &QWebEngineDownloadItem::finished, [&] () {
+ downloadFinished = true;
+ });
+ downloadItem = item;
+ item->accept();
+ });
+
+ QPointer<QWebEnginePage> page(new QWebEnginePage(profile));
+ page->download(m_server->url(QByteArrayLiteral("/file")));
+
+ QTRY_COMPARE(downloadItem.isNull(), false);
+ QVERIFY(downloadItem);
+
+ page->deleteLater();
+ profile->deleteLater();
+
+ QTRY_COMPARE(downloadFinished, true);
+ QTRY_COMPARE(downloadItem.isNull(), true);
+}
+
QTEST_MAIN(tst_QWebEngineDownloadItem)
#include "tst_qwebenginedownloaditem.moc"