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: Addressed all issues Created June 25, 2013, 2:19 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
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;
@@ -187,19 +201,24 @@
return isHidden;
}
-bool CAdblockPlusClient::IsUrlWhiteListed(const CString& url)
+bool CAdblockPlusClient::IsWhitelistedUrl(const std::string& url)
Wladimir Palant 2013/06/25 18:03:58 I would actually expect to see std::wstring here -
Felix Dahlke 2013/06/26 09:32:55 Yes, that seems to make more sense, since the plug
Wladimir Palant 2013/06/27 05:55:02 Yes, the other methods seem wrong as well. I'm fin
{
- bool isWhitelisted = CPluginClientBase::IsUrlWhiteListed(url);
- if (isWhitelisted == false && !url.IsEmpty())
+ Communication::OutputBuffer request;
+ request << Communication::PROC_IS_WHITELISTED_URL << 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