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

Side by Side Diff: adblockplus/Api.jsm

Issue 29323406: Issue 2871 - Honor the disabled flag for subscriptions (Closed)
Patch Set: Created Aug. 7, 2015, 10:52 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 | « no previous file | no next file » | 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-2015 Eyeo GmbH 3 * Copyright (C) 2006-2015 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 false); 86 false);
87 request.send(); 87 request.send();
88 return request.responseText; 88 return request.responseText;
89 }, 89 },
90 isSubscriptionListed: function(url) 90 isSubscriptionListed: function(url)
91 { 91 {
92 return url in FilterStorage.knownSubscriptions; 92 return url in FilterStorage.knownSubscriptions;
93 }, 93 },
94 addSubscription: function(url, title) 94 addSubscription: function(url, title)
95 { 95 {
96 let subscription = Subscription.fromURL(url); 96 let subscriptionToAdd = Subscription.fromURL(url);
97 if (title) 97 if (title)
98 subscription.title = title; 98 subscriptionToAdd.title = title;
99 FilterStorage.addSubscription(subscription); 99 FilterStorage.addSubscription(subscriptionToAdd);
100 if (!subscription.lastDownload) 100 let subscription = FilterStorage.knownSubscriptions[url];
101 if (subscription)
101 { 102 {
102 Synchronizer.execute(subscription); 103 subscription.disabled = false;
104 if (!subscription.lastDownload)
105 {
106 Synchronizer.execute(subscription);
107 }
103 } 108 }
104 }, 109 },
105 removeSubscription: function(url) 110 removeSubscription: function(url)
106 { 111 {
107 FilterStorage.removeSubscription( 112 FilterStorage.removeSubscription(
108 FilterStorage.knownSubscriptions[url]); 113 FilterStorage.knownSubscriptions[url]);
109 }, 114 },
110 getActiveSubscriptions: function() 115 getActiveSubscriptions: function()
111 { 116 {
112 let subscriptions = []; 117 let subscriptions = [];
113 for (let i = 0; i < FilterStorage.subscriptions.length; i++) 118 for (let i = 0; i < FilterStorage.subscriptions.length; i++)
114 { 119 {
115 let subscription = FilterStorage.subscriptions[i]; 120 let subscription = FilterStorage.subscriptions[i];
116 subscriptions.push({"title": subscription.title, "url": subscription.url}) ; 121 if (!subscription.disabled)
122 subscriptions.push({"title": subscription.title, "url": subscription.url });
117 } 123 }
118 return subscriptions; 124 return subscriptions;
119 }, 125 },
120 isLocal: function(url) 126 isLocal: function(url)
121 { 127 {
122 let uriObject = Services.io.newURI(url, null, null); 128 let uriObject = Services.io.newURI(url, null, null);
123 return !uriObject.schemeIs("http") && !uriObject.schemeIs("https"); 129 return !uriObject.schemeIs("http") && !uriObject.schemeIs("https");
124 }, 130 },
125 isPageWhitelisted: function(url) 131 isPageWhitelisted: function(url)
126 { 132 {
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 { 224 {
219 this.whitelistSite(data["url"], data["whitelisted"]); 225 this.whitelistSite(data["url"], data["whitelisted"]);
220 return {"success": true}; 226 return {"success": true};
221 } 227 }
222 break; 228 break;
223 } 229 }
224 return {"success": false, "error": "malformed request"}; 230 return {"success": false, "error": "malformed request"};
225 }).bind(this), "AdblockPlus:Api"); 231 }).bind(this), "AdblockPlus:Api");
226 } 232 }
227 }; 233 };
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld