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

Fixed blocking link with ftp and qupzilla schemes because of the 'Same Origin Policy'.

This commit is contained in:
S. Razi Alavizadeh 2013-01-29 05:15:10 +03:30
parent 709bc71f1a
commit dd58127293
3 changed files with 6 additions and 5 deletions

View File

@ -56,7 +56,6 @@
#ifdef Q_OS_MAC
#include <QFileOpenEvent>
#endif
#include <QWebSecurityOrigin>
#include <QNetworkDiskCache>
#include <QDesktopServices>
#include <QTranslator>
@ -413,10 +412,6 @@ void MainApplication::loadSettings()
m_websettings->setWebGraphic(QWebSettings::DefaultFrameIconGraphic, qIconProvider->emptyWebIcon().pixmap(16, 16));
m_websettings->setWebGraphic(QWebSettings::MissingImageGraphic, QPixmap());
// Allows to load files from qrc: scheme in qupzilla: pages
QWebSecurityOrigin::addLocalScheme("qupzilla");
QWebSecurityOrigin::addLocalScheme("ftp");
if (m_isPrivateSession) {
m_websettings->setAttribute(QWebSettings::PrivateBrowsingEnabled, true);
history()->setSaving(false);

View File

@ -22,6 +22,7 @@
#include "iconprovider.h"
#include "mainapplication.h"
#include <QWebSecurityOrigin>
#include <QFileIconProvider>
#include <QTextStream>
#include <QDateTime>
@ -202,6 +203,7 @@ void FtpSchemeReply::loadPage()
}
}
QWebSecurityOrigin::addLocalScheme("ftp");
open(ReadOnly | Unbuffered);
QTextStream stream(&m_buffer);
stream.setCodec("UTF-8");
@ -220,6 +222,7 @@ void FtpSchemeReply::loadPage()
emit readyRead();
emit finished();
m_ftp->close();
QWebSecurityOrigin::removeLocalScheme("ftp");
}
QString FtpSchemeReply::loadDirectory()

View File

@ -30,6 +30,7 @@
#include <QTextStream>
#include <QTimer>
#include <QSettings>
#include <QWebSecurityOrigin>
static QString authorString(const char* name, const QString &mail)
{
@ -78,6 +79,7 @@ QupZillaSchemeReply::QupZillaSchemeReply(const QNetworkRequest &req, QObject* pa
void QupZillaSchemeReply::loadPage()
{
QWebSecurityOrigin::addLocalScheme("qupzilla");
QTextStream stream(&m_buffer);
stream.setCodec("UTF-8");
@ -112,6 +114,7 @@ void QupZillaSchemeReply::loadPage()
emit readyRead();
emit finished();
QWebSecurityOrigin::removeLocalScheme("qupzilla");
}
void QupZillaSchemeReply::delayedFinish()