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

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

Issue 29332959: Issue #1173 - Protect more entry points with try-catch blocks (Closed)
Left Patch Set: rebase only Created Jan. 5, 2016, 3:41 p.m.
Right Patch Set: Add log messages in new exception handlers Created Jan. 5, 2016, 3:57 p.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 | « no previous file | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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 992 matching lines...) Expand 10 before | Expand all | Expand 10 after
1003 { 1003 {
1004 try 1004 try
1005 { 1005 {
1006 if (cCmds == 0) return E_INVALIDARG; 1006 if (cCmds == 0) return E_INVALIDARG;
1007 if (prgCmds == 0) return E_POINTER; 1007 if (prgCmds == 0) return E_POINTER;
1008 1008
1009 prgCmds[0].cmdf = OLECMDF_ENABLED; 1009 prgCmds[0].cmdf = OLECMDF_ENABLED;
1010 } 1010 }
1011 catch (...) 1011 catch (...)
1012 { 1012 {
1013 DEBUG_GENERAL(L"CPluginClass::QueryStatus - exception");
1013 return E_FAIL; 1014 return E_FAIL;
1014 } 1015 }
1015 return S_OK; 1016 return S_OK;
1016 } 1017 }
1017 1018
1018 HMENU CPluginClass::CreatePluginMenu(const std::wstring& url) 1019 HMENU CPluginClass::CreatePluginMenu(const std::wstring& url)
1019 { 1020 {
1020 DEBUG_GENERAL("CreatePluginMenu"); 1021 DEBUG_GENERAL("CreatePluginMenu");
1021 HINSTANCE hInstance = _AtlBaseModule.GetModuleInstance(); 1022 HINSTANCE hInstance = _AtlBaseModule.GetModuleInstance();
1022 1023
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
1289 } 1290 }
1290 else 1291 else
1291 { 1292 {
1292 nFlags |= TPM_LEFTALIGN; 1293 nFlags |= TPM_LEFTALIGN;
1293 } 1294 }
1294 1295
1295 DisplayPluginMenu(hMenu, nIDCommand, pt, nFlags); 1296 DisplayPluginMenu(hMenu, nIDCommand, pt, nFlags);
1296 } 1297 }
1297 catch (...) 1298 catch (...)
1298 { 1299 {
1299 return E_FAIL; // Suppress exceptions, should log 1300 // Suppress exception, log only
1301 DEBUG_GENERAL(L"CPluginClass::Exec - exception");
1302 return E_FAIL;
1300 } 1303 }
1301 1304
1302 return S_OK; 1305 return S_OK;
1303 } 1306 }
1304 1307
1305 // Entry point 1308 // Entry point
1306 LRESULT CALLBACK CPluginClass::NewStatusProc(HWND hWnd, UINT message, WPARAM wPa ram, LPARAM lParam) 1309 LRESULT CALLBACK CPluginClass::NewStatusProc(HWND hWnd, UINT message, WPARAM wPa ram, LPARAM lParam)
1307 { 1310 {
1308 CPluginClass *pClass; 1311 CPluginClass *pClass;
1309 try 1312 try
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
1376 return hRet; 1379 return hRet;
1377 } 1380 }
1378 1381
1379 default: 1382 default:
1380 break; 1383 break;
1381 } 1384 }
1382 } 1385 }
1383 catch (...) 1386 catch (...)
1384 { 1387 {
1385 // Suppress exception. Fall through to default handler. 1388 // Suppress exception. Fall through to default handler.
1389 DEBUG_GENERAL(L"CPluginClass::NewStatusProc - exception");
1386 } 1390 }
1387 return ::CallWindowProc(pClass->m_pWndProcStatus, hWnd, message, wParam, lPara m); 1391 return ::CallWindowProc(pClass->m_pWndProcStatus, hWnd, message, wParam, lPara m);
1388 } 1392 }
1389 1393
1390 1394
1391 HICON CPluginClass::GetStatusBarIcon(const std::wstring& url) 1395 HICON CPluginClass::GetStatusBarIcon(const std::wstring& url)
1392 { 1396 {
1393 // use the disable icon as defualt, if the client doesn't exists 1397 // use the disable icon as defualt, if the client doesn't exists
1394 HICON hIcon = GetIcon(ICON_PLUGIN_DEACTIVATED); 1398 HICON hIcon = GetIcon(ICON_PLUGIN_DEACTIVATED);
1395 1399
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
1612 std::wstring downloadingText = dictionary->Lookup("updater", "downloadin g-update-text"); 1616 std::wstring downloadingText = dictionary->Lookup("updater", "downloadin g-update-text");
1613 std::wstring downloadingTitle = dictionary->Lookup("updater", "downloadi ng-update-title"); 1617 std::wstring downloadingTitle = dictionary->Lookup("updater", "downloadi ng-update-title");
1614 pClass->notificationMessage.SetTextAndIcon(downloadingText, downloadingT itle, TTI_INFO); 1618 pClass->notificationMessage.SetTextAndIcon(downloadingText, downloadingT itle, TTI_INFO);
1615 break; 1619 break;
1616 } 1620 }
1617 } 1621 }
1618 } 1622 }
1619 catch (...) 1623 catch (...)
1620 { 1624 {
1621 // Suppress exception. Fall through to default handler. 1625 // Suppress exception. Fall through to default handler.
1626 DEBUG_GENERAL(L"CPluginClass::PaneWindowProc - exception");
1622 } 1627 }
1623 return ::DefWindowProc(hWnd, message, wParam, lParam); 1628 return ::DefWindowProc(hWnd, message, wParam, lParam);
1624 } 1629 }
1625 1630
1626 1631
1627 void CPluginClass::UpdateStatusBar() 1632 void CPluginClass::UpdateStatusBar()
1628 { 1633 {
1629 DEBUG_GENERAL("*** Updating statusbar") 1634 DEBUG_GENERAL("*** Updating statusbar")
1630 if (m_hPaneWnd == NULL) 1635 if (m_hPaneWnd == NULL)
1631 { 1636 {
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
1682 s_criticalSectionLocal.Unlock(); 1687 s_criticalSectionLocal.Unlock();
1683 1688
1684 return icon; 1689 return icon;
1685 } 1690 }
1686 1691
1687 ATOM CPluginClass::GetAtomPaneClass() 1692 ATOM CPluginClass::GetAtomPaneClass()
1688 { 1693 {
1689 return s_atomPaneClass; 1694 return s_atomPaneClass;
1690 } 1695 }
1691 1696
LEFTRIGHT
« no previous file | no next file » | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
This is Rietveld