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

Side by Side Diff: background.js

Issue 29338118: Issue 3772 - Bring back anti-adblock warning removal subscription (Closed)
Patch Set: Created March 10, 2016, 3:49 p.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-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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 && !subscription.last Download)
189 Synchronizer.execute(subscription); 189 Synchronizer.execute(subscription);
190 } 190 }
191 else 191 else
192 addAcceptable = false; 192 addAcceptable = false;
193 } 193 }
194 194
195 // Add "anti-adblock messages" subscription for new users
196 if (!prevVersion)
197 {
198 var subscription = Subscription.fromURL(Prefs.subscriptions_antiadblockurl);
199 if (subscription && !(subscription.url in FilterStorage.knownSubscriptions))
200 {
201 subscription.disabled = true;
202 FilterStorage.addSubscription(subscription);
203 if (subscription instanceof DownloadableSubscription && !subscription.last Download)
kzar 2016/03/10 16:20:24 Nit: Mind wrapping this long line?
Sebastian Noack 2016/03/11 15:41:01 Done.
204 Synchronizer.execute(subscription);
205 }
206 }
207
195 if (!addSubscription && !addAcceptable) 208 if (!addSubscription && !addAcceptable)
196 return; 209 return;
197 210
198 Promise.resolve(addSubscription && fetch("subscriptions.xml") 211 Promise.resolve(addSubscription && fetch("subscriptions.xml")
199 .then(function(response) 212 .then(function(response)
200 { 213 {
201 return response.text(); 214 return response.text();
202 }) 215 })
203 .then(function(text) 216 .then(function(text)
204 { 217 {
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 } 439 }
427 }); 440 });
428 441
429 // update icon when page changes location 442 // update icon when page changes location
430 ext.pages.onLoading.addListener(function(page) 443 ext.pages.onLoading.addListener(function(page)
431 { 444 {
432 page.sendMessage({type: "blockelement-finished"}); 445 page.sendMessage({type: "blockelement-finished"});
433 refreshIconAndContextMenu(page); 446 refreshIconAndContextMenu(page);
434 showNextNotificationForUrl(page.url); 447 showNextNotificationForUrl(page.url);
435 }); 448 });
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