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

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

Issue 5251132066627584: Issue 1488 - Add pre-configurable preference to suppress first run page (Closed)
Patch Set: Created March 19, 2015, 2:24 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
« lib/prefs.js ('K') | « qunit/common.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-2015 Eyeo GmbH 3 * Copyright (C) 2006-2015 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 685 matching lines...) Expand 10 before | Expand all | Expand 10 after
696 { 696 {
697 delete safari.extension.settings[key]; 697 delete safari.extension.settings[key];
698 698
699 if (callback) 699 if (callback)
700 setTimeout(callback, 0); 700 setTimeout(callback, 0);
701 }, 701 },
702 onChanged: new ext._EventTarget(), 702 onChanged: new ext._EventTarget(),
703 703
704 // Preferences were previously encoded as JSON for compatibility 704 // Preferences were previously encoded as JSON for compatibility
705 // with localStorage, which has been used on Chrome. 705 // with localStorage, which has been used on Chrome.
706 migratePrefs: function(mapFunc) 706 migratePrefs: function(hooks)
707 { 707 {
708 var settings = safari.extension.settings; 708 var settings = safari.extension.settings;
709 709
710 for (var key in settings) 710 for (var key in settings)
711 { 711 {
712 var item = mapFunc(key, settings[key]); 712 var item = hooks.map(key, settings[key]);
713 713
714 // Only touch settings if the key changed. Otherwise we would keep 714 // Only touch settings if the key changed. Otherwise we would keep
715 // migrating "currentVersion" over and over again on every initilization . 715 // migrating "currentVersion" over and over again on every initilization .
716 if (item && item.key != key) 716 if (item && item.key != key)
717 { 717 {
718 delete settings[key]; 718 delete settings[key];
719 settings[item.key] = item.value; 719 settings[item.key] = item.value;
720 } 720 }
721 } 721 }
722
723 hooks.done();
722 }, 724 },
723 725
724 // While moving away from the FileSystem API on Chrome the data structure 726 // While moving away from the FileSystem API on Chrome the data structure
725 // for files on Safari changed as well, in order to keep thing consistent. 727 // for files on Safari changed as well, in order to keep thing consistent.
726 migrateFiles: function(callback) 728 migrateFiles: function(callback)
727 { 729 {
728 var settings = safari.extension.settings; 730 var settings = safari.extension.settings;
729 731
730 for (var key in settings) 732 for (var key in settings)
731 { 733 {
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
783 tab.activate(); 785 tab.activate();
784 if (callback) 786 if (callback)
785 callback(page); 787 callback(page);
786 return; 788 return;
787 } 789 }
788 } 790 }
789 791
790 ext.pages.open(optionsUrl, callback); 792 ext.pages.open(optionsUrl, callback);
791 }; 793 };
792 })(); 794 })();
OLDNEW
« lib/prefs.js ('K') | « qunit/common.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld