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

Side by Side Diff: lib/prefs.js

Issue 29766575: Issue 4580 - Do not use Promise based storage API (Closed)
Patch Set: Created April 30, 2018, 9:12 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 | « no previous file | 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-present eyeo GmbH 3 * Copyright (C) 2006-present 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 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 }, 329 },
330 enumerable: true 330 enumerable: true
331 }); 331 });
332 } 332 }
333 333
334 function init() 334 function init()
335 { 335 {
336 let prefs = Object.keys(defaults); 336 let prefs = Object.keys(defaults);
337 prefs.forEach(addPreference); 337 prefs.forEach(addPreference);
338 338
339 let localLoaded = browser.storage.local.get(prefs.map(prefToKey)).then( 339 let localLoaded = browser.storage.local.get(prefs.map(prefToKey),
340 items => 340 items =>
341 { 341 {
342 for (let key in items) 342 for (let key in items)
343 overrides[keyToPref(key)] = items[key]; 343 overrides[keyToPref(key)] = items[key];
344 } 344 }
345 ); 345 );
346 346
347 let managedLoaded; 347 let managedLoaded;
348 if ("managed" in browser.storage) 348 if ("managed" in browser.storage)
349 { 349 {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 eventEmitter.emit(pref); 382 eventEmitter.emit(pref);
383 } 383 }
384 } 384 }
385 }); 385 });
386 } 386 }
387 387
388 Prefs.untilLoaded = Promise.all([localLoaded, managedLoaded]).then(onLoaded); 388 Prefs.untilLoaded = Promise.all([localLoaded, managedLoaded]).then(onLoaded);
389 } 389 }
390 390
391 init(); 391 init();
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld