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

Delta Between Two Patch Sets: lib/prefs.js

Issue 29621569: Issue 6050 - Use localStorage for blocked_total preference on Gecko (Closed)
Left Patch Set: Created Nov. 27, 2017, 6:24 p.m.
Right Patch Set: Use parseInt instead of JSON.parse Created Nov. 27, 2017, 6:51 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 | « no previous file | 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-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 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 ext.storage.get(prefs.map(prefToKey), items => 309 ext.storage.get(prefs.map(prefToKey), items =>
310 { 310 {
311 for (let key in items) 311 for (let key in items)
312 overrides[keyToPref(key)] = items[key]; 312 overrides[keyToPref(key)] = items[key];
313 313
314 if (require("info").platform == "gecko") 314 if (require("info").platform == "gecko")
315 { 315 {
316 let blockedTotal = window.localStorage.getItem("blocked_total"); 316 let blockedTotal = window.localStorage.getItem("blocked_total");
317 if (typeof blockedTotal == "string") 317 if (typeof blockedTotal == "string")
318 { 318 {
319 blockedTotal = JSON.parse(blockedTotal); 319 blockedTotal = parseInt(blockedTotal, 10);
320 if (blockedTotal > overrides.blocked_total) 320 if (blockedTotal > overrides.blocked_total)
321 { 321 {
322 overrides.blocked_total = blockedTotal; 322 overrides.blocked_total = blockedTotal;
323 savePref("blocked_total"); 323 savePref("blocked_total");
324 } 324 }
325 } 325 }
326 } 326 }
327 327
328 resolve(); 328 resolve();
329 }); 329 });
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 eventEmitter.emit(pref); 371 eventEmitter.emit(pref);
372 } 372 }
373 } 373 }
374 }); 374 });
375 } 375 }
376 376
377 Prefs.untilLoaded = Promise.all([localLoaded, managedLoaded]).then(onLoaded); 377 Prefs.untilLoaded = Promise.all([localLoaded, managedLoaded]).then(onLoaded);
378 } 378 }
379 379
380 init(); 380 init();
LEFTRIGHT
« no previous file | no next file » | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
This is Rietveld