1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 02:36:34 +01:00

Support for loading not percent encoded bookmarklets.

Closes #722 #717
This commit is contained in:
hrobeers 2013-01-28 23:10:49 +01:00 committed by nowrep
parent 1d83557af2
commit fbfcc706c2

View File

@ -164,7 +164,14 @@ void WebView::load(const QNetworkRequest &request, QNetworkAccessManager::Operat
if (reqUrl.scheme() == QLatin1String("javascript")) {
// Getting scriptSource from PercentEncoding to properly load bookmarklets
QString scriptSource = QUrl::fromPercentEncoding(reqUrl.toString().mid(11).toUtf8());
// First check if url is percent encoded (let's just look for space)
QString scriptSource;
if (reqUrl.path().trimmed().contains(' ')) {
scriptSource = reqUrl.toString().mid(11);
}
else {
scriptSource = QUrl::fromPercentEncoding(reqUrl.toString().mid(11).toUtf8());
}
page()->mainFrame()->evaluateJavaScript(scriptSource);
return;
}