 Issue 29532767:
  Issue 5593 - Use messaging in popup for prefs, whitelisting, and stats  (Closed) 
  Base URL: https://hg.adblockplus.org/adblockpluschrome/
    
  
    Issue 29532767:
  Issue 5593 - Use messaging in popup for prefs, whitelisting, and stats  (Closed) 
  Base URL: https://hg.adblockplus.org/adblockpluschrome/| Index: ext/popup.js | 
| =================================================================== | 
| --- a/ext/popup.js | 
| +++ b/ext/popup.js | 
| @@ -2,29 +2,40 @@ | 
| (function() | 
| { | 
| if (typeof chrome == "undefined" || typeof chrome.extension == "undefined") | 
| window.chrome = browser; | 
| const backgroundPage = chrome.extension.getBackgroundPage(); | 
| window.ext = Object.create(backgroundPage.ext); | 
| - window.ext.closePopup = () => | 
| - { | 
| - window.close(); | 
| - }; | 
| - | 
| // Calling i18n.getMessage from the background page causes Edge to throw an | 
| // exception. | 
| // https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/12793975/ | 
| window.ext.i18n = chrome.i18n; | 
| // We have to override ext.backgroundPage, because in order | 
| // to send messages the local "chrome" namespace must be used. | 
| window.ext.backgroundPage = { | 
| sendMessage: chrome.runtime.sendMessage, | 
| getWindow() | 
| { | 
| return backgroundPage; | 
| } | 
| }; | 
| + | 
| + window.ext.closePopup = () => | 
| + { | 
| + window.close(); | 
| + }; | 
| + | 
| + window.ext.prefs = { | 
| + get(key, callback) | 
| + { | 
| + chrome.runtime.sendMessage({type: "prefs.get", key}, callback); | 
| + }, | 
| + toggle(key, callback) | 
| 
Manish Jethani
2017/09/01 15:56:20
The callback will be needed here if 29533613 lands
 | 
| + { | 
| + chrome.runtime.sendMessage({type: "prefs.toggle", key}, callback); | 
| + } | 
| + }; | 
| }()); |