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

Unified Diff: src/plugin/PluginClientBase.cpp

Issue 10948032: Fix domain-based whitelisting (Closed)
Patch Set: Created June 14, 2013, 2:44 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/PluginClientBase.cpp
===================================================================
--- a/src/plugin/PluginClientBase.cpp
+++ b/src/plugin/PluginClientBase.cpp
@@ -166,15 +166,6 @@
#ifdef SUPPORT_WHITELIST
-void CPluginClientBase::CacheWhiteListedUrl(const CString& url, bool isWhitelisted)
-{
- m_criticalSectionWhitelist.Lock();
- {
- m_cacheWhitelistedUrls[url] = isWhitelisted;
- }
- m_criticalSectionWhitelist.Unlock();
-}
-
bool CPluginClientBase::IsUrlWhiteListed(const CString& url)
{
if (url.IsEmpty())
@@ -182,49 +173,17 @@
return false;
}
- bool isWhitelisted = false;
- bool isCached = false;
-
- m_criticalSectionWhitelist.Lock();
+ int pos = 0;
+ CString http = url.Find('/',pos) >= 0 ? url.Tokenize(L"/", pos) : L"";
Wladimir Palant 2013/06/17 09:33:56 I know that this isn't your code but that variable
Felix Dahlke 2013/06/17 11:19:01 Done.
+ CString domain = ExtractDomain(url);
+ if (http == L"res:" || http == L"file:")
{
- std::map<CString,bool>::iterator it = m_cacheWhitelistedUrls.find(url);
-
- isCached = it != m_cacheWhitelistedUrls.end();
- if (isCached)
- {
- isWhitelisted = it->second;
- }
- }
- m_criticalSectionWhitelist.Unlock();
-
- if (!isCached)
- {
- int pos = 0;
- CString http = url.Find('/',pos) >= 0 ? url.Tokenize(L"/", pos) : L"";
- CString domain = ExtractDomain(url);
- if (http == L"res:" || http == L"file:")
- {
- isWhitelisted = true;
- }
- else
- {
- isWhitelisted = CPluginSettings::GetInstance()->IsWhiteListedDomain(domain);
- }
-
- CacheWhiteListedUrl(url, isWhitelisted);
+ return true;
}
- return isWhitelisted;
+ CPluginSettings* pluginSettings = CPluginSettings::GetInstance();
+ pluginSettings->RefreshWhitelist();
+ return pluginSettings->IsWhiteListedDomain(domain);
Wladimir Palant 2013/06/17 09:33:56 Retrieving all exception domains from the engine j
Felix Dahlke 2013/06/17 11:19:01 Yes, I agree. I frankly didn't dare to change too
}
-void CPluginClientBase::ClearWhiteListCache()
-{
- m_criticalSectionWhitelist.Lock();
- {
- m_cacheWhitelistedUrls.clear();
- }
- m_criticalSectionWhitelist.Unlock();
-}
-
-
#endif // SUPPORT_WHITELIST

Powered by Google App Engine
This is Rietveld