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

Delta Between Two Patch Sets: src/plugin/AdblockPlusDomTraverser.cpp

Issue 4912420225024000: Issue #1234 - Convert strings associated with URL's (Closed)
Left Patch Set: Created Oct. 14, 2014, 10:17 p.m.
Right Patch Set: Created Jan. 5, 2015, 4:15 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
LEFTRIGHT
1 #include "PluginStdAfx.h" 1 #include "PluginStdAfx.h"
2 2
3 #include "PluginClient.h" 3 #include "PluginClient.h"
4 #include "PluginFilter.h" 4 #include "PluginFilter.h"
5 #include "PluginSettings.h" 5 #include "PluginSettings.h"
6 6
7 #include "AdblockPlusDomTraverser.h" 7 #include "AdblockPlusDomTraverser.h"
8 8
9 9
10 CPluginDomTraverser::CPluginDomTraverser(CPluginTab* tab) : CPluginDomTraverserB ase(tab) 10 CPluginDomTraverser::CPluginDomTraverser(CPluginTab* tab) : CPluginDomTraverserB ase(tab)
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 } 45 }
46 46
47 // Images 47 // Images
48 if (tag == "img") 48 if (tag == "img")
49 { 49 {
50 CComVariant vAttr; 50 CComVariant vAttr;
51 51
52 if (SUCCEEDED(pEl->getAttribute(L"src", 0, &vAttr)) && vAttr.vt == VT_BSTR & & ::SysStringLen(vAttr.bstrVal) > 0) 52 if (SUCCEEDED(pEl->getAttribute(L"src", 0, &vAttr)) && vAttr.vt == VT_BSTR & & ::SysStringLen(vAttr.bstrVal) > 0)
53 { 53 {
54 std::wstring src(vAttr.bstrVal, SysStringLen(vAttr.bstrVal)); 54 std::wstring src(vAttr.bstrVal, SysStringLen(vAttr.bstrVal));
55 SysFreeString(vAttr.bstrVal);
sergei 2014/10/17 10:10:12 It's not necessary to call SysFreeString here beca
Eric 2014/10/20 02:36:01 True. Removed it.
sergei 2014/10/21 09:45:17 But it's still here.
Eric 2014/10/21 17:19:52 I _thought_ I had removed it. It's gone now.
56 UnescapeUrl(src); 55 UnescapeUrl(src);
57 56
58 // If src should be blocked, set style display:none on image 57 // If src should be blocked, set style display:none on image
59 cache->m_isHidden = client->ShouldBlock(src, CFilter::contentTypeImage, m_ domain); 58 cache->m_isHidden = client->ShouldBlock(src, CFilter::contentTypeImage, m_ domain);
60 if (cache->m_isHidden) 59 if (cache->m_isHidden)
61 { 60 {
62 HideElement(pEl, "image", src, true, indent); 61 HideElement(pEl, "image", src, true, indent);
63 return false; 62 return false;
64 } 63 }
65 } 64 }
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 posEnd = posBegin >= 0 ? sObjectHtml.Find(L"\"", posBegin + 7) : -1; 101 posEnd = posBegin >= 0 ? sObjectHtml.Find(L"\"", posBegin + 7) : -1;
103 } 102 }
104 } 103 }
105 } 104 }
106 105
107 return true; 106 return true;
108 } 107 }
109 108
110 109
111 bool CPluginDomTraverser::IsEnabled() 110 bool CPluginDomTraverser::IsEnabled()
112 { 111 {
113 CPluginClient* client = CPluginClient::GetInstance(); 112 CPluginClient* client = CPluginClient::GetInstance();
114
115 return client && CPluginSettings::GetInstance()->IsPluginEnabled() && !client- >IsWhitelistedUrl(m_domain); 113 return client && CPluginSettings::GetInstance()->IsPluginEnabled() && !client- >IsWhitelistedUrl(m_domain);
116 } 114 }
117 115
118 116
119 void CPluginDomTraverser::HideElement(IHTMLElement* pEl, const CString& type, co nst std::wstring& url, bool isDebug, CString& indent) 117 void CPluginDomTraverser::HideElement(IHTMLElement* pEl, const CString& type, co nst std::wstring& url, bool isDebug, CString& indent)
120 { 118 {
121 CComPtr<IHTMLStyle> pStyle; 119 CComPtr<IHTMLStyle> pStyle;
122 120
123 if (SUCCEEDED(pEl->get_style(&pStyle)) && pStyle) 121 if (SUCCEEDED(pEl->get_style(&pStyle)) && pStyle)
124 { 122 {
(...skipping 12 matching lines...) Expand all
137 135
138 #ifdef ENABLE_DEBUG_RESULT 136 #ifdef ENABLE_DEBUG_RESULT
139 if (isDebug) 137 if (isDebug)
140 { 138 {
141 CPluginDebug::DebugResultHiding(type, ToCString(url), "-"); 139 CPluginDebug::DebugResultHiding(type, ToCString(url), "-");
142 } 140 }
143 #endif // ENABLE_DEBUG_RESULT 141 #endif // ENABLE_DEBUG_RESULT
144 } 142 }
145 } 143 }
146 } 144 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld