mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 02:36:34 +01:00
parent
e9a9a768cc
commit
45635f6da8
@ -180,17 +180,14 @@ void WebView::load(const LoadRequest &request)
|
|||||||
{
|
{
|
||||||
const QUrl reqUrl = request.url();
|
const QUrl reqUrl = request.url();
|
||||||
|
|
||||||
if (reqUrl.scheme() == QLatin1String("javascript")) {
|
if (reqUrl.scheme() == QL1S("javascript")) {
|
||||||
// Getting scriptSource from PercentEncoding to properly load bookmarklets
|
const QString scriptSource = reqUrl.toString().mid(11);
|
||||||
// First check if url is percent encoded (let's just look for space)
|
// Is the javascript source percent encoded or not?
|
||||||
QString scriptSource;
|
// Looking for % character in source should work in most cases
|
||||||
if (reqUrl.path().trimmed().contains(' ')) {
|
if (scriptSource.contains(QL1C('%')))
|
||||||
scriptSource = reqUrl.toString().mid(11);
|
page()->mainFrame()->evaluateJavaScript(QUrl::fromPercentEncoding(scriptSource.toUtf8()));
|
||||||
}
|
else
|
||||||
else {
|
page()->mainFrame()->evaluateJavaScript(scriptSource);
|
||||||
scriptSource = QUrl::fromPercentEncoding(reqUrl.toString().mid(11).toUtf8());
|
|
||||||
}
|
|
||||||
page()->mainFrame()->evaluateJavaScript(scriptSource);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user