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

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

Issue 29331713: TEST ONLY -- Verify behavior of DISP_E_BADINDEX in the IE JavaScript runtime (Closed)
Patch Set: Created Dec. 1, 2015, 5: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
« no previous file with comments | « html/templates/test-bad-index.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 24 matching lines...) Expand all
35 dispatchID_SetLanguage, 35 dispatchID_SetLanguage,
36 dispatchID_GetLanguage, 36 dispatchID_GetLanguage,
37 dispatchID_GetWhitelistDomains, 37 dispatchID_GetWhitelistDomains,
38 dispatchID_AddWhitelistDomain, 38 dispatchID_AddWhitelistDomain,
39 dispatchID_RemoveWhitelistDomain, 39 dispatchID_RemoveWhitelistDomain,
40 dispatchID_GetAppLocale, 40 dispatchID_GetAppLocale,
41 dispatchID_GetDocumentationLink, 41 dispatchID_GetDocumentationLink,
42 dispatchID_IsAcceptableAdsEnabled, 42 dispatchID_IsAcceptableAdsEnabled,
43 dispatchID_SetAcceptableAdsEnabled, 43 dispatchID_SetAcceptableAdsEnabled,
44 dispatchID_IsUpdate, 44 dispatchID_IsUpdate,
45 dispatchID_TestBadIndex,
45 }; 46 };
46 47
47 /** 48 /**
48 * Auxiliary for static initialization 49 * Auxiliary for static initialization
49 */ 50 */
50 std::unordered_map<std::wstring, DISPID> InitMethodIndex() 51 std::unordered_map<std::wstring, DISPID> InitMethodIndex()
51 { 52 {
52 std::unordered_map<std::wstring, DISPID> m; 53 std::unordered_map<std::wstring, DISPID> m;
53 // try-block for safety during static initialization 54 // try-block for safety during static initialization
54 try 55 try
55 { 56 {
56 m.emplace(L"GetMessage", dispatchID_GetMessage); 57 m.emplace(L"GetMessage", dispatchID_GetMessage);
57 m.emplace(L"GetLanguageCount", dispatchID_GetLanguageCount); 58 m.emplace(L"GetLanguageCount", dispatchID_GetLanguageCount);
58 m.emplace(L"GetLanguageByIndex", dispatchID_GetLanguageByIndex); 59 m.emplace(L"GetLanguageByIndex", dispatchID_GetLanguageByIndex);
59 m.emplace(L"GetLanguageTitleByIndex", dispatchID_GetLanguageTitleByIndex); 60 m.emplace(L"GetLanguageTitleByIndex", dispatchID_GetLanguageTitleByIndex);
60 m.emplace(L"SetLanguage", dispatchID_SetLanguage); 61 m.emplace(L"SetLanguage", dispatchID_SetLanguage);
61 m.emplace(L"GetLanguage", dispatchID_GetLanguage); 62 m.emplace(L"GetLanguage", dispatchID_GetLanguage);
62 m.emplace(L"GetWhitelistDomains", dispatchID_GetWhitelistDomains); 63 m.emplace(L"GetWhitelistDomains", dispatchID_GetWhitelistDomains);
63 m.emplace(L"AddWhitelistDomain", dispatchID_AddWhitelistDomain); 64 m.emplace(L"AddWhitelistDomain", dispatchID_AddWhitelistDomain);
64 m.emplace(L"RemoveWhitelistDomain", dispatchID_RemoveWhitelistDomain); 65 m.emplace(L"RemoveWhitelistDomain", dispatchID_RemoveWhitelistDomain);
65 m.emplace(L"GetAppLocale", dispatchID_GetAppLocale); 66 m.emplace(L"GetAppLocale", dispatchID_GetAppLocale);
66 m.emplace(L"GetDocumentationLink", dispatchID_GetDocumentationLink); 67 m.emplace(L"GetDocumentationLink", dispatchID_GetDocumentationLink);
67 m.emplace(L"IsAcceptableAdsEnabled", dispatchID_IsAcceptableAdsEnabled); 68 m.emplace(L"IsAcceptableAdsEnabled", dispatchID_IsAcceptableAdsEnabled);
68 m.emplace(L"SetAcceptableAdsEnabled", dispatchID_SetAcceptableAdsEnabled); 69 m.emplace(L"SetAcceptableAdsEnabled", dispatchID_SetAcceptableAdsEnabled);
69 m.emplace(L"IsUpdate", dispatchID_IsUpdate); 70 m.emplace(L"IsUpdate", dispatchID_IsUpdate);
71 m.emplace(L"TestBadIndex", dispatchID_TestBadIndex);
70 } 72 }
71 catch(...) 73 catch(...)
72 { 74 {
73 } 75 }
74 return m; 76 return m;
75 } 77 }
76 78
77 /** 79 /**
78 * Static map from method names to dispatch identifiers. 80 * Static map from method names to dispatch identifiers.
79 */ 81 */
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 { 435 {
434 return DISP_E_BADPARAMCOUNT; 436 return DISP_E_BADPARAMCOUNT;
435 } 437 }
436 if (pVarResult) 438 if (pVarResult)
437 { 439 {
438 pVarResult->vt = VT_BOOL; 440 pVarResult->vt = VT_BOOL;
439 pVarResult->boolVal = CPluginClient::GetInstance()->GetPref(L"displayU pdatePage", false) ? VARIANT_TRUE : VARIANT_FALSE; 441 pVarResult->boolVal = CPluginClient::GetInstance()->GetPref(L"displayU pdatePage", false) ? VARIANT_TRUE : VARIANT_FALSE;
440 } 442 }
441 } 443 }
442 break; 444 break;
445 case dispatchID_TestBadIndex:
446 {
447 if (pDispparams->cArgs != 1)
448 {
449 return DISP_E_BADPARAMCOUNT;
450 }
451 if (pDispparams->rgvarg[0].vt != VT_I4)
452 {
453 return DISP_E_TYPEMISMATCH;
454 }
455 int index = pDispparams->rgvarg[0].lVal;
456 if (index >= 1)
457 {
458 return DISP_E_BADINDEX;
459 }
460 }
461 break;
443 default: 462 default:
444 return DISP_E_MEMBERNOTFOUND; 463 return DISP_E_MEMBERNOTFOUND;
445 break; 464 break;
446 } 465 }
447 } 466 }
448 catch (...) 467 catch (...)
449 { 468 {
450 return E_FAIL; 469 return E_FAIL;
451 } 470 }
452 return S_OK; 471 return S_OK;
453 } 472 }
OLDNEW
« no previous file with comments | « html/templates/test-bad-index.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld