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

Delta Between Two Patch Sets: background.js

Issue 29338118: Issue 3772 - Bring back anti-adblock warning removal subscription (Closed)
Left Patch Set: Created March 10, 2016, 3:49 p.m.
Right Patch Set: Wrapped long lines Created March 11, 2016, 3:40 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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-2016 Eyeo GmbH 3 * Copyright (C) 2006-2016 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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 } 178 }
179 179
180 // Add "acceptable ads" subscription 180 // Add "acceptable ads" subscription
181 if (addAcceptable) 181 if (addAcceptable)
182 { 182 {
183 var subscription = Subscription.fromURL(Prefs.subscriptions_exceptionsurl); 183 var subscription = Subscription.fromURL(Prefs.subscriptions_exceptionsurl);
184 if (subscription) 184 if (subscription)
185 { 185 {
186 subscription.title = "Allow non-intrusive advertising"; 186 subscription.title = "Allow non-intrusive advertising";
187 FilterStorage.addSubscription(subscription); 187 FilterStorage.addSubscription(subscription);
188 if (subscription instanceof DownloadableSubscription && !subscription.last Download) 188 if (subscription instanceof DownloadableSubscription &&
189 !subscription.lastDownload)
189 Synchronizer.execute(subscription); 190 Synchronizer.execute(subscription);
190 } 191 }
191 else 192 else
192 addAcceptable = false; 193 addAcceptable = false;
193 } 194 }
194 195
195 // Add "anti-adblock messages" subscription for new users 196 // Add "anti-adblock messages" subscription for new users
196 if (!prevVersion) 197 if (!prevVersion)
197 { 198 {
198 var subscription = Subscription.fromURL(Prefs.subscriptions_antiadblockurl); 199 var subscription = Subscription.fromURL(Prefs.subscriptions_antiadblockurl);
199 if (subscription && !(subscription.url in FilterStorage.knownSubscriptions)) 200 if (subscription && !(subscription.url in FilterStorage.knownSubscriptions))
200 { 201 {
201 subscription.disabled = true; 202 subscription.disabled = true;
202 FilterStorage.addSubscription(subscription); 203 FilterStorage.addSubscription(subscription);
203 if (subscription instanceof DownloadableSubscription && !subscription.last Download) 204 if (subscription instanceof DownloadableSubscription &&
kzar 2016/03/10 16:20:24 Nit: Mind wrapping this long line?
Sebastian Noack 2016/03/11 15:41:01 Done.
205 !subscription.lastDownload)
204 Synchronizer.execute(subscription); 206 Synchronizer.execute(subscription);
205 } 207 }
206 } 208 }
207 209
208 if (!addSubscription && !addAcceptable) 210 if (!addSubscription && !addAcceptable)
209 return; 211 return;
210 212
211 Promise.resolve(addSubscription && fetch("subscriptions.xml") 213 Promise.resolve(addSubscription && fetch("subscriptions.xml")
212 .then(function(response) 214 .then(function(response)
213 { 215 {
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 } 441 }
440 }); 442 });
441 443
442 // update icon when page changes location 444 // update icon when page changes location
443 ext.pages.onLoading.addListener(function(page) 445 ext.pages.onLoading.addListener(function(page)
444 { 446 {
445 page.sendMessage({type: "blockelement-finished"}); 447 page.sendMessage({type: "blockelement-finished"});
446 refreshIconAndContextMenu(page); 448 refreshIconAndContextMenu(page);
447 showNextNotificationForUrl(page.url); 449 showNextNotificationForUrl(page.url);
448 }); 450 });
LEFTRIGHT
« no previous file | no next file » | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
This is Rietveld