summaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qmltests/data
diff options
context:
space:
mode:
authorPeter Varga <pvarga@inf.u-szeged.hu>2018-03-07 11:48:14 +0100
committerPeter Varga <pvarga@inf.u-szeged.hu>2018-03-14 14:38:41 +0000
commit789f375411b542db3ac3be79cbe0a6153720abf1 (patch)
tree3aa2c15914a341b1bc0e05fff08f842451f3282f /tests/auto/quick/qmltests/data
parent3b0b2e040f596105a56f83bfc0adc9f1df1bd009 (diff)
Remove credentials from view-source URLs
Task-number: QTBUG-65997 Change-Id: Icb55326c51f1dfff77e8e862e9ced619be17ead1 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'tests/auto/quick/qmltests/data')
-rw-r--r--tests/auto/quick/qmltests/data/tst_viewSource.qml28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/auto/quick/qmltests/data/tst_viewSource.qml b/tests/auto/quick/qmltests/data/tst_viewSource.qml
index a9cf11f34..d0bc0529d 100644
--- a/tests/auto/quick/qmltests/data/tst_viewSource.qml
+++ b/tests/auto/quick/qmltests/data/tst_viewSource.qml
@@ -124,6 +124,34 @@ TestWebEngineView {
// FIXME(pvarga): Reintroduce this check in the fix for QTBUG-56117
//verify(!webEngineView.canViewSource);
}
+
+ function test_viewSourceCredentials() {
+ var url = "http://user:passwd@httpbin.org/basic-auth/user/passwd";
+
+ // Test explicit view-source URL with credentials
+ webEngineView.url = Qt.resolvedUrl("view-source:" + url);
+ if (!webEngineView.waitForLoadSucceeded(12000))
+ skip("Couldn't load page from network, skipping test.");
+
+ compare(webEngineView.url, "view-source:" + url.replace("user:passwd@", ""));
+ compare(webEngineView.title, "view-source:" + url.replace("http://user:passwd@", ""));
+ titleChangedSpy.clear();
+
+ // Test ViewSource web action on URL with credentials
+ webEngineView.url = Qt.resolvedUrl(url);
+ if (!webEngineView.waitForLoadSucceeded(12000))
+ skip("Couldn't load page from network, skipping test.");
+ webEngineView.triggerWebAction(WebEngineView.ViewSource);
+ tryCompare(newViewRequestedSpy, "count", 1);
+
+ // The first titleChanged signal is emitted by adoptWebContents()
+ tryVerify(function() { return titleChangedSpy.count >= 2; });
+ compare(viewRequest.destination, WebEngineView.NewViewInTab);
+ verify(viewRequest.userInitiated);
+
+ tryCompare(webEngineView, "url", "view-source:" + url.replace("user:passwd@", ""));
+ tryCompare(webEngineView, "title", "view-source:" + url.replace("http://user:passwd@", ""));
+ }
}
}