Left: | ||
Right: |
LEFT | RIGHT |
---|---|
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 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
289 { | 289 { |
290 m_isAdviced = true; | 290 m_isAdviced = true; |
291 | 291 |
292 try | 292 try |
293 { | 293 { |
294 std::thread startInitObjectThread(StartInitObject, this); | 294 std::thread startInitObjectThread(StartInitObject, this); |
295 startInitObjectThread.detach(); // TODO: but actually we should wa it for the thread in the dtr. | 295 startInitObjectThread.detach(); // TODO: but actually we should wa it for the thread in the dtr. |
296 } | 296 } |
297 catch (const std::system_error& ex) | 297 catch (const std::system_error& ex) |
298 { | 298 { |
299 auto errDescription = std::string("Class::Thread - Failed to creat e StartInitObject thread, ") + | 299 DEBUG_SYSTEM_EXCEPTION(ex, PLUGIN_ERROR_THREAD, PLUGIN_ERROR_MAIN_ THREAD_CREATE_PROCESS, |
300 ex.code().message() + ex.what(); | 300 "Class::Thread - Failed to create StartInitObject thread"); |
301 DEBUG_ERROR_LOG(ex.code().value(), PLUGIN_ERROR_THREAD, PLUGIN_ERR OR_MAIN_THREAD_CREATE_PROCESS, errDescription.c_str()); | |
302 } | 301 } |
303 } | 302 } |
304 else | 303 else |
305 { | 304 { |
306 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_SET_SITE, PLUGIN_ERROR_SET_SITE_ADV ICE, "Class::SetSite - Advice"); | 305 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_SET_SITE, PLUGIN_ERROR_SET_SITE_ADV ICE, "Class::SetSite - Advice"); |
307 } | 306 } |
308 } | 307 } |
309 } | 308 } |
310 else // Check if loaded as toolbar handler | 309 else // Check if loaded as toolbar handler |
311 { | 310 { |
(...skipping 22 matching lines...) Expand all Loading... | |
334 } | 333 } |
335 s_criticalSectionBrowser.Unlock(); | 334 s_criticalSectionBrowser.Unlock(); |
336 } | 335 } |
337 } | 336 } |
338 else | 337 else |
339 { | 338 { |
340 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_SET_SITE, PLUGIN_ERROR_SET_SITE_QUERY _SERVICE_PROVIDER, "Class::SetSite - QueryInterface (service provider)"); | 339 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_SET_SITE, PLUGIN_ERROR_SET_SITE_QUERY _SERVICE_PROVIDER, "Class::SetSite - QueryInterface (service provider)"); |
341 } | 340 } |
342 } | 341 } |
343 } | 342 } |
344 catch (std::runtime_error e) | 343 catch (const std::runtime_error& ex) |
345 { | 344 { |
346 DEBUG_ERROR(e.what()); | 345 DEBUG_EXCEPTION(ex); |
347 Unadvice(); | 346 Unadvice(); |
348 } | 347 } |
349 } | 348 } |
350 else | 349 else |
351 { | 350 { |
352 // Unadvice | 351 // Unadvice |
353 Unadvice(); | 352 Unadvice(); |
354 | 353 |
355 // Destroy window | 354 // Destroy window |
356 if (m_pWndProcStatus) | 355 if (m_pWndProcStatus) |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
570 // If webbrowser2 is equal to top level browser (as set in SetSite), we are na vigating new page | 569 // If webbrowser2 is equal to top level browser (as set in SetSite), we are na vigating new page |
571 CPluginClient* client = CPluginClient::GetInstance(); | 570 CPluginClient* client = CPluginClient::GetInstance(); |
572 CString urlLegacy = ToCString(url); | 571 CString urlLegacy = ToCString(url); |
573 if (urlLegacy.Find(L"javascript") == 0) | 572 if (urlLegacy.Find(L"javascript") == 0) |
574 { | 573 { |
575 } | 574 } |
576 else if (GetBrowser().IsEqualObject(WebBrowser2Ptr)) | 575 else if (GetBrowser().IsEqualObject(WebBrowser2Ptr)) |
577 { | 576 { |
578 m_tab->OnNavigate(url); | 577 m_tab->OnNavigate(url); |
579 | 578 |
580 DEBUG_GENERAL(L"============================================================ ====================\nBegin main navigation url:" + urlLegacy + "\n============= ===================================================================") | 579 DEBUG_GENERAL( |
580 L"======================================================================== ========\n" | |
581 L"Begin main navigation url:" + url + L"\n" | |
582 L"======================================================================== ========") | |
581 | 583 |
582 #ifdef ENABLE_DEBUG_RESULT | 584 #ifdef ENABLE_DEBUG_RESULT |
583 CPluginDebug::DebugResultDomain(urlLegacy); | 585 CPluginDebug::DebugResultDomain(url); |
584 #endif | 586 #endif |
585 | 587 |
586 UpdateStatusBar(); | 588 UpdateStatusBar(); |
587 } | 589 } |
588 else | 590 else |
589 { | 591 { |
590 DEBUG_NAVI(L"Navi::Begin navigation url:" + urlLegacy) | 592 DEBUG_NAVI(L"Navi::Begin navigation url:" + url) |
591 m_tab->CacheFrame(url); | 593 m_tab->CacheFrame(url); |
592 } | 594 } |
593 } | 595 } |
594 | 596 |
595 /* | 597 /* |
596 * #1163 implements behavior for method DISPID_WINDOWSTATECHANGED in CPluginClas s::Invoke | 598 * #1163 implements behavior for method DISPID_WINDOWSTATECHANGED in CPluginClas s::Invoke |
597 * - should validate and convert arguments in Invoke, not here | 599 * - should validate and convert arguments in Invoke, not here |
598 * - does not validate number of arguments before indexing into 'rgvarg' | 600 * - does not validate number of arguments before indexing into 'rgvarg' |
599 * - does not validate type of argument before using its value | 601 * - does not validate type of argument before using its value |
600 */ | 602 */ |
(...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1265 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_NAVIGATION, PLUGIN_ERROR_NAVIGATION _SETTINGS, "Navigation::Failed") | 1267 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_NAVIGATION, PLUGIN_ERROR_NAVIGATION _SETTINGS, "Navigation::Failed") |
1266 } | 1268 } |
1267 } | 1269 } |
1268 } | 1270 } |
1269 break; | 1271 break; |
1270 } | 1272 } |
1271 case ID_MENU_DISABLE_ON_SITE: | 1273 case ID_MENU_DISABLE_ON_SITE: |
1272 { | 1274 { |
1273 CPluginSettings* settings = CPluginSettings::GetInstance(); | 1275 CPluginSettings* settings = CPluginSettings::GetInstance(); |
1274 std::wstring urlString = GetTab()->GetDocumentUrl(); | 1276 std::wstring urlString = GetTab()->GetDocumentUrl(); |
1275 std::string filterText; | 1277 std::string filterText = client->GetWhitelistingFilter(urlString); |
1276 if (client->IsWhitelistedUrl(urlString, filterText)) | 1278 if (!filterText.empty()) |
Oleksandr
2015/03/11 13:10:38
Felix has pointed out that we are actually leaking
sergei
2015/03/11 13:16:06
Has Felix seen the previous approach, which is muc
| |
1277 { | 1279 { |
1278 client->RemoveFilter(filterText); | 1280 client->RemoveFilter(filterText); |
1279 } | 1281 } |
1280 else | 1282 else |
1281 { | 1283 { |
1282 settings->AddWhiteListedDomain(ToCString(client->GetHostFromUrl(urlStrin g))); | 1284 settings->AddWhiteListedDomain(ToCString(client->GetHostFromUrl(urlStrin g))); |
1283 } | 1285 } |
1284 GetBrowser()->Refresh(); | 1286 GetBrowser()->Refresh(); |
1285 } | 1287 } |
1286 default: | 1288 default: |
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1800 | 1802 |
1801 s_criticalSectionLocal.Lock(); | 1803 s_criticalSectionLocal.Lock(); |
1802 { | 1804 { |
1803 if (!s_hIcons[type]) | 1805 if (!s_hIcons[type]) |
1804 { | 1806 { |
1805 std::wstring imageToLoad = L"#"; | 1807 std::wstring imageToLoad = L"#"; |
1806 imageToLoad += std::to_wstring(s_hIconTypes[type]); | 1808 imageToLoad += std::to_wstring(s_hIconTypes[type]); |
1807 s_hIcons[type] = (HICON)::LoadImage(_Module.m_hInst, imageToLoad.c_str(), IMAGE_ICON, iconWidth, iconHeight, LR_SHARED); | 1809 s_hIcons[type] = (HICON)::LoadImage(_Module.m_hInst, imageToLoad.c_str(), IMAGE_ICON, iconWidth, iconHeight, LR_SHARED); |
1808 if (!s_hIcons[type]) | 1810 if (!s_hIcons[type]) |
1809 { | 1811 { |
1810 DEBUG_ERROR_LOG(::GetLastError(), PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_LOAD_ ICON, "Class::GetIcon - LoadIcon") | 1812 DEBUG_ERROR_LOG(::GetLastError(), PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_LOAD_ ICON, "Class::GetIcon - LoadIcon"); |
1811 } | 1813 } |
1812 } | 1814 } |
1813 | 1815 |
1814 icon = s_hIcons[type]; | 1816 icon = s_hIcons[type]; |
1815 } | 1817 } |
1816 s_criticalSectionLocal.Unlock(); | 1818 s_criticalSectionLocal.Unlock(); |
1817 | 1819 |
1818 return icon; | 1820 return icon; |
1819 } | 1821 } |
1820 | 1822 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1885 } | 1887 } |
1886 } | 1888 } |
1887 } | 1889 } |
1888 | 1890 |
1889 hTabWnd = ::GetWindow(hTabWnd, GW_HWNDNEXT); | 1891 hTabWnd = ::GetWindow(hTabWnd, GW_HWNDNEXT); |
1890 } | 1892 } |
1891 | 1893 |
1892 return hTabWnd; | 1894 return hTabWnd; |
1893 | 1895 |
1894 } | 1896 } |
LEFT | RIGHT |