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

Side by Side Diff: safari/ext/background.js

Issue 29339112: Issue 3716 - Split up files stored in storage.local (Closed)
Patch Set: Make sure we don't leak chunks. Edit comments. Simplify safari storage. Created March 31, 2016, 6:33 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 | « lib/prefs.js ('k') | 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-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 687 matching lines...) Expand 10 before | Expand all | Expand 10 after
698 698
699 for (var i = 0; i < keys.length; i++) 699 for (var i = 0; i < keys.length; i++)
700 { 700 {
701 var key = keys[i]; 701 var key = keys[i];
702 if (key in settings) 702 if (key in settings)
703 items[key] = settings[key]; 703 items[key] = settings[key];
704 } 704 }
705 705
706 setTimeout(callback, 0, items); 706 setTimeout(callback, 0, items);
707 }, 707 },
708 set: function(key, value, callback) 708 set: function(items, callback)
709 { 709 {
710 safari.extension.settings[key] = value; 710 for (let key in items)
711 711 {
Sebastian Noack 2016/03/31 19:30:25 Nit: the braces here are unnecessary.
712 safari.extension.settings[key] = items[key];
713 }
712 if (callback) 714 if (callback)
713 setTimeout(callback, 0); 715 setTimeout(callback, 0);
Sebastian Noack 2016/03/31 19:30:25 Nit: While changing the code here anyway, note tha
714 }, 716 },
715 remove: function(key, callback) 717 remove: function(key, callback)
716 { 718 {
717 delete safari.extension.settings[key]; 719 delete safari.extension.settings[key];
718 720
719 if (callback) 721 if (callback)
720 setTimeout(callback, 0); 722 setTimeout(callback, 0);
721 }, 723 },
722 onChanged: new ext._EventTarget() 724 onChanged: new ext._EventTarget()
723 }; 725 };
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
762 /* Windows */ 764 /* Windows */
763 ext.windows = { 765 ext.windows = {
764 // Safari doesn't provide as rich a windows API as Chrome does, so instead 766 // Safari doesn't provide as rich a windows API as Chrome does, so instead
765 // of chrome.windows.create we have to fall back to just opening a new tab. 767 // of chrome.windows.create we have to fall back to just opening a new tab.
766 create: function(createData, callback) 768 create: function(createData, callback)
767 { 769 {
768 ext.pages.open(createData.url, callback); 770 ext.pages.open(createData.url, callback);
769 } 771 }
770 }; 772 };
771 })(); 773 })();
OLDNEW
« no previous file with comments | « lib/prefs.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld