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

Side by Side Diff: src/plugin/PluginDomTraverserBase.h

Issue 5733210436665344: Issue #1234 - Remove local CString variable from TraverseDocument() (Closed)
Patch Set: Created Oct. 9, 2015, 3:48 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 /* 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 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 270
271 if (SUCCEEDED(pFrameCollection->item(vIndex, vRetIndex, &pFrameDispatch)) && pFrameDispatch) 271 if (SUCCEEDED(pFrameCollection->item(vIndex, vRetIndex, &pFrameDispatch)) && pFrameDispatch)
272 { 272 {
273 CComQIPtr<IHTMLElement> pFrameEl = pFrameDispatch; 273 CComQIPtr<IHTMLElement> pFrameEl = pFrameDispatch;
274 if (pFrameEl) 274 if (pFrameEl)
275 { 275 {
276 CComVariant vAttr; 276 CComVariant vAttr;
277 277
278 if (SUCCEEDED(pFrameEl->getAttribute(ATL::CComBSTR(L"src"), 0, &vAttr) ) && vAttr.vt == VT_BSTR && ::SysStringLen(vAttr.bstrVal) > 0) 278 if (SUCCEEDED(pFrameEl->getAttribute(ATL::CComBSTR(L"src"), 0, &vAttr) ) && vAttr.vt == VT_BSTR && ::SysStringLen(vAttr.bstrVal) > 0)
279 { 279 {
280 CString srcLegacy = vAttr.bstrVal; 280 std::wstring src(vAttr.bstrVal, SysStringLen(vAttr.bstrVal));
281 281
282 // Some times, domain is missing. Should this be added on image src' s as well?'' 282 // Some times, domain is missing. Should this be added on image src' s as well?''
283
284 // eg. gadgetzone.com.au 283 // eg. gadgetzone.com.au
285 if (srcLegacy.Left(2) == L"//") 284 if (BeginsWith(src, L"//"))
286 { 285 {
287 srcLegacy = L"http:" + srcLegacy; 286 src = L"http:" + src;
288 } 287 }
289 // eg. http://w3schools.com/html/html_examples.asp 288 // eg. http://w3schools.com/html/html_examples.asp
290 else if (srcLegacy.Left(4) != L"http" && srcLegacy.Left(6) != L"res: //") 289 else if (!(BeginsWith(src, L"http") || BeginsWith(src, L"res://")))
291 { 290 {
292 srcLegacy = L"http://" + ToCString(m_domain) + srcLegacy; 291 src = L"http://" + m_domain + src;
293 } 292 }
294 std::wstring src(ToWstring(srcLegacy));
295 UnescapeUrl(src); 293 UnescapeUrl(src);
296 294
297 // Check if Iframe should be traversed 295 // Check if Iframe should be traversed
298 if (OnIFrame(pFrameEl, src, indent)) 296 if (OnIFrame(pFrameEl, src, indent))
299 { 297 {
300 CComQIPtr<IWebBrowser2> pFrameBrowser = pFrameDispatch; 298 CComQIPtr<IWebBrowser2> pFrameBrowser = pFrameDispatch;
301 if (pFrameBrowser) 299 if (pFrameBrowser)
302 { 300 {
303 TraverseDocument(pFrameBrowser, false, indent); 301 TraverseDocument(pFrameBrowser, false, indent);
304 } 302 }
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 { 459 {
462 m_cacheIndexLast = 0; 460 m_cacheIndexLast = 0;
463 m_cacheDocumentHasFrames.clear(); 461 m_cacheDocumentHasFrames.clear();
464 m_cacheDocumentHasIframes.clear(); 462 m_cacheDocumentHasIframes.clear();
465 } 463 }
466 m_criticalSection.Unlock(); 464 m_criticalSection.Unlock();
467 } 465 }
468 466
469 467
470 #endif // _PLUGIN_DOM_TRAVERSER_BASE_H_ 468 #endif // _PLUGIN_DOM_TRAVERSER_BASE_H_
OLDNEW
« no previous file with comments | « adblockplus.gyp ('k') | src/plugin/PluginUtil.h » ('j') | src/plugin/PluginUtil.h » ('J')

Powered by Google App Engine
This is Rietveld