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

Side by Side Diff: options.js

Issue 29417597: Issue 5161 - Use maps and sets where appropriate (Closed) Base URL: https://hg.adblockplus.org/adblockpluschrome/
Patch Set: Created April 19, 2017, 4:33 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
« lib/popupBlocker.js ('K') | « lib/whitelisting.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-2017 eyeo GmbH 3 * Copyright (C) 2006-2017 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 19 matching lines...) Expand all
30 * taking any values as specified by the paramKeys 30 * taking any values as specified by the paramKeys
31 * and finally an optional callback. (Although the 31 * and finally an optional callback. (Although the
32 * value arguments are optional their index must be 32 * value arguments are optional their index must be
33 * maintained. E.g. if you omit the first value you 33 * maintained. E.g. if you omit the first value you
34 * must omit the second too.) 34 * must omit the second too.)
35 */ 35 */
36 function wrapper(baseMessage, ...paramKeys) 36 function wrapper(baseMessage, ...paramKeys)
37 { 37 {
38 return function(...paramValues /* , callback */) 38 return function(...paramValues /* , callback */)
39 { 39 {
40 let message = Object.create(null); 40 let message = Object.assign(Object.create(null), baseMessage);
41 for (let key in baseMessage)
42 {
43 if (baseMessage.hasOwnProperty(key))
44 message[key] = baseMessage[key];
45 }
46 41
47 let callback; 42 let callback;
48 43
49 if (paramValues.length > 0) 44 if (paramValues.length > 0)
50 { 45 {
51 let lastArg = paramValues[paramValues.length - 1]; 46 let lastArg = paramValues[paramValues.length - 1];
52 if (typeof lastArg == "function") 47 if (typeof lastArg == "function")
53 callback = lastArg; 48 callback = lastArg;
54 49
55 for (let i = 0; i < paramValues.length - (callback ? 1 : 0); i++) 50 for (let i = 0; i < paramValues.length - (callback ? 1 : 0); i++)
(...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after
739 onFilterMessage(message.action, message.args[0]); 734 onFilterMessage(message.action, message.args[0]);
740 break; 735 break;
741 case "prefs.respond": 736 case "prefs.respond":
742 onPrefMessage(message.action, message.args[0]); 737 onPrefMessage(message.action, message.args[0]);
743 break; 738 break;
744 case "subscriptions.respond": 739 case "subscriptions.respond":
745 onSubscriptionMessage(message.action, message.args[0]); 740 onSubscriptionMessage(message.action, message.args[0]);
746 break; 741 break;
747 } 742 }
748 }); 743 });
OLDNEW
« lib/popupBlocker.js ('K') | « lib/whitelisting.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld