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

Side by Side Diff: src/plugin/AdblockPlusClient.cpp

Issue 5447868882092032: Issue 1793 - check whether the frame is whitelisted before injecting CSS (Closed)
Patch Set: fix according to comments Created May 15, 2015, 11:55 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/plugin/AdblockPlusClient.h ('k') | src/plugin/PluginTabBase.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2015 Eyeo GmbH 3 * Copyright (C) 2006-2015 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 { 246 {
247 bool isHidden; 247 bool isHidden;
248 m_criticalSectionFilter.Lock(); 248 m_criticalSectionFilter.Lock();
249 { 249 {
250 isHidden = filter && filter->IsElementHidden(tag, pEl, domain, indent); 250 isHidden = filter && filter->IsElementHidden(tag, pEl, domain, indent);
251 } 251 }
252 m_criticalSectionFilter.Unlock(); 252 m_criticalSectionFilter.Unlock();
253 return isHidden; 253 return isHidden;
254 } 254 }
255 255
256 bool CAdblockPlusClient::IsWhitelistedUrl(const std::wstring& url) 256 bool CAdblockPlusClient::IsWhitelistedUrl(const std::wstring& url, const std::ve ctor<std::string>& frameHierarchy)
257 { 257 {
258 return !GetWhitelistingFilter(url).empty(); 258 return !GetWhitelistingFilter(url, frameHierarchy).empty();
259 } 259 }
260 260
261 std::string CAdblockPlusClient::GetWhitelistingFilter(const std::wstring& url) 261 std::string CAdblockPlusClient::GetWhitelistingFilter(const std::wstring& url, c onst std::vector<std::string>& frameHierarchy)
262 { 262 {
263 DEBUG_GENERAL((L"GetWhitelistingFilter: " + url + L" start").c_str()); 263 DEBUG_GENERAL((L"GetWhitelistingFilter: " + url + L" start").c_str());
264 Communication::OutputBuffer request; 264 Communication::OutputBuffer request;
265 request << Communication::PROC_GET_WHITELISTING_FITER << url; 265 request << Communication::PROC_GET_WHITELISTING_FITER << url << frameHierarchy ;
266 266
267 Communication::InputBuffer response; 267 Communication::InputBuffer response;
268 if (!CallEngine(request, response)) 268 if (!CallEngine(request, response))
269 return ""; 269 return "";
270 270
271 std::string filterText; 271 std::string filterText;
272 response >> filterText; 272 response >> filterText;
273 273
274 DEBUG_GENERAL((L"GetWhitelistingFilter: " + url + L" end").c_str()); 274 DEBUG_GENERAL((L"GetWhitelistingFilter: " + url + L" end").c_str());
275 return filterText; 275 return filterText;
276 } 276 }
277 277
278 bool CAdblockPlusClient::IsElemhideWhitelistedOnDomain(const std::wstring& url) 278 bool CAdblockPlusClient::IsElemhideWhitelistedOnDomain(const std::wstring& url, const std::vector<std::string>& frameHierarchy)
279 { 279 {
280 Communication::OutputBuffer request; 280 Communication::OutputBuffer request;
281 request << Communication::PROC_IS_ELEMHIDE_WHITELISTED_ON_URL << url; 281 request << Communication::PROC_IS_ELEMHIDE_WHITELISTED_ON_URL << url << frameH ierarchy;
282 282
283 Communication::InputBuffer response; 283 Communication::InputBuffer response;
284 if (!CallEngine(request, response)) 284 if (!CallEngine(request, response))
285 return false; 285 return false;
286 286
287 bool isWhitelisted; 287 bool isWhitelisted;
288 response >> isWhitelisted; 288 response >> isWhitelisted;
289 return isWhitelisted; 289 return isWhitelisted;
290 } 290 }
291 291
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
562 DEBUG_GENERAL("CompareVersions"); 562 DEBUG_GENERAL("CompareVersions");
563 Communication::OutputBuffer request; 563 Communication::OutputBuffer request;
564 request << Communication::PROC_COMPARE_VERSIONS << v1 << v2; 564 request << Communication::PROC_COMPARE_VERSIONS << v1 << v2;
565 Communication::InputBuffer response; 565 Communication::InputBuffer response;
566 if (!CallEngine(request, response)) 566 if (!CallEngine(request, response))
567 return 0; 567 return 0;
568 int result; 568 int result;
569 response >> result; 569 response >> result;
570 return result; 570 return result;
571 } 571 }
OLDNEW
« no previous file with comments | « src/plugin/AdblockPlusClient.h ('k') | src/plugin/PluginTabBase.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld