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

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

Issue 29331669: Issue 3237 - Whitelisted AFS ad is not shown on netzwelt.de (Closed)
Patch Set: Move subdocument detection to the top. Created Dec. 15, 2015, 2:05 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 | « no previous file | src/plugin/PluginDomTraverserBase.h » ('j') | src/plugin/PluginWbPassThrough.cpp » ('J')
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 16 matching lines...) Expand all
27 { 27 {
28 } 28 }
29 29
30 30
31 bool CPluginDomTraverser::OnIFrame(IHTMLElement* pEl, const std::wstring& url, c onst std::wstring& indent) 31 bool CPluginDomTraverser::OnIFrame(IHTMLElement* pEl, const std::wstring& url, c onst std::wstring& indent)
32 { 32 {
33 CPluginClient* client = CPluginClient::GetInstance(); 33 CPluginClient* client = CPluginClient::GetInstance();
34 34
35 // If src should be blocked, set style display:none on iframe 35 // If src should be blocked, set style display:none on iframe
36 bool isBlocked = client->ShouldBlock(url, 36 bool isBlocked = client->ShouldBlock(url,
37 AdblockPlus::FilterEngine::ContentType::CONTENT_TYPE_SUBDOCUMENT, m_domain); 37 AdblockPlus::FilterEngine::ContentType::CONTENT_TYPE_SUBDOCUMENT, m_document Url);
38 if (isBlocked) 38 if (isBlocked)
39 { 39 {
40 HideElement(pEl, L"iframe", url, true, indent); 40 HideElement(pEl, L"iframe", url, true, indent);
41 } 41 }
42 42
43 return !isBlocked; 43 return !isBlocked;
44 } 44 }
45 45
46 46
47 bool CPluginDomTraverser::OnElement(IHTMLElement* pEl, const std::wstring& tag, CPluginDomTraverserCache* cache, bool isDebug, const std::wstring& indent) 47 bool CPluginDomTraverser::OnElement(IHTMLElement* pEl, const std::wstring& tag, CPluginDomTraverserCache* cache, bool isDebug, const std::wstring& indent)
(...skipping 17 matching lines...) Expand all
65 if (tag == L"img") 65 if (tag == L"img")
66 { 66 {
67 CComVariant vAttr; 67 CComVariant vAttr;
68 68
69 if (SUCCEEDED(pEl->getAttribute(ATL::CComBSTR(L"src"), 0, &vAttr)) && vAttr. vt == VT_BSTR && ::SysStringLen(vAttr.bstrVal) > 0) 69 if (SUCCEEDED(pEl->getAttribute(ATL::CComBSTR(L"src"), 0, &vAttr)) && vAttr. vt == VT_BSTR && ::SysStringLen(vAttr.bstrVal) > 0)
70 { 70 {
71 std::wstring src(vAttr.bstrVal, SysStringLen(vAttr.bstrVal)); 71 std::wstring src(vAttr.bstrVal, SysStringLen(vAttr.bstrVal));
72 72
73 // If src should be blocked, set style display:none on image 73 // If src should be blocked, set style display:none on image
74 cache->m_isHidden = client->ShouldBlock(src, 74 cache->m_isHidden = client->ShouldBlock(src,
75 AdblockPlus::FilterEngine::ContentType::CONTENT_TYPE_IMAGE, m_domain); 75 AdblockPlus::FilterEngine::ContentType::CONTENT_TYPE_IMAGE, m_documentUr l);
76 if (cache->m_isHidden) 76 if (cache->m_isHidden)
77 { 77 {
78 HideElement(pEl, L"image", src, true, indent); 78 HideElement(pEl, L"image", src, true, indent);
79 return false; 79 return false;
80 } 80 }
81 } 81 }
82 } 82 }
83 // Objects 83 // Objects
84 else if (tag == L"object") 84 else if (tag == L"object")
85 { 85 {
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 151
152 #ifdef ENABLE_DEBUG_RESULT 152 #ifdef ENABLE_DEBUG_RESULT
153 if (isDebug) 153 if (isDebug)
154 { 154 {
155 CPluginDebug::DebugResultHiding(type, url, L"-"); 155 CPluginDebug::DebugResultHiding(type, url, L"-");
156 } 156 }
157 #endif // ENABLE_DEBUG_RESULT 157 #endif // ENABLE_DEBUG_RESULT
158 } 158 }
159 } 159 }
160 } 160 }
OLDNEW
« no previous file with comments | « no previous file | src/plugin/PluginDomTraverserBase.h » ('j') | src/plugin/PluginWbPassThrough.cpp » ('J')

Powered by Google App Engine
This is Rietveld