aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorOlivier De Cannière <olivier.decanniere@qt.io>2023-03-15 13:55:15 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2023-04-28 14:55:44 +0000
commit2d26b07ff63cee999f4c561b45e635c4d503d267 (patch)
tree3763d6fe75d3adead2512db7d3fcee9a740c49c9 /tests
parented88eab0b28b37b2e6d4a044a97e30cc72f229f2 (diff)
QV4: Fix formatting options for the search component of UrlObject
This fix changes the way the search component of UrlObjects is formatted by passing the correct options to QUrl::query. Namely, the EncodeDelimiters flag is no longer set. This now allows for correct encoding of backslashes in search strings. Amends 6cca731f3e1304ce98f1ec18af42e3bd06001eea. Task-number: QTBUG-111014 Change-Id: Iee544dfc7ad6ba374601c8ec4690d11bf07c9b6a Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> (cherry picked from commit af4cd4763a7e0a9b2b52de91ea07eff9be3aa9b0) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qml/qv4urlobject/tst_qv4urlobject.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/auto/qml/qv4urlobject/tst_qv4urlobject.cpp b/tests/auto/qml/qv4urlobject/tst_qv4urlobject.cpp
index 886bfda018..b74ec3d583 100644
--- a/tests/auto/qml/qv4urlobject/tst_qv4urlobject.cpp
+++ b/tests/auto/qml/qv4urlobject/tst_qv4urlobject.cpp
@@ -116,6 +116,14 @@ void tst_urlobject::urlObject_search_data()
<< "var url = new URL(\"http://google.com/search/?a=㉽\");"
"url.search"
<< "?a=%E3%89%BD";
+ QTest::newRow("backslash")
+ // The JS string in the C++ source ends in 4 backslashes.
+ // The C++ compiler turns that into 2 backslashes.
+ // QV4 receives source code containing a string literal ending in two backslashes.
+ // The resulting JS string ends in a single backslash.
+ << "var url = new URL('http://google.com/search/?q=\\\\');"
+ "url.search"
+ << "?q=\\";
}
void tst_urlobject::urlObject_href()