From 1dd5716bd9a9d68b2a13c1bd0c03617261743412 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Fri, 10 Feb 2012 09:58:28 +0100 Subject: Consider option && ~option as null rules when option is not implemented BUG: 246801 --- src/adblock/adblockmanager.cpp | 2 +- src/adblock/adblockmanager.h | 2 +- src/adblock/adblockrule.cpp | 2 +- src/adblock/adblockrule.h | 2 +- src/adblock/adblockrulefallbackimpl.cpp | 1 + src/adblock/adblockrulefallbackimpl.h | 1 + src/adblock/adblockrulenullimpl.cpp | 36 ++++++++++++++++++--------------- src/adblock/adblockrulenullimpl.h | 2 +- 8 files changed, 27 insertions(+), 21 deletions(-) (limited to 'src') diff --git a/src/adblock/adblockmanager.cpp b/src/adblock/adblockmanager.cpp index a4af34cb..a63d2d8e 100644 --- a/src/adblock/adblockmanager.cpp +++ b/src/adblock/adblockmanager.cpp @@ -2,7 +2,7 @@ * * This file is a part of the rekonq project * -* Copyright (C) 2010-2011 by Andrea Diamantini +* Copyright (C) 2010-2012 by Andrea Diamantini * * * This program is free software; you can redistribute it and/or diff --git a/src/adblock/adblockmanager.h b/src/adblock/adblockmanager.h index f220082a..9d746e18 100644 --- a/src/adblock/adblockmanager.h +++ b/src/adblock/adblockmanager.h @@ -2,7 +2,7 @@ * * This file is a part of the rekonq project * -* Copyright (C) 2010-2011 by Andrea Diamantini +* Copyright (C) 2010-2012 by Andrea Diamantini * * * This program is free software; you can redistribute it and/or diff --git a/src/adblock/adblockrule.cpp b/src/adblock/adblockrule.cpp index 87fcb680..d65c340d 100644 --- a/src/adblock/adblockrule.cpp +++ b/src/adblock/adblockrule.cpp @@ -4,7 +4,7 @@ * * Copyright (c) 2009 by Zsombor Gegesy * Copyright (c) 2009 by Benjamin C. Meyer - * Copyright (C) 2010-2011 by Andrea Diamantini + * Copyright (C) 2010-2012 by Andrea Diamantini * * * This program is free software; you can redistribute it and/or diff --git a/src/adblock/adblockrule.h b/src/adblock/adblockrule.h index f5f913dc..15dea344 100644 --- a/src/adblock/adblockrule.h +++ b/src/adblock/adblockrule.h @@ -2,7 +2,7 @@ * This file is a part of the rekonq project * * Copyright (c) 2009 by Benjamin C. Meyer - * Copyright (C) 2010-2011 by Andrea Diamantini + * Copyright (C) 2010-2012 by Andrea Diamantini * * * This program is free software; you can redistribute it and/or diff --git a/src/adblock/adblockrulefallbackimpl.cpp b/src/adblock/adblockrulefallbackimpl.cpp index 27fc4345..b547beb0 100644 --- a/src/adblock/adblockrulefallbackimpl.cpp +++ b/src/adblock/adblockrulefallbackimpl.cpp @@ -3,6 +3,7 @@ * This file is a part of the rekonq project * * Copyright (C) 2010-2011 by Benjamin Poulain +* Copyright (C) 2011-2012 by Andrea Diamantini * * * This program is free software; you can redistribute it and/or diff --git a/src/adblock/adblockrulefallbackimpl.h b/src/adblock/adblockrulefallbackimpl.h index 0003c037..4b5716f8 100644 --- a/src/adblock/adblockrulefallbackimpl.h +++ b/src/adblock/adblockrulefallbackimpl.h @@ -3,6 +3,7 @@ * This file is a part of the rekonq project * * Copyright (C) 2010-2011 by Benjamin Poulain +* Copyright (C) 2011-2012 by Andrea Diamantini * * * This program is free software; you can redistribute it and/or diff --git a/src/adblock/adblockrulenullimpl.cpp b/src/adblock/adblockrulenullimpl.cpp index 2be69789..e16b56db 100644 --- a/src/adblock/adblockrulenullimpl.cpp +++ b/src/adblock/adblockrulenullimpl.cpp @@ -2,7 +2,7 @@ * * This file is a part of the rekonq project * -* Copyright (C) 2011 by Andrea Diamantini +* Copyright (C) 2011-2012 by Andrea Diamantini * * * This program is free software; you can redistribute it and/or @@ -58,64 +58,68 @@ bool AdBlockRuleNullImpl::isNullFilter(const QString &filter) Q_FOREACH(const QString & option, options) { + // NOTE: + // I moved the check from option == QL1S to option.endsWith() + // to check option && ~option. Hope it will NOT be a problem... + // third_party: managed inside adblockrulefallbackimpl - if (option == QL1S("third-party")) + if (option.endsWith(QL1S("third-party"))) return false; // script - if (option == QL1S("script")) + if (option.endsWith(QL1S("script"))) return true; // image - if (option == QL1S("image")) + if (option.endsWith(QL1S("image"))) return true; // background - if (option == QL1S("background")) + if (option.endsWith(QL1S("background"))) return true; // stylesheet - if (option == QL1S("stylesheet")) + if (option.endsWith(QL1S("stylesheet"))) return true; // object - if (option == QL1S("object")) + if (option.endsWith(QL1S("object"))) return true; // xbl - if (option == QL1S("xbl")) + if (option.endsWith(QL1S("xbl"))) return true; // ping - if (option == QL1S("ping")) + if (option.endsWith(QL1S("ping"))) return true; // xmlhttprequest - if (option == QL1S("xmlhttprequest")) + if (option.endsWith(QL1S("xmlhttprequest"))) return true; // object_subrequest - if (option == QL1S("object-subrequest")) + if (option.endsWith(QL1S("object-subrequest"))) return true; // dtd - if (option == QL1S("dtd")) + if (option.endsWith(QL1S("dtd"))) return true; // subdocument - if (option == QL1S("subdocument")) + if (option.endsWith(QL1S("subdocument"))) return true; // document - if (option == QL1S("document")) + if (option.endsWith(QL1S("document"))) return true; // other - if (option == QL1S("other")) + if (option.endsWith(QL1S("other"))) return true; // collapse - if (option == QL1S("collapse")) + if (option.endsWith(QL1S("collapse"))) return true; } diff --git a/src/adblock/adblockrulenullimpl.h b/src/adblock/adblockrulenullimpl.h index 8a479880..a8f69652 100644 --- a/src/adblock/adblockrulenullimpl.h +++ b/src/adblock/adblockrulenullimpl.h @@ -2,7 +2,7 @@ * * This file is a part of the rekonq project * -* Copyright (C) 2011 by Andrea Diamantini +* Copyright (C) 2011-2012 by Andrea Diamantini * * * This program is free software; you can redistribute it and/or -- cgit v1.2.1