diff options
author | Andrea Diamantini <adjam7@gmail.com> | 2012-10-14 12:12:02 +0200 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2012-10-14 12:12:02 +0200 |
commit | 6a410a5e63715fbdc6e82c7e8a0540278fb158d7 (patch) | |
tree | 2b250ab46787d4088986422d23299a6832da0823 | |
parent | docs: restore <(book|article)info> (diff) | |
download | rekonq-6a410a5e63715fbdc6e82c7e8a0540278fb158d7.tar.xz |
Faster html elements check and better address resolution
This "should" fix some strange adblock behaviour on image hiding.
Needs testing
Patch courtesy by "vic". Thanks :)
PS: will be applied to rekonq2, too.
BUG:305861
-rw-r--r-- | src/adblock/adblockmanager.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/adblock/adblockmanager.cpp b/src/adblock/adblockmanager.cpp index 140669c5..73daef88 100644 --- a/src/adblock/adblockmanager.cpp +++ b/src/adblock/adblockmanager.cpp @@ -272,15 +272,14 @@ QNetworkReply *AdBlockManager::block(const QNetworkRequest &request, WebPage *pa kDebug() << "ADBLOCK: BLACK RULE Matched by string: " << urlString; QWebElement document = page->mainFrame()->documentElement(); - QWebElementCollection elements = document.findAll("*"); + QWebElementCollection elements = document.findAll("[src]"); Q_FOREACH(QWebElement el, elements) { QString srcAttribute = el.attribute("src"); if (srcAttribute.isEmpty()) continue; - if (!srcAttribute.startsWith(QL1S("http"))) - srcAttribute = host + srcAttribute; + srcAttribute = page->mainFrame()->baseUrl().resolved(srcAttribute).toString(); if (filter.match(request, srcAttribute, srcAttribute.toLower())) { |