| OLD | NEW |
| 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 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 | 269 |
| 270 if (SUCCEEDED(pFrameCollection->item(vIndex, vRetIndex, &pFrameDispatch))
&& pFrameDispatch) | 270 if (SUCCEEDED(pFrameCollection->item(vIndex, vRetIndex, &pFrameDispatch))
&& pFrameDispatch) |
| 271 { | 271 { |
| 272 CComQIPtr<IHTMLElement> pFrameEl = pFrameDispatch; | 272 CComQIPtr<IHTMLElement> pFrameEl = pFrameDispatch; |
| 273 if (pFrameEl) | 273 if (pFrameEl) |
| 274 { | 274 { |
| 275 CComVariant vAttr; | 275 CComVariant vAttr; |
| 276 | 276 |
| 277 if (SUCCEEDED(pFrameEl->getAttribute(ATL::CComBSTR(L"src"), 0, &vAttr)
) && vAttr.vt == VT_BSTR && ::SysStringLen(vAttr.bstrVal) > 0) | 277 if (SUCCEEDED(pFrameEl->getAttribute(ATL::CComBSTR(L"src"), 0, &vAttr)
) && vAttr.vt == VT_BSTR && ::SysStringLen(vAttr.bstrVal) > 0) |
| 278 { | 278 { |
| 279 CString srcLegacy = vAttr.bstrVal; | 279 std::wstring src(vAttr.bstrVal, SysStringLen(vAttr.bstrVal)); |
| 280 | 280 |
| 281 // Some times, domain is missing. Should this be added on image src'
s as well?'' | 281 // Some times, domain is missing. Should this be added on image src'
s as well?'' |
| 282 | |
| 283 // eg. gadgetzone.com.au | 282 // eg. gadgetzone.com.au |
| 284 if (srcLegacy.Left(2) == L"//") | 283 if (BeginsWith(src, L"//")) |
| 285 { | 284 { |
| 286 srcLegacy = L"http:" + srcLegacy; | 285 src = L"http:" + src; |
| 287 } | 286 } |
| 288 // eg. http://w3schools.com/html/html_examples.asp | 287 // eg. http://w3schools.com/html/html_examples.asp |
| 289 else if (srcLegacy.Left(4) != L"http" && srcLegacy.Left(6) != L"res:
//") | 288 else if (!(BeginsWith(src, L"http") || BeginsWith(src, L"res://"))) |
| 290 { | 289 { |
| 291 srcLegacy = L"http://" + ToCString(m_domain) + srcLegacy; | 290 src = L"http://" + m_domain + src; |
| 292 } | 291 } |
| 293 std::wstring src(ToWstring(srcLegacy)); | |
| 294 UnescapeUrl(src); | 292 UnescapeUrl(src); |
| 295 | 293 |
| 296 // Check if Iframe should be traversed | 294 // Check if Iframe should be traversed |
| 297 if (OnIFrame(pFrameEl, src, indent)) | 295 if (OnIFrame(pFrameEl, src, indent)) |
| 298 { | 296 { |
| 299 CComQIPtr<IWebBrowser2> pFrameBrowser = pFrameDispatch; | 297 CComQIPtr<IWebBrowser2> pFrameBrowser = pFrameDispatch; |
| 300 if (pFrameBrowser) | 298 if (pFrameBrowser) |
| 301 { | 299 { |
| 302 TraverseDocument(pFrameBrowser, false, indent); | 300 TraverseDocument(pFrameBrowser, false, indent); |
| 303 } | 301 } |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 { | 458 { |
| 461 m_cacheIndexLast = 0; | 459 m_cacheIndexLast = 0; |
| 462 m_cacheDocumentHasFrames.clear(); | 460 m_cacheDocumentHasFrames.clear(); |
| 463 m_cacheDocumentHasIframes.clear(); | 461 m_cacheDocumentHasIframes.clear(); |
| 464 } | 462 } |
| 465 m_criticalSection.Unlock(); | 463 m_criticalSection.Unlock(); |
| 466 } | 464 } |
| 467 | 465 |
| 468 | 466 |
| 469 #endif // _PLUGIN_DOM_TRAVERSER_BASE_H_ | 467 #endif // _PLUGIN_DOM_TRAVERSER_BASE_H_ |
| OLD | NEW |