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

Side by Side Diff: lib/prefs.js

Issue 29570614: Issue 5028 - Use browser namespace (Closed) Base URL: https://hg.adblockplus.org/adblockpluschrome/
Patch Set: Created Oct. 9, 2017, 3:12 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
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-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 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 { 312 {
313 for (let key in items) 313 for (let key in items)
314 overrides[keyToPref(key)] = items[key]; 314 overrides[keyToPref(key)] = items[key];
315 315
316 resolve(); 316 resolve();
317 }); 317 });
318 }); 318 });
319 319
320 let managedLoaded = new Promise(resolve => 320 let managedLoaded = new Promise(resolve =>
321 { 321 {
322 if (require("info").platform == "chromium" && "managed" in chrome.storage) 322 if (require("info").platform == "chromium" && "managed" in browser.storage)
323 { 323 {
324 chrome.storage.managed.get(null, items => 324 browser.storage.managed.get(null, items =>
325 { 325 {
326 // Opera doesn't support chrome.storage.managed, but instead simply 326 // Opera doesn't support browser.storage.managed, but instead simply
327 // removing the API, Opera sets chrome.runtime.lastError when using it. 327 // removing the API, Opera sets browser.runtime.lastError when using it.
328 // So we have to retrieve that error, to prevent it from showing up 328 // So we have to retrieve that error, to prevent it from showing up
329 // in the console. 329 // in the console.
330 chrome.runtime.lastError; 330 browser.runtime.lastError;
331 331
332 for (let key in items) 332 for (let key in items)
333 defaults[key] = items[key]; 333 defaults[key] = items[key];
334 334
335 resolve(); 335 resolve();
336 }); 336 });
337 } 337 }
338 else 338 else
339 { 339 {
340 resolve(); 340 resolve();
(...skipping 18 matching lines...) Expand all
359 eventEmitter.emit(pref); 359 eventEmitter.emit(pref);
360 } 360 }
361 } 361 }
362 }); 362 });
363 } 363 }
364 364
365 Prefs.untilLoaded = Promise.all([localLoaded, managedLoaded]).then(onLoaded); 365 Prefs.untilLoaded = Promise.all([localLoaded, managedLoaded]).then(onLoaded);
366 } 366 }
367 367
368 init(); 368 init();
OLDNEW

Powered by Google App Engine
This is Rietveld