1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-19 10:16:34 +01:00

[AdBlock] Blocking netscape plugins even without C2F enabled.

Closes #791
This commit is contained in:
nowrep 2013-03-11 14:42:23 +01:00
parent ef89347a7c
commit 8bff746d30
2 changed files with 11 additions and 10 deletions

View File

@ -39,6 +39,7 @@ Version 1.4.0
* fixed sorting files case insensitively in file scheme handler
* fixed possible crash in saving page screen of a really long page
* fixed showing window in fullscreen with XFCE
* fixed AdBlock blocking netscape plugin even without Click2Flash
* X11: fixed Ctrl+Q shortcut for DEs other than KDE and Gnome
* windows: fixed color of found text when searching on page
* windows: fixed navigating to file links and x: labels in file: scheme handler

View File

@ -1,6 +1,6 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2012 David Rosca <nowrep@gmail.com>
* Copyright (C) 2010-2013 David Rosca <nowrep@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -37,7 +37,15 @@ QObject* WebPluginFactory::create(const QString &mimeType, const QUrl &url, cons
return new QObject();
}
QString mime = mimeType.trimmed(); //Fixing bad behaviour when mimeType contains spaces
// AdBlock
AdBlockManager* manager = AdBlockManager::instance();
QNetworkRequest request(url);
request.setAttribute(QNetworkRequest::Attribute(QNetworkRequest::User + 150), QString("object"));
if (manager->isEnabled() && manager->block(request)) {
return new QObject();
}
QString mime = mimeType.trimmed(); // Fixing bad behaviour when mimeType contains spaces
if (mime.isEmpty()) {
if (url.toString().endsWith(QLatin1String(".swf"))) {
mime = "application/x-shockwave-flash";
@ -58,14 +66,6 @@ QObject* WebPluginFactory::create(const QString &mimeType, const QUrl &url, cons
return 0;
}
// AdBlock
AdBlockManager* manager = AdBlockManager::instance();
QNetworkRequest request(url);
request.setAttribute(QNetworkRequest::Attribute(QNetworkRequest::User + 150), QString("object"));
if (manager->isEnabled() && manager->block(request)) {
return new QObject();
}
// Click2Flash whitelist
QStringList whitelist = mApp->plugins()->c2f_getWhiteList();
if (whitelist.contains(url.host()) || whitelist.contains("www." + url.host()) || whitelist.contains(url.host().remove(QLatin1String("www.")))) {