Review Request: Extend khtml API to allow retrieval of the adblock filter that was matched (for display in GUI)

Jonathan Marten jjm at
Fri Aug 21 16:41:29 BST 2009

This is an automatically generated e-mail. To reply, visit:

Review request for kdelibs.


This patch to khtml allows the adblock filter that matched a blocked or whitelisted URL to be identified.  Currently the only lookup function available is 'bool KHTMLSettings::isAdFiltered(const QString &url) const', which returns whether an URL is filtered but does not identify the filter that matched.  The proposed addition is 'QString adFilteredBy(const QString &url) const' which returns the filter expression that matched.

It is intended that the matching filter will be displayed in the "Blockable items on this page" dialogue, as a tooltip over a blocked item.

This change should be BC according to the rules at because it only adds new non-virtual functions (but StringsMatcher::isMatched() becomes overloaded, so not SC).  When possible (KDE5?), the two overloads of this can be merged into one with a default argument.

Performance should not be affected, as the only additional code run in the normal case (checking for a blocked URL) is a pointer comparison against NULL which will always succeed and do nothing more.  Only when being called from the adblock GUI will the string-returning functions be used and the filter result stored.


  /trunk/KDE/kdelibs/khtml/khtml_filter.cpp 997809 
  /trunk/KDE/kdelibs/khtml/khtml_filter_p.h 997809 
  /trunk/KDE/kdelibs/khtml/khtml_settings.h 997809 
  /trunk/KDE/kdelibs/khtml/khtml_settings.cpp 997809 



Tested against a modified version of the adblock plugin (not committed yet, this addition to KHTML is needed first).  The matching filter is retrieved and displayed as a tooltip.



More information about the kde-core-devel mailing list