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

Side by Side Diff: lib/antiadblockInit.js

Issue 6341149593698304: Issue 301 - Change for each to for .. of .. in lib/ (Closed)
Patch Set: Created April 10, 2014, 5:02 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 | « lib/Public.jsm ('k') | lib/contentPolicy.js » ('j') | 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 <http://adblockplus.org/>, 2 * This file is part of Adblock Plus <http://adblockplus.org/>,
3 * Copyright (C) 2006-2014 Eyeo GmbH 3 * Copyright (C) 2006-2014 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 27 matching lines...) Expand all
38 function notificationListener(approved) 38 function notificationListener(approved)
39 { 39 {
40 let subscription = Subscription.fromURL(Prefs.subscriptions_antiadblockurl); 40 let subscription = Subscription.fromURL(Prefs.subscriptions_antiadblockurl);
41 if (subscription.url in FilterStorage.knownSubscriptions) 41 if (subscription.url in FilterStorage.knownSubscriptions)
42 subscription.disabled = !approved; 42 subscription.disabled = !approved;
43 } 43 }
44 44
45 function addAntiAdblockNotification(subscription) 45 function addAntiAdblockNotification(subscription)
46 { 46 {
47 let urlFilters = []; 47 let urlFilters = [];
48 for each (let filter in subscription.filters) 48 for (let filter of subscription.filters)
49 if (filter instanceof ActiveFilter) 49 if (filter instanceof ActiveFilter)
50 for (let domain in filter.domains) 50 for (let domain in filter.domains)
51 if (domain && urlFilters.indexOf(domain) == -1) 51 if (domain && urlFilters.indexOf(domain) == -1)
52 urlFilters.push(domain); 52 urlFilters.push(domain);
53 notification.urlFilters = urlFilters; 53 notification.urlFilters = urlFilters;
54 Notification.addNotification(notification); 54 Notification.addNotification(notification);
55 Notification.addQuestionListener(notification.id, notificationListener); 55 Notification.addQuestionListener(notification.id, notificationListener);
56 } 56 }
57 57
58 function removeAntiAdblockNotification() 58 function removeAntiAdblockNotification()
(...skipping 10 matching lines...) Expand all
69 { 69 {
70 if (!/^subscription\.(updated|removed|disabled)$/.test(action) || value.url != Prefs.subscriptions_antiadblockurl) 70 if (!/^subscription\.(updated|removed|disabled)$/.test(action) || value.url != Prefs.subscriptions_antiadblockurl)
71 return; 71 return;
72 72
73 if (action == "subscription.updated") 73 if (action == "subscription.updated")
74 addAntiAdblockNotification(value); 74 addAntiAdblockNotification(value);
75 else if (action == "subscription.removed" || (action == "subscription.disabl ed" && !value.disabled)) 75 else if (action == "subscription.removed" || (action == "subscription.disabl ed" && !value.disabled))
76 removeAntiAdblockNotification(); 76 removeAntiAdblockNotification();
77 }); 77 });
78 } 78 }
OLDNEW
« no previous file with comments | « lib/Public.jsm ('k') | lib/contentPolicy.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld