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

Unified Diff: src/plugin/AdblockPlusClient.cpp

Issue 10955040: Fix domain whitelisting and remove unused code (Closed)
Patch Set: Created June 25, 2013, 10:21 a.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
Index: src/plugin/AdblockPlusClient.cpp
===================================================================
--- a/src/plugin/AdblockPlusClient.cpp
+++ b/src/plugin/AdblockPlusClient.cpp
@@ -96,6 +96,20 @@
}
return result;
}
+
+ Communication::InputBuffer CallAdblockPlusEngineProcedure(Communication::OutputBuffer& message)
+ {
+ std::auto_ptr<Communication::Pipe> pipe = OpenAdblockPlusEnginePipe();
+ pipe->WriteMessage(message);
+ return pipe->ReadMessage();
+ }
+
+ Communication::InputBuffer CallAdblockPlusEngineProcedure(Communication::ProcType proc)
+ {
+ Communication::OutputBuffer message;
+ message << proc;
+ return CallAdblockPlusEngineProcedure(message);
+ }
}
CAdblockPlusClient* CAdblockPlusClient::s_instance = NULL;
@@ -189,17 +203,22 @@
bool CAdblockPlusClient::IsUrlWhiteListed(const CString& url)
{
- bool isWhitelisted = CPluginClientBase::IsUrlWhiteListed(url);
- if (isWhitelisted == false && !url.IsEmpty())
+ Communication::OutputBuffer request;
+ request << Communication::PROC_IS_WHITELISTED_URL << ToUtf8String(std::wstring(url));
+
+ try
{
- m_criticalSectionFilter.Lock();
- {
- isWhitelisted = m_filter.get() && m_filter->ShouldWhiteList(url);
- }
- m_criticalSectionFilter.Unlock();
+ Communication::InputBuffer response = CallAdblockPlusEngineProcedure(request);
+
+ bool isWhitelisted;
+ response >> isWhitelisted;
+ return isWhitelisted;
}
-
- return isWhitelisted;
+ catch (const std::exception& e)
+ {
+ DEBUG_GENERAL(e.what());
+ return false;
+ }
}
int CAdblockPlusClient::GetIEVersion()
@@ -223,20 +242,6 @@
return (int)(version[0] - 48);
}
-Communication::InputBuffer CallAdblockPlusEngineProcedure(Communication::OutputBuffer& message)
-{
- std::auto_ptr<Communication::Pipe> pipe = OpenAdblockPlusEnginePipe();
- pipe->WriteMessage(message);
- return pipe->ReadMessage();
-}
-
-Communication::InputBuffer CallAdblockPlusEngineProcedure(Communication::ProcType proc)
-{
- Communication::OutputBuffer message;
- message << proc;
- return CallAdblockPlusEngineProcedure(message);
-}
-
bool CAdblockPlusClient::Matches(const std::string& url, const std::string& contentType, const std::string& domain)
{
Communication::OutputBuffer request;

Powered by Google App Engine
This is Rietveld