Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: src/engine/Main.cpp

Issue 5316782940225536: Issue 1557 - Update to the recent libadblockplus to reduce additional updates in the logic later. (Closed)
Patch Set: Created Nov. 21, 2014, 4:07 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « adblockplus.gyp ('k') | src/plugin/AdblockPlusClient.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/engine/Main.cpp
===================================================================
--- a/src/engine/Main.cpp
+++ b/src/engine/Main.cpp
@@ -88,11 +88,12 @@
case Communication::PROC_MATCHES:
{
std::string url;
- std::string type;
+ int32_t type;
std::string documentUrl;
request >> url >> type >> documentUrl;
- referrerMapping.Add(url, documentUrl);
- AdblockPlus::FilterPtr filter = filterEngine->Matches(url, type, referrerMapping.BuildReferrerChain(documentUrl));
+ referrerMapping.Add(url, documentUrl);
+ auto contentType = static_cast<AdblockPlus::FilterEngine::ContentType>(type);
+ AdblockPlus::FilterPtr filter = filterEngine->Matches(url, contentType, referrerMapping.BuildReferrerChain(documentUrl));
response << (filter && filter->GetType() != AdblockPlus::Filter::TYPE_EXCEPTION);
break;
}
@@ -192,7 +193,8 @@
{
std::string url;
request >> url;
- AdblockPlus::FilterPtr match = filterEngine->Matches(url, "DOCUMENT", url);
+ AdblockPlus::FilterPtr match = filterEngine->Matches(url,
+ AdblockPlus::FilterEngine::ContentType::CONTENT_TYPE_DOCUMENT, url);
response << (match && match->GetType() == AdblockPlus::Filter::TYPE_EXCEPTION);
break;
}
@@ -200,8 +202,13 @@
{
std::string url;
request >> url;
- AdblockPlus::FilterPtr match = filterEngine->Matches(url, "ELEMHIDE", url);
+ AdblockPlus::FilterPtr match = filterEngine->Matches(url,
+ AdblockPlus::FilterEngine::ContentType::CONTENT_TYPE_ELEMHIDE, url);
response << (match && match->GetType() == AdblockPlus::Filter::TYPE_EXCEPTION);
+ if (match && match->GetType() == AdblockPlus::Filter::TYPE_EXCEPTION)
+ {
+ std::string();
+ }
break;
}
case Communication::PROC_ADD_FILTER:
« no previous file with comments | « adblockplus.gyp ('k') | src/plugin/AdblockPlusClient.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld