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

Side by Side Diff: lib/prefs.js

Issue 5721433737003008: Issue 1985 - Replaced __proto__ with Object.create() and Object.getPrototypeOf() (Closed)
Patch Set: Created Feb. 11, 2015, 11:51 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
« no previous file with comments | « lib/compat.js ('k') | lib/whitelisting.js » ('j') | 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
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details. 12 * GNU General Public License for more details.
13 * 13 *
14 * You should have received a copy of the GNU General Public License 14 * You should have received a copy of the GNU General Public License
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
16 */ 16 */
17 17
18 // 18 //
19 // The values are hardcoded for now. 19 // The values are hardcoded for now.
20 // 20 //
21 21
22 let defaults = { 22 let defaults = Object.create(null);
23 __proto__: null, 23 defaults.enabled = true;
24 enabled: true, 24 defaults.data_directory = "";
25 data_directory: "", 25 defaults.patternsbackups = 5;
26 patternsbackups: 5, 26 defaults.patternsbackupinterval = 24;
27 patternsbackupinterval: 24, 27 defaults.savestats = false;
28 savestats: false, 28 defaults.privateBrowsing = false;
29 privateBrowsing: false, 29 defaults.subscriptions_fallbackerrors = 5;
30 subscriptions_fallbackerrors: 5, 30 defaults.subscriptions_fallbackurl = "https://adblockplus.org/getSubscription?ve rsion=%VERSION%&url=%SUBSCRIPTION%&downloadURL=%URL%&error=%ERROR%&channelStatus =%CHANNELSTATUS%&responseStatus=%RESPONSESTATUS%";
31 subscriptions_fallbackurl: "https://adblockplus.org/getSubscription?version=%V ERSION%&url=%SUBSCRIPTION%&downloadURL=%URL%&error=%ERROR%&channelStatus=%CHANNE LSTATUS%&responseStatus=%RESPONSESTATUS%", 31 defaults.subscriptions_autoupdate = true;
32 subscriptions_autoupdate: true, 32 defaults.subscriptions_exceptionsurl = "https://easylist-downloads.adblockplus.o rg/exceptionrules.txt";
33 subscriptions_exceptionsurl: "https://easylist-downloads.adblockplus.org/excep tionrules.txt", 33 defaults.subscriptions_antiadblockurl = "https://easylist-downloads.adblockplus. org/antiadblockfilters.txt";
34 subscriptions_antiadblockurl: "https://easylist-downloads.adblockplus.org/anti adblockfilters.txt", 34 defaults.documentation_link = "https://adblockplus.org/redirect?link=%LINK%&lang =%LANG%";
35 documentation_link: "https://adblockplus.org/redirect?link=%LINK%&lang=%LANG%" , 35 defaults.notificationdata = {};
36 notificationdata: {}, 36 defaults.notificationurl = "https://notification.adblockplus.org/notification.js on";
37 notificationurl: "https://notification.adblockplus.org/notification.json", 37 defaults.stats_total = {};
38 stats_total: {}, 38 defaults.show_statsinicon = true;
39 show_statsinicon: true, 39 defaults.show_statsinpopup = true;
40 show_statsinpopup: true, 40 defaults.shouldShowBlockElementMenu = true;
41 shouldShowBlockElementMenu: true, 41 defaults.hidePlaceholders = true;
42 hidePlaceholders: true
43 };
44 42
45 let listeners = []; 43 let listeners = [];
46 44
47 function defineProperty(key) 45 function defineProperty(key)
48 { 46 {
49 let value = null; 47 let value = null;
50 Prefs.__defineGetter__(key, function() 48 Prefs.__defineGetter__(key, function()
51 { 49 {
52 if (value === null) 50 if (value === null)
53 { 51 {
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 removeListener: function(listener) 97 removeListener: function(listener)
100 { 98 {
101 let index = listeners.indexOf(listener); 99 let index = listeners.indexOf(listener);
102 if (index >= 0) 100 if (index >= 0)
103 listeners.splice(index, 1); 101 listeners.splice(index, 1);
104 }, 102 },
105 }; 103 };
106 104
107 for (let key in defaults) 105 for (let key in defaults)
108 defineProperty(key); 106 defineProperty(key);
OLDNEW
« no previous file with comments | « lib/compat.js ('k') | lib/whitelisting.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld