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

Side by Side Diff: lib/prefs.js

Issue 29350042: Issue 4023 - Move storage of subscription lists to localStorage (Closed)
Patch Set: Add full stop after a comment and fix formatting Created Sept. 2, 2016, 4:10 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
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-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 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 throw new Error("Attempt to change preference type"); 247 throw new Error("Attempt to change preference type");
248 248
249 if (value == defaultValue) 249 if (value == defaultValue)
250 { 250 {
251 delete overrides[pref]; 251 delete overrides[pref];
252 ext.storage.remove(prefToKey(pref)); 252 ext.storage.remove(prefToKey(pref));
253 } 253 }
254 else 254 else
255 { 255 {
256 overrides[pref] = value; 256 overrides[pref] = value;
257 ext.storage.set(prefToKey(pref), value); 257
258 let items = {};
259 items[prefToKey(pref)] = value;
260 ext.storage.set(items);
258 } 261 }
259 }, 262 },
260 enumerable: true 263 enumerable: true
261 }); 264 });
262 } 265 }
263 266
264 function init() 267 function init()
265 { 268 {
266 let prefs = Object.keys(defaults); 269 let prefs = Object.keys(defaults);
267 prefs.forEach(addPreference); 270 prefs.forEach(addPreference);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 eventEmitter.emit(pref); 320 eventEmitter.emit(pref);
318 } 321 }
319 } 322 }
320 }); 323 });
321 } 324 }
322 325
323 Prefs.untilLoaded = Promise.all([localLoaded, managedLoaded]).then(onLoaded); 326 Prefs.untilLoaded = Promise.all([localLoaded, managedLoaded]).then(onLoaded);
324 } 327 }
325 328
326 init(); 329 init();
OLDNEW
« lib/io.js ('K') | « lib/lz-string.js ('k') | metadata.common » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld