summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJüri Valdmann <juri.valdmann@qt.io>2018-06-04 14:45:48 +0200
committerJüri Valdmann <juri.valdmann@qt.io>2018-06-05 11:30:08 +0000
commit6cd3360c4d5283893eeb1efe43e329073709b48c (patch)
treeb431fbc5203f3e2b19ab9cdbde2730ec35527709 /tests
parentef17b79a4e496ee4c6a390ef27427f1a94118c80 (diff)
Don't try to run user scripts if provisional load failed
Fixes DCHECK in UserResourceController::DidFinishDocumentLoad. Task-number: QTBUG-68594 Change-Id: I67128e2144420e61f8bffe080fa16a828b8202ad Reviewed-by: Szabolcs David <davidsz@inf.u-szeged.hu> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/widgets/qwebenginepage/resources/dynamicFrame.html16
-rw-r--r--tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp10
-rw-r--r--tests/auto/widgets/qwebenginepage/tst_qwebenginepage.qrc1
3 files changed, 27 insertions, 0 deletions
diff --git a/tests/auto/widgets/qwebenginepage/resources/dynamicFrame.html b/tests/auto/widgets/qwebenginepage/resources/dynamicFrame.html
new file mode 100644
index 000000000..731387b37
--- /dev/null
+++ b/tests/auto/widgets/qwebenginepage/resources/dynamicFrame.html
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>Dynamic iframe</title>
+ </head>
+ <body>
+ <script>
+ const ifr = document.createElement("iframe");
+ ifr.setAttribute("src", "invalid");
+ document.body.appendChild(ifr);
+ ifr.contentWindow.document.open("text/html", "replace");
+ ifr.contentWindow.document.write("foo");
+ ifr.contentWindow.document.close();
+ </script>
+ </body>
+</html>
diff --git a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
index 8b88973e5..599d918b3 100644
--- a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
+++ b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
@@ -219,6 +219,7 @@ private Q_SLOTS:
void dataURLFragment();
void devTools();
void openLinkInDifferentProfile();
+ void dynamicFrame();
private:
static QPoint elementCenter(QWebEnginePage *page, const QString &id);
@@ -4418,6 +4419,15 @@ void tst_QWebEnginePage::openLinkInDifferentProfile()
QVERIFY(spy2.takeFirst().value(0).toBool());
}
+void tst_QWebEnginePage::dynamicFrame()
+{
+ QWebEnginePage page;
+ QSignalSpy spy(&page, &QWebEnginePage::loadFinished);
+ page.load(QStringLiteral("qrc:/resources/dynamicFrame.html"));
+ QVERIFY(spy.wait());
+ QCOMPARE(toPlainTextSync(&page).trimmed(), QStringLiteral("foo"));
+}
+
static QByteArrayList params = {QByteArrayLiteral("--use-fake-device-for-media-stream")};
W_QTEST_MAIN(tst_QWebEnginePage, params)
diff --git a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.qrc b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.qrc
index fc83aefa5..0e8381f21 100644
--- a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.qrc
+++ b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.qrc
@@ -2,6 +2,7 @@
<qresource>
<file>resources/basic_printing_page.html</file>
<file>resources/content.html</file>
+ <file>resources/dynamicFrame.html</file>
<file>resources/index.html</file>
<file>resources/frame_a.html</file>
<file>resources/frame_c.html</file>