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: Rebase Created Oct. 13, 2017, 4:53 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/popupBlocker.js ('k') | lib/requestBlocker.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-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 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 { 317 {
318 for (let key in items) 318 for (let key in items)
319 overrides[keyToPref(key)] = items[key]; 319 overrides[keyToPref(key)] = items[key];
320 320
321 resolve(); 321 resolve();
322 }); 322 });
323 }); 323 });
324 324
325 let managedLoaded = new Promise(resolve => 325 let managedLoaded = new Promise(resolve =>
326 { 326 {
327 if (require("info").platform == "chromium" && "managed" in chrome.storage) 327 if (require("info").platform == "chromium" && "managed" in browser.storage)
328 { 328 {
329 chrome.storage.managed.get(null, items => 329 browser.storage.managed.get(null, items =>
330 { 330 {
331 // Opera doesn't support chrome.storage.managed, but instead simply 331 // Opera doesn't support browser.storage.managed, but instead simply
332 // removing the API, Opera sets chrome.runtime.lastError when using it. 332 // removing the API, Opera sets browser.runtime.lastError when using it.
333 // So we have to retrieve that error, to prevent it from showing up 333 // So we have to retrieve that error, to prevent it from showing up
334 // in the console. 334 // in the console.
335 chrome.runtime.lastError; 335 browser.runtime.lastError;
336 336
337 for (let key in items) 337 for (let key in items)
338 defaults[key] = items[key]; 338 defaults[key] = items[key];
339 339
340 resolve(); 340 resolve();
341 }); 341 });
342 } 342 }
343 else 343 else
344 { 344 {
345 resolve(); 345 resolve();
(...skipping 18 matching lines...) Expand all
364 eventEmitter.emit(pref); 364 eventEmitter.emit(pref);
365 } 365 }
366 } 366 }
367 }); 367 });
368 } 368 }
369 369
370 Prefs.untilLoaded = Promise.all([localLoaded, managedLoaded]).then(onLoaded); 370 Prefs.untilLoaded = Promise.all([localLoaded, managedLoaded]).then(onLoaded);
371 } 371 }
372 372
373 init(); 373 init();
OLDNEW
« no previous file with comments | « lib/popupBlocker.js ('k') | lib/requestBlocker.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld