mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 18:56:34 +01:00
Improved cookies filtering + fixed crash
Improved cookies filtering for domain mismatch and for tracking cookies, it is now fully (i hope) working and ready to use in everyday browsing. Please test it by yourself and report any issues. Also fixed crash when closing cookies manager window with "Close" in title bar or with Alt+F4
This commit is contained in:
parent
56e7e5163a
commit
4a556a4adc
@ -176,7 +176,7 @@ void QupZilla::postLaunch()
|
||||
aboutToShowHistoryMenu(false);
|
||||
aboutToShowBookmarksMenu();
|
||||
|
||||
if (m_tabWidget->count() == 0) //Something went really wrong .. add one tab
|
||||
if (m_tabWidget->getTabBar()->normalTabsCount() <= 0) //Something went really wrong .. add one tab
|
||||
m_tabWidget->addView(m_homepage);
|
||||
|
||||
setUpdatesEnabled(true);
|
||||
|
@ -163,6 +163,7 @@ void AutoFillModel::post(const QNetworkRequest &request, const QByteArray &outgo
|
||||
//Dont save in private browsing
|
||||
if (mApp->webSettings()->testAttribute(QWebSettings::PrivateBrowsingEnabled))
|
||||
return;
|
||||
|
||||
m_lastOutgoingData = outgoingData;
|
||||
|
||||
QVariant v = request.attribute((QNetworkRequest::Attribute)(QNetworkRequest::User + 100));
|
||||
|
@ -17,15 +17,15 @@
|
||||
* ============================================================ */
|
||||
#include "cookiejar.h"
|
||||
#include "qupzilla.h"
|
||||
#define COOKIE_DEBUG
|
||||
//#define COOKIE_DEBUG
|
||||
|
||||
//TODO: black/white listing
|
||||
CookieJar::CookieJar(QupZilla* mainClass, QObject* parent) :
|
||||
QNetworkCookieJar(parent)
|
||||
CookieJar::CookieJar(QupZilla* mainClass, QObject* parent)
|
||||
: QNetworkCookieJar(parent)
|
||||
, p_QupZilla(mainClass)
|
||||
{
|
||||
loadSettings();
|
||||
m_activeProfil = mApp->getActiveProfilPath();
|
||||
loadSettings();
|
||||
}
|
||||
|
||||
void CookieJar::loadSettings()
|
||||
@ -52,14 +52,15 @@ bool CookieJar::setCookiesFromUrl(const QList<QNetworkCookie> &cookieList, const
|
||||
QDateTime now = QDateTime::currentDateTime();
|
||||
|
||||
foreach (QNetworkCookie cok, newList) {
|
||||
if (m_allowCookiesFromDomain && !url.toString().contains(cok.domain())) {
|
||||
if (m_allowCookiesFromDomain && !QString("." + url.host()).contains(cok.domain().remove("www."))) {
|
||||
#ifdef COOKIE_DEBUG
|
||||
qDebug() << "purged for domain mismatch" << cok;
|
||||
#endif
|
||||
newList.removeOne(cok);
|
||||
continue;
|
||||
}
|
||||
if (m_filterTrackingCookie && cok.expirationDate() > now.addYears(2)) {
|
||||
|
||||
if (m_filterTrackingCookie && (cok.name().startsWith("__utm") || cok.expirationDate() > now.addYears(1).addMonths(6)) ) {
|
||||
#ifdef COOKIE_DEBUG
|
||||
qDebug() << "purged as tracking " << cok;
|
||||
#endif
|
||||
|
@ -26,7 +26,6 @@ CookieManager::CookieManager(QWidget* parent)
|
||||
: QWidget(parent)
|
||||
, ui(new Ui::CookieManager)
|
||||
{
|
||||
setAttribute(Qt::WA_DeleteOnClose);
|
||||
setWindowModality(Qt::WindowModal);
|
||||
|
||||
ui->setupUi(this);
|
||||
|
@ -279,6 +279,16 @@ void TabBar::pinnedTabAdded()
|
||||
m_pinnedTabsCount++;
|
||||
}
|
||||
|
||||
int TabBar::pinnedTabsCount()
|
||||
{
|
||||
return m_pinnedTabsCount;
|
||||
}
|
||||
|
||||
int TabBar::normalTabsCount()
|
||||
{
|
||||
return count() - m_pinnedTabsCount;
|
||||
}
|
||||
|
||||
void TabBar::mouseDoubleClickEvent(QMouseEvent* event)
|
||||
{
|
||||
if (event->button() == Qt::LeftButton && tabAt(event->pos()) == -1) {
|
||||
|
@ -44,6 +44,9 @@ public:
|
||||
void setVisible(bool visible);
|
||||
void updateVisibilityWithFullscreen(bool visible);
|
||||
|
||||
int pinnedTabsCount();
|
||||
int normalTabsCount();
|
||||
|
||||
signals:
|
||||
void reloadTab(int index);
|
||||
void stopTab(int index);
|
||||
|
Loading…
Reference in New Issue
Block a user