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

Delta Between Two Patch Sets: options.js

Issue 29417597: Issue 5161 - Use maps and sets where appropriate (Closed) Base URL: https://hg.adblockplus.org/adblockpluschrome/
Left Patch Set: Created April 19, 2017, 4:33 p.m.
Right Patch Set: Minor unrelated changes Created May 21, 2017, 10:15 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 | « lib/whitelisting.js ('k') | 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-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 20 matching lines...) Expand all
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.assign(Object.create(null), baseMessage); 40 let message = Object.assign(Object.create(null), baseMessage);
41
42 let callback; 41 let callback;
43 42
44 if (paramValues.length > 0) 43 if (paramValues.length > 0)
45 { 44 {
46 let lastArg = paramValues[paramValues.length - 1]; 45 let lastArg = paramValues[paramValues.length - 1];
47 if (typeof lastArg == "function") 46 if (typeof lastArg == "function")
48 callback = lastArg; 47 callback = lastArg;
49 48
50 for (let i = 0; i < paramValues.length - (callback ? 1 : 0); i++) 49 for (let i = 0; i < paramValues.length - (callback ? 1 : 0); i++)
51 message[paramKeys[i]] = paramValues[i]; 50 message[paramKeys[i]] = paramValues[i];
(...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after
734 onFilterMessage(message.action, message.args[0]); 733 onFilterMessage(message.action, message.args[0]);
735 break; 734 break;
736 case "prefs.respond": 735 case "prefs.respond":
737 onPrefMessage(message.action, message.args[0]); 736 onPrefMessage(message.action, message.args[0]);
738 break; 737 break;
739 case "subscriptions.respond": 738 case "subscriptions.respond":
740 onSubscriptionMessage(message.action, message.args[0]); 739 onSubscriptionMessage(message.action, message.args[0]);
741 break; 740 break;
742 } 741 }
743 }); 742 });
LEFTRIGHT

Powered by Google App Engine
This is Rietveld