 Issue 6432313504169984:
  Issue 1663 - Various Firefox-related changes of the first-run page  (Closed)
    
  
    Issue 6432313504169984:
  Issue 1663 - Various Firefox-related changes of the first-run page  (Closed) 
  | Index: messageResponder.js | 
| =================================================================== | 
| --- a/messageResponder.js | 
| +++ b/messageResponder.js | 
| @@ -12,16 +12,31 @@ | 
| * GNU General Public License for more details. | 
| * | 
| * You should have received a copy of the GNU General Public License | 
| * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | 
| */ | 
| (function(global) | 
| { | 
| + if (typeof ext == "undefined") | 
| 
Thomas Greiner
2015/01/07 12:19:55
Nit: To make it consistent with all other referenc
 
Sebastian Noack
2015/01/07 12:23:21
Why not just |"ext" in global| then?
 
Wladimir Palant
2015/01/07 16:33:10
Done.
 | 
| + global.ext = require("ext_background"); | 
| + | 
| + var Utils = require("utils").Utils; | 
| + var FilterStorage = require("filterStorage").FilterStorage; | 
| + var FilterNotifier = require("filterNotifier").FilterNotifier; | 
| + var defaultMatcher = require("matcher").defaultMatcher; | 
| + var BlockingFilter = require("filterClasses").BlockingFilter; | 
| + var Synchronizer = require("synchronizer").Synchronizer; | 
| + | 
| + var subscriptionClasses = require("subscriptionClasses"); | 
| + var Subscription = subscriptionClasses.Subscription; | 
| + var DownloadableSubscription = subscriptionClasses.DownloadableSubscription; | 
| + var SpecialSubscription = subscriptionClasses.SpecialSubscription; | 
| + | 
| var subscriptionKeys = ["disabled", "homepage", "lastSuccess", "title", "url", "downloadStatus"]; | 
| function convertSubscription(subscription) | 
| { | 
| var result = {}; | 
| for (var i = 0; i < subscriptionKeys.length; i++) | 
| result[subscriptionKeys[i]] = subscription[subscriptionKeys[i]] | 
| return result; | 
| } | 
| @@ -69,17 +84,17 @@ | 
| type: messageTypes[type], | 
| action: action, | 
| args: args | 
| }); | 
| } | 
| } | 
| }; | 
| - ext.onMessage.addListener(function(message, sender, callback) | 
| + global.ext.onMessage.addListener(function(message, sender, callback) | 
| { | 
| switch (message.type) | 
| { | 
| case "app.get": | 
| if (message.what == "issues") | 
| 
Thomas Greiner
2015/01/07 12:19:55
There's quite a bunch of ifs now so please turn th
 
Wladimir Palant
2015/01/07 16:33:10
Quite frankly, I consider a nested switch statemen
 
Thomas Greiner
2015/01/07 17:31:38
Since for this particular case we're debating pers
 
Wladimir Palant
2015/01/07 19:03:39
While I am inclined to agree, this will unfortunat
 | 
| { | 
| var info = require("info"); | 
| callback({ | 
| @@ -88,26 +103,33 @@ | 
| legacySafariVersion: (info.platform == "safari" && ( | 
| Services.vc.compare(info.platformVersion, "6.0") < 0 || // beforeload breaks websites in Safari 5 | 
| Services.vc.compare(info.platformVersion, "6.1") == 0 || // extensions are broken in 6.1 and 7.0 | 
| Services.vc.compare(info.platformVersion, "7.0") == 0)) | 
| }); | 
| } | 
| else if (message.what == "doclink") | 
| callback(Utils.getDocLink(message.link)); | 
| + else if (message.what == "localeInfo") | 
| + { | 
| + callback({ | 
| + locale: Utils.appLocale, | 
| + isRTL: Utils.chromeRegistry.isLocaleRTL("adblockplus") | 
| + }); | 
| + } | 
| else | 
| callback(null); | 
| break; | 
| case "app.open": | 
| if (message.what == "options") | 
| { | 
| - if (typeof UI != "undefined") | 
| - UI.openFiltersDialog(); | 
| + if (typeof global.openOptions == "function") | 
| + global.openOptions(); | 
| else | 
| - global.openOptions(); | 
| + require("ui").UI.openFiltersDialog(); | 
| } | 
| break; | 
| case "subscriptions.get": | 
| var subscriptions = FilterStorage.subscriptions.filter(function(s) | 
| { | 
| if (message.ignoreDisabled && s.disabled) | 
| return false; | 
| if (s instanceof DownloadableSubscription && message.downloadable) |