 Issue 6235761431019520:
  Issue 342 - Speed up options page with many user filters on Safari  (Closed)
    
  
    Issue 6235761431019520:
  Issue 342 - Speed up options page with many user filters on Safari  (Closed) 
  | Index: background.js | 
| =================================================================== | 
| --- a/background.js | 
| +++ b/background.js | 
| @@ -26,6 +26,7 @@ | 
| { | 
| this.Subscription = Subscription; | 
| this.DownloadableSubscription = DownloadableSubscription; | 
| + this.SpecialSubscription = SpecialSubscription; | 
| } | 
| with(require("whitelisting")) | 
| { | 
| @@ -470,6 +471,33 @@ | 
| prepareNotificationIconAndPopup(); | 
| } | 
| +// This is a hack to speedup loading of the options page on Safari. | 
| +// Once we replaced the background page proxy with message passing | 
| +// this global function should removed. | 
| +function getUserFilter() | 
| 
Wladimir Palant
2014/04/16 17:25:39
Nit: getUserFilters() please (plural)
 | 
| +{ | 
| + var filters = []; | 
| + var exceptions = []; | 
| + | 
| + for (var i = 0; i < FilterStorage.subscriptions.length; i++) | 
| + { | 
| + var subscription = FilterStorage.subscriptions[i]; | 
| + if (!(subscription instanceof SpecialSubscription)) | 
| + continue; | 
| + | 
| + for (var j = 0; j < subscription.filters.length; j++) | 
| + { | 
| + var filter = subscription.filters[j]; | 
| + if (filter instanceof WhitelistFilter && /^@@\|\|([^\/:]+)\^\$document$/.test(filter.text)) | 
| + exceptions.push(RegExp.$1); | 
| + else | 
| + filters.push(filter.text); | 
| + } | 
| + } | 
| + | 
| + return {filters: filters, exceptions: exceptions}; | 
| +} | 
| + | 
| ext.onMessage.addListener(function (msg, sender, sendResponse) | 
| { | 
| switch (msg.type) |