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

Delta Between Two Patch Sets: lib/prefs.js

Issue 29339112: Issue 3716 - Split up files stored in storage.local (Closed)
Left Patch Set: Remove setMultiple. Use suggested code. Created March 31, 2016, 9:51 a.m.
Right Patch Set: Remove the trailing comma. Created April 1, 2016, 1:14 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/io.js ('k') | safari/ext/background.js » ('j') | 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-2016 Eyeo GmbH 3 * Copyright (C) 2006-2016 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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 207
208 if (value == defaultValue) 208 if (value == defaultValue)
209 { 209 {
210 delete overrides[pref]; 210 delete overrides[pref];
211 ext.storage.remove(prefToKey(pref)); 211 ext.storage.remove(prefToKey(pref));
212 } 212 }
213 else 213 else
214 { 214 {
215 overrides[pref] = value; 215 overrides[pref] = value;
216 216
217 let storageItems = {}; 217 let items = {};
Sebastian Noack 2016/03/31 12:36:54 Nit: Just call this variable items for consistence
218 storageItems[prefToKey(pref)] = value; 218 items[prefToKey(pref)] = value;
219 ext.storage.set(storageItems); 219 ext.storage.set(items);
220 } 220 }
221 }, 221 },
222 enumerable: true 222 enumerable: true
223 }); 223 });
224 } 224 }
225 225
226 function init() 226 function init()
227 { 227 {
228 let prefs = Object.keys(defaults); 228 let prefs = Object.keys(defaults);
229 prefs.forEach(addPreference); 229 prefs.forEach(addPreference);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 Prefs.onChanged._dispatch(pref); 279 Prefs.onChanged._dispatch(pref);
280 } 280 }
281 } 281 }
282 }); 282 });
283 } 283 }
284 284
285 Prefs.isLoaded = Promise.all([localLoaded, managedLoaded]).then(onLoaded); 285 Prefs.isLoaded = Promise.all([localLoaded, managedLoaded]).then(onLoaded);
286 } 286 }
287 287
288 init(); 288 init();
LEFTRIGHT

Powered by Google App Engine
This is Rietveld