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

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

Issue 6390087684194304: [superseded] Issue 1265 - Improve detection of mime type of the expected response (Closed)
Left Patch Set: restore assuming XHR request type when xml is queried Created Sept. 11, 2014, 9:44 a.m.
Right Patch Set: Fix missed support of other blocked types Created Sept. 12, 2014, 7:54 a.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
« no previous file with change/comment | « src/plugin/PluginWbPassThrough.h ('k') | src/plugin/SinkPolicy.inl » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 #include "PluginStdAfx.h" 1 #include "PluginStdAfx.h"
2 2
3 #include "PluginWbPassThrough.h" 3 #include "PluginWbPassThrough.h"
4 #include "PluginClient.h" 4 #include "PluginClient.h"
5 #include "PluginClientFactory.h" 5 #include "PluginClientFactory.h"
6 #ifdef SUPPORT_FILTER 6 #ifdef SUPPORT_FILTER
7 #include "PluginFilter.h" 7 #include "PluginFilter.h"
8 #endif 8 #endif
9 #include "PluginSettings.h" 9 #include "PluginSettings.h"
10 #include "PluginClass.h" 10 #include "PluginClass.h"
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 } 184 }
185 else 185 else
186 #endif // SUPPORT_FRAME_CACHING 186 #endif // SUPPORT_FRAME_CACHING
187 { 187 {
188 m_contentType = GetContentType(mimeType, m_boundDomain, src); 188 m_contentType = GetContentType(mimeType, m_boundDomain, src);
189 } 189 }
190 } 190 }
191 191
192 } 192 }
193 193
194 if (nullptr == tab) 194 if (nullptr == tab)
Oleksandr 2014/10/01 09:15:39 I personally don't like yoda conditions, and I thi
195 { 195 {
196 m_contentType = GetContentType(mimeType, m_boundDomain, src); 196 m_contentType = GetContentType(mimeType, m_boundDomain, src);
197 } 197 }
198 198
199 if (nullptr != client 199 if (nullptr != client
200 && CFilter::EContentType::contentTypeAny != m_contentType 200 && CFilter::EContentType::contentTypeAny != m_contentType
201 && client->ShouldBlock(src, m_contentType, m_boundDomain, true)) 201 && client->ShouldBlock(src, m_contentType, m_boundDomain, true))
Oleksandr 2014/10/01 09:15:39 Comment about yoda conditions applies here as well
202 { 202 {
203 isBlocked = true; 203 isBlocked = true;
204 } 204 }
205 205
206 // For IE6 and earlier there is iframe back button issue, so avoid it. 206 // For IE6 and earlier there is iframe back button issue, so avoid it.
207 if (isBlocked && client->GetIEVersion() > 6) 207 if (isBlocked && client->GetIEVersion() > 6)
208 { 208 {
209 handled = true; 209 handled = true;
210 if (CFilter::EContentType::contentTypeImage == m_contentType) 210 if (CFilter::EContentType::contentTypeImage == m_contentType)
211 { 211 {
212 BaseClass::OnStart(szUrl, pOIProtSink, pOIBindInfo, grfPI, dwReserved, pTa rgetProtocol); 212 BaseClass::OnStart(szUrl, pOIProtSink, pOIBindInfo, grfPI, dwReserved, pTa rgetProtocol);
213 // IE shows a cross that img is not loaded 213 // IE shows a cross that img is not loaded
214 return INET_E_REDIRECT_FAILED; 214 return INET_E_REDIRECT_FAILED;
215 } 215 }
216 if (CFilter::EContentType::contentTypeSubdocument == m_contentType) 216 if (CFilter::EContentType::contentTypeSubdocument == m_contentType)
217 { 217 {
218 PassthroughAPP::CustomSinkStartPolicy<WBPassthru, WBPassthruSink>::GetProt ocol(this)->m_shouldSupplyCustomContent = true; 218 PassthroughAPP::CustomSinkStartPolicy<WBPassthru, WBPassthruSink>::GetProt ocol(this)->m_shouldSupplyCustomContent = true;
219 BaseClass::OnStart(szUrl, pOIProtSink, pOIBindInfo, grfPI, dwReserved, pTa rgetProtocol); 219 BaseClass::OnStart(szUrl, pOIProtSink, pOIBindInfo, grfPI, dwReserved, pTa rgetProtocol);
220 m_spInternetProtocolSink->ReportProgress(BINDSTATUS_MIMETYPEAVAILABLE, L"t ext/html"); 220 m_spInternetProtocolSink->ReportProgress(BINDSTATUS_MIMETYPEAVAILABLE, L"t ext/html");
221 m_spInternetProtocolSink->ReportData(BSCF_FIRSTDATANOTIFICATION, 0, static _cast<ULONG>(g_myPageBlocked.size())); 221 m_spInternetProtocolSink->ReportData(BSCF_FIRSTDATANOTIFICATION, 0, static _cast<ULONG>(g_myPageBlocked.size()));
222 return S_OK; 222 return S_OK;
223 } 223 }
224 if (CFilter::EContentType::contentTypeScript == m_contentType) 224 if (CFilter::EContentType::contentTypeScript == m_contentType)
225 { 225 {
226 BaseClass::OnStart(szUrl, pOIProtSink, pOIBindInfo, grfPI, dwReserved, pTa rgetProtocol); 226 BaseClass::OnStart(szUrl, pOIProtSink, pOIBindInfo, grfPI, dwReserved, pTa rgetProtocol);
227 m_spInternetProtocolSink->ReportProgress(BINDSTATUS_MIMETYPEAVAILABLE, L"t ext/javascript"); 227 m_spInternetProtocolSink->ReportProgress(BINDSTATUS_MIMETYPEAVAILABLE, L"t ext/javascript");
228 m_spInternetProtocolSink->ReportResult(INET_E_REDIRECTING, 301, L"data:"); 228 m_spInternetProtocolSink->ReportResult(INET_E_REDIRECTING, 301, L"data:");
229 return INET_E_REDIRECT_FAILED; 229 return INET_E_REDIRECT_FAILED;
230 } 230 }
231 if (CFilter::EContentType::contentTypeXmlHttpRequest == m_contentType) 231 if (CFilter::EContentType::contentTypeXmlHttpRequest == m_contentType)
Oleksandr 2014/10/01 09:15:39 Looks like we don't need a special case for conten
232 {
233 BaseClass::OnStart(szUrl, pOIProtSink, pOIBindInfo, grfPI, dwReserved, pTa rgetProtocol);
234 m_spInternetProtocolSink->ReportResult(INET_E_REDIRECTING, 301, L"data:");
235 return INET_E_REDIRECT_FAILED;
236 }
237 if (CFilter::EContentType::contentTypeAny != m_contentType)
232 { 238 {
233 BaseClass::OnStart(szUrl, pOIProtSink, pOIBindInfo, grfPI, dwReserved, pTa rgetProtocol); 239 BaseClass::OnStart(szUrl, pOIProtSink, pOIBindInfo, grfPI, dwReserved, pTa rgetProtocol);
234 m_spInternetProtocolSink->ReportResult(INET_E_REDIRECTING, 301, L"data:"); 240 m_spInternetProtocolSink->ReportResult(INET_E_REDIRECTING, 301, L"data:");
Oleksandr 2014/10/01 09:15:39 I don't think redirecting all requests to 'data:'
235 return INET_E_REDIRECT_FAILED; 241 return INET_E_REDIRECT_FAILED;
236 } 242 }
237 } 243 }
238 #endif // SUPPORT_FILTER 244 #endif // SUPPORT_FILTER
239 245
240 return isBlocked ? S_FALSE : BaseClass::OnStart(szUrl, pOIProtSink, pOIBindInf o, grfPI, dwReserved, pTargetProtocol); 246 return isBlocked ? S_FALSE : BaseClass::OnStart(szUrl, pOIProtSink, pOIBindInf o, grfPI, dwReserved, pTargetProtocol);
241 } 247 }
242 248
243 HRESULT WBPassthruSink::OnRead(void* pv, ULONG cb, ULONG* pcbRead) 249 HRESULT WBPassthruSink::OnRead(void* pv, ULONG cb, ULONG* pcbRead)
244 { 250 {
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 } 421 }
416 422
417 STDMETHODIMP WBPassthru::UnlockRequest() 423 STDMETHODIMP WBPassthru::UnlockRequest()
418 { 424 {
419 if (m_shouldSupplyCustomContent) 425 if (m_shouldSupplyCustomContent)
420 { 426 {
421 return S_OK; 427 return S_OK;
422 } 428 }
423 return PassthroughAPP::CInternetProtocol<WBStartPolicy>::UnlockRequest(); 429 return PassthroughAPP::CInternetProtocol<WBStartPolicy>::UnlockRequest();
424 } 430 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld