mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 10:46:35 +01:00
LocationBar: Also whitelist data: scheme for loading urls
This commit is contained in:
parent
ae3aebc06c
commit
deca7f7399
@ -74,9 +74,9 @@ void LocationBarTest::loadActionBasicTest()
|
|||||||
action = LocationBar::loadAction("not url with spaces");
|
action = LocationBar::loadAction("not url with spaces");
|
||||||
QCOMPARE(action.type, LocationBar::LoadAction::Search);
|
QCOMPARE(action.type, LocationBar::LoadAction::Search);
|
||||||
|
|
||||||
action = LocationBar::loadAction("qupzilla:about");
|
action = LocationBar::loadAction("falkon:about");
|
||||||
QCOMPARE(action.type, LocationBar::LoadAction::Url);
|
QCOMPARE(action.type, LocationBar::LoadAction::Url);
|
||||||
QCOMPARE(action.loadRequest.url(), QUrl("qupzilla:about"));
|
QCOMPARE(action.loadRequest.url(), QUrl("falkon:about"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void LocationBarTest::loadActionBookmarksTest()
|
void LocationBarTest::loadActionBookmarksTest()
|
||||||
@ -152,4 +152,25 @@ void LocationBarTest::loadAction_kdebug389491()
|
|||||||
QCOMPARE(action.loadRequest.url(), QUrl("http://website.com?search=searchterm and another"));
|
QCOMPARE(action.loadRequest.url(), QUrl("http://website.com?search=searchterm and another"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LocationBarTest::loadActionSpecialSchemesTest()
|
||||||
|
{
|
||||||
|
LocationBar::LoadAction action;
|
||||||
|
|
||||||
|
action = LocationBar::loadAction("data:image/png;base64,xxxxx");
|
||||||
|
QCOMPARE(action.type, LocationBar::LoadAction::Url);
|
||||||
|
QCOMPARE(action.loadRequest.url(), QUrl("data:image/png;base64,xxxxx"));
|
||||||
|
|
||||||
|
action = LocationBar::loadAction("falkon:about");
|
||||||
|
QCOMPARE(action.type, LocationBar::LoadAction::Url);
|
||||||
|
QCOMPARE(action.loadRequest.url(), QUrl("falkon:about"));
|
||||||
|
|
||||||
|
action = LocationBar::loadAction("file:test.html");
|
||||||
|
QCOMPARE(action.type, LocationBar::LoadAction::Url);
|
||||||
|
QCOMPARE(action.loadRequest.url(), QUrl("file:test.html"));
|
||||||
|
|
||||||
|
action = LocationBar::loadAction("about:blank");
|
||||||
|
QCOMPARE(action.type, LocationBar::LoadAction::Url);
|
||||||
|
QCOMPARE(action.loadRequest.url(), QUrl("about:blank"));
|
||||||
|
}
|
||||||
|
|
||||||
FALKONTEST_MAIN(LocationBarTest)
|
FALKONTEST_MAIN(LocationBarTest)
|
||||||
|
@ -32,4 +32,5 @@ private slots:
|
|||||||
void loadActionBookmarksTest();
|
void loadActionBookmarksTest();
|
||||||
void loadActionSearchTest();
|
void loadActionSearchTest();
|
||||||
void loadAction_kdebug389491();
|
void loadAction_kdebug389491();
|
||||||
|
void loadActionSpecialSchemesTest();
|
||||||
};
|
};
|
||||||
|
@ -269,7 +269,7 @@ LocationBar::LoadAction LocationBar::loadAction(const QString &text)
|
|||||||
// Only allow whitelisted schemes
|
// Only allow whitelisted schemes
|
||||||
const QSet<QString> whitelistedSchemes = {
|
const QSet<QString> whitelistedSchemes = {
|
||||||
QSL("http"), QSL("https"), QSL("ftp"), QSL("file"),
|
QSL("http"), QSL("https"), QSL("ftp"), QSL("file"),
|
||||||
QSL("about"), QSL("qupzilla")
|
QSL("data"), QSL("about"), QSL("falkon")
|
||||||
};
|
};
|
||||||
if (whitelistedSchemes.contains(guessedUrl.scheme())) {
|
if (whitelistedSchemes.contains(guessedUrl.scheme())) {
|
||||||
action.type = LoadAction::Url;
|
action.type = LoadAction::Url;
|
||||||
|
Loading…
Reference in New Issue
Block a user