OLD | NEW |
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 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 ext.storage.get(prefs.map(prefToKey), function(items) | 229 ext.storage.get(prefs.map(prefToKey), function(items) |
230 { | 230 { |
231 for (let key in items) | 231 for (let key in items) |
232 overrides[keyToPref(key)] = items[key]; | 232 overrides[keyToPref(key)] = items[key]; |
233 | 233 |
234 resolve(); | 234 resolve(); |
235 }); | 235 }); |
236 }); | 236 }); |
237 | 237 |
238 let managedLoaded = new Promise(resolve => { | 238 let managedLoaded = new Promise(resolve => { |
239 if (require("info").platform == "chromium" && "managed" in chrome.storage) | 239 if (typeof chrome == "object" && "managed" in chrome.storage) |
240 { | 240 { |
241 chrome.storage.managed.get(null, function(items) | 241 chrome.storage.managed.get(null, function(items) |
242 { | 242 { |
243 // Opera doesn't support chrome.storage.managed, but instead simply | 243 // Opera doesn't support chrome.storage.managed, but instead simply |
244 // removing the API, Opera sets chrome.runtime.lastError when using it. | 244 // removing the API, Opera sets chrome.runtime.lastError when using it. |
245 // So we have to retrieve that error, to prevent it from showing up | 245 // So we have to retrieve that error, to prevent it from showing up |
246 // in the console. | 246 // in the console. |
247 chrome.runtime.lastError; | 247 chrome.runtime.lastError; |
248 | 248 |
249 for (let key in items) | 249 for (let key in items) |
(...skipping 26 matching lines...) Expand all Loading... |
276 Prefs.onChanged._dispatch(pref); | 276 Prefs.onChanged._dispatch(pref); |
277 } | 277 } |
278 } | 278 } |
279 }); | 279 }); |
280 } | 280 } |
281 | 281 |
282 Prefs.isLoaded = Promise.all([localLoaded, managedLoaded]).then(onLoaded); | 282 Prefs.isLoaded = Promise.all([localLoaded, managedLoaded]).then(onLoaded); |
283 } | 283 } |
284 | 284 |
285 init(); | 285 init(); |
OLD | NEW |