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

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

Issue 5171515343503360: Issue #41 - Bring method of determining IE version up to date (Closed)
Patch Set: Created June 21, 2014, 8:25 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
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"
11 #include "PluginSystem.h" 11 #include "PluginSystem.h"
12 #include "Wrapper.h" 12 #include "Wrapper.h"
13 #include "PluginUtil.h" 13 #include "PluginUtil.h"
14 #include "../shared/Utils.h"
14 15
15 #include "wtypes.h" 16 #include "wtypes.h"
16 17
17 EXTERN_C IMAGE_DOS_HEADER __ImageBase; 18 EXTERN_C IMAGE_DOS_HEADER __ImageBase;
18 19
19 20
20 WBPassthruSink::WBPassthruSink() 21 WBPassthruSink::WBPassthruSink()
21 { 22 {
22 m_pTargetProtocol = NULL; 23 m_pTargetProtocol = NULL;
23 } 24 }
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 { 100 {
100 return CFilter::contentTypeAny & ~CFilter::contentTypeSubdocument; 101 return CFilter::contentTypeAny & ~CFilter::contentTypeSubdocument;
101 } 102 }
102 103
103 } 104 }
104 105
105 int WBPassthruSink::GetContentType(std::wstring mimeType, std::wstring domain, s td::wstring src) 106 int WBPassthruSink::GetContentType(std::wstring mimeType, std::wstring domain, s td::wstring src)
106 { 107 {
107 // No referer or mime type 108 // No referer or mime type
108 // BINDSTRING_XDR_ORIGIN works only for IE v8+ 109 // BINDSTRING_XDR_ORIGIN works only for IE v8+
109 if (mimeType.empty() && domain.empty() && CPluginClient::GetInstance()->GetIEV ersion() >= 8) 110 if ( mimeType.empty() && domain.empty() )
Oleksandr 2014/06/22 21:53:17 The means we would falsely classify requests as Xm
110 { 111 {
111 return CFilter::contentTypeXmlHttpRequest; 112 return CFilter::contentTypeXmlHttpRequest;
112 } 113 }
113 int contentType = GetContentTypeFromMimeType(mimeType); 114 int contentType = GetContentTypeFromMimeType(mimeType);
114 if (contentType == CFilter::contentTypeAny) 115 if (contentType == CFilter::contentTypeAny)
115 { 116 {
116 contentType = GetContentTypeFromURL(src); 117 contentType = GetContentTypeFromURL(src);
117 } 118 }
118 return contentType; 119 return contentType;
119 } 120 }
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 { 220 {
220 CPluginDebug::DebugResultBlocking(type, src, boundDomain); 221 CPluginDebug::DebugResultBlocking(type, src, boundDomain);
221 } 222 }
222 else 223 else
223 { 224 {
224 CPluginDebug::DebugResultIgnoring(type, src, boundDomain); 225 CPluginDebug::DebugResultIgnoring(type, src, boundDomain);
225 } 226 }
226 #endif 227 #endif
227 228
228 //Fixes the iframe back button issue 229 //Fixes the iframe back button issue
229 if (client->GetIEVersion() > 6) 230 if ((contentType == CFilter::contentTypeImage) && (isBlocked))
230 { 231 {
231 if ((contentType == CFilter::contentTypeImage) && (isBlocked)) 232 m_shouldBlock = true;
233 BaseClass::OnStart(szUrl, pOIProtSink, pOIBindInfo, grfPI, dwReserved, pTarg etProtocol);
234
235 return INET_E_REDIRECT_FAILED;
236
237 }
238 if (((contentType == CFilter::contentTypeSubdocument))&& (isBlocked))
239 {
240 m_shouldBlock = true;
241 BaseClass::OnStart(szUrl, pOIProtSink, pOIBindInfo, grfPI, dwReserved, pTarg etProtocol);
242
243 m_spInternetProtocolSink->ReportProgress(BINDSTATUS_MIMETYPEAVAILABLE, L"tex t/html");
244
245 //Here we check if we are running on Windows 8 Consumer Preview.
246 //For some reason on that environment the next line causes IE to crash
247 if (CPluginSettings::GetInstance()->GetWindowsBuildNumber() != 8250)
232 { 248 {
233 m_shouldBlock = true; 249 m_spInternetProtocolSink->ReportResult(INET_E_REDIRECTING, 301, L"res://ms html.dll/blank.htm");
234 BaseClass::OnStart(szUrl, pOIProtSink, pOIBindInfo, grfPI, dwReserved, pTa rgetProtocol); 250 }
235 251
236 return INET_E_REDIRECT_FAILED; 252 return INET_E_REDIRECT_FAILED;
253 }
254 if (((contentType == CFilter::contentTypeScript))&& (isBlocked))
255 {
256 m_shouldBlock = true;
257 BaseClass::OnStart(szUrl, pOIProtSink, pOIBindInfo, grfPI, dwReserved, pTarg etProtocol);
258 m_spInternetProtocolSink->ReportProgress(BINDSTATUS_MIMETYPEAVAILABLE, L"tex t/javascript");
259 m_spInternetProtocolSink->ReportResult(INET_E_REDIRECTING, 301, L"data:");
260 return INET_E_REDIRECT_FAILED;
261 }
262 if ((isBlocked))
263 {
264 m_shouldBlock = true;
265 BaseClass::OnStart(szUrl, pOIProtSink, pOIBindInfo, grfPI, dwReserved, pTarg etProtocol);
266 m_spInternetProtocolSink->ReportResult(S_FALSE, 0, L"");
237 267
238 } 268 return INET_E_REDIRECT_FAILED;
239 if (((contentType == CFilter::contentTypeSubdocument))&& (isBlocked))
240 {
241 m_shouldBlock = true;
242 BaseClass::OnStart(szUrl, pOIProtSink, pOIBindInfo, grfPI, dwReserved, pTa rgetProtocol);
243
244 m_spInternetProtocolSink->ReportProgress(BINDSTATUS_MIMETYPEAVAILABLE, L"t ext/html");
245
246 //Here we check if we are running on Windows 8 Consumer Preview.
247 //For some reason on that environment the next line causes IE to crash
248 if (CPluginSettings::GetInstance()->GetWindowsBuildNumber() != 8250)
249 {
250 m_spInternetProtocolSink->ReportResult(INET_E_REDIRECTING, 301, L"res:// mshtml.dll/blank.htm");
251 }
252
253 return INET_E_REDIRECT_FAILED;
254 }
255 if (((contentType == CFilter::contentTypeScript))&& (isBlocked))
256 {
257 m_shouldBlock = true;
258 BaseClass::OnStart(szUrl, pOIProtSink, pOIBindInfo, grfPI, dwReserved, pTa rgetProtocol);
259 m_spInternetProtocolSink->ReportProgress(BINDSTATUS_MIMETYPEAVAILABLE, L"t ext/javascript");
260 m_spInternetProtocolSink->ReportResult(INET_E_REDIRECTING, 301, L"data:");
261 return INET_E_REDIRECT_FAILED;
262 }
263 if ((isBlocked))
264 {
265 /* WCHAR tmp[256];
266 wsprintf(tmp, L"URL: %s, domain: %s, mime: %s, type: %d", szUrl, boundDoma in, mimeType, contentType);
267 MessageBox(NULL, tmp, L"", MB_OK);
268 contentType = GetContentType(mimeType, boundDomain, src);
269 */
270 m_shouldBlock = true;
271 BaseClass::OnStart(szUrl, pOIProtSink, pOIBindInfo, grfPI, dwReserved, pTa rgetProtocol);
272 m_spInternetProtocolSink->ReportResult(S_FALSE, 0, L"");
273
274 return INET_E_REDIRECT_FAILED;
275 }
276 } 269 }
277 #endif // SUPPORT_FILTER 270 #endif // SUPPORT_FILTER
278 271
279 return isBlocked ? S_FALSE : BaseClass::OnStart(szUrl, pOIProtSink, pOIBindInf o, grfPI, dwReserved, pTargetProtocol); 272 return isBlocked ? S_FALSE : BaseClass::OnStart(szUrl, pOIProtSink, pOIBindInf o, grfPI, dwReserved, pTargetProtocol);
280 } 273 }
281 274
282 275
283 HRESULT WBPassthruSink::Read(void *pv, ULONG cb, ULONG* pcbRead) 276 HRESULT WBPassthruSink::Read(void *pv, ULONG cb, ULONG* pcbRead)
284 { 277 {
285 if (m_shouldBlock) 278 if (m_shouldBlock)
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 CComPtr<IHttpNegotiate> spHttpNegotiate; 356 CComPtr<IHttpNegotiate> spHttpNegotiate;
364 QueryServiceFromClient(&spHttpNegotiate); 357 QueryServiceFromClient(&spHttpNegotiate);
365 358
366 return spHttpNegotiate ? spHttpNegotiate->OnResponse(dwResponseCode, szRespons eHeaders, szRequestHeaders, pszAdditionalRequestHeaders) : S_OK; 359 return spHttpNegotiate ? spHttpNegotiate->OnResponse(dwResponseCode, szRespons eHeaders, szRequestHeaders, pszAdditionalRequestHeaders) : S_OK;
367 } 360 }
368 361
369 STDMETHODIMP WBPassthruSink::ReportProgress(ULONG ulStatusCode, LPCWSTR szStatus Text) 362 STDMETHODIMP WBPassthruSink::ReportProgress(ULONG ulStatusCode, LPCWSTR szStatus Text)
370 { 363 {
371 return m_spInternetProtocolSink ? m_spInternetProtocolSink->ReportProgress(ulS tatusCode, szStatusText) : S_OK; 364 return m_spInternetProtocolSink ? m_spInternetProtocolSink->ReportProgress(ulS tatusCode, szStatusText) : S_OK;
372 } 365 }
OLDNEW

Powered by Google App Engine
This is Rietveld