From 6a410a5e63715fbdc6e82c7e8a0540278fb158d7 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Sun, 14 Oct 2012 12:12:02 +0200 Subject: 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 --- src/adblock/adblockmanager.cpp | 5 ++--- 1 file 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())) { -- cgit v1.2.1