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

Side by Side Diff: lib/Public.jsm

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 | « no previous file | lib/antiadblockInit.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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 { 86 {
87 if (id.substr(0, externalPrefix.length) != externalPrefix) 87 if (id.substr(0, externalPrefix.length) != externalPrefix)
88 id = externalPrefix + id; 88 id = externalPrefix + id;
89 let subscription = Subscription.knownSubscriptions[id]; 89 let subscription = Subscription.knownSubscriptions[id];
90 if (typeof subscription == "undefined") 90 if (typeof subscription == "undefined")
91 subscription = new ExternalSubscription(id, title); 91 subscription = new ExternalSubscription(id, title);
92 92
93 subscription.lastDownload = parseInt(new Date().getTime() / 1000); 93 subscription.lastDownload = parseInt(new Date().getTime() / 1000);
94 94
95 let newFilters = []; 95 let newFilters = [];
96 for each (let filter in filters) 96 for (let filter of filters)
97 { 97 {
98 filter = Filter.fromText(Filter.normalize(filter)); 98 filter = Filter.fromText(Filter.normalize(filter));
99 if (filter) 99 if (filter)
100 newFilters.push(filter); 100 newFilters.push(filter);
101 } 101 }
102 102
103 if (id in FilterStorage.knownSubscriptions) 103 if (id in FilterStorage.knownSubscriptions)
104 FilterStorage.updateSubscriptionFilters(subscription, newFilters); 104 FilterStorage.updateSubscriptionFilters(subscription, newFilters);
105 else 105 else
106 { 106 {
(...skipping 16 matching lines...) Expand all
123 123
124 FilterStorage.removeSubscription(FilterStorage.knownSubscriptions[id]); 124 FilterStorage.removeSubscription(FilterStorage.knownSubscriptions[id]);
125 return true; 125 return true;
126 }, 126 },
127 127
128 /** 128 /**
129 * Adds user-defined filters to the list 129 * Adds user-defined filters to the list
130 */ 130 */
131 addPatterns: function(/**Array of String*/ filters) 131 addPatterns: function(/**Array of String*/ filters)
132 { 132 {
133 for each (let filter in filters) 133 for (let filter of filters)
134 { 134 {
135 filter = Filter.fromText(Filter.normalize(filter)); 135 filter = Filter.fromText(Filter.normalize(filter));
136 if (filter) 136 if (filter)
137 { 137 {
138 filter.disabled = false; 138 filter.disabled = false;
139 FilterStorage.addFilter(filter); 139 FilterStorage.addFilter(filter);
140 } 140 }
141 } 141 }
142 }, 142 },
143 143
144 /** 144 /**
145 * Removes user-defined filters from the list 145 * Removes user-defined filters from the list
146 */ 146 */
147 removePatterns: function(/**Array of String*/ filters) 147 removePatterns: function(/**Array of String*/ filters)
148 { 148 {
149 for each (let filter in filters) 149 for (let filter of filters)
150 { 150 {
151 filter = Filter.fromText(Filter.normalize(filter)); 151 filter = Filter.fromText(Filter.normalize(filter));
152 if (filter) 152 if (filter)
153 FilterStorage.removeFilter(filter); 153 FilterStorage.removeFilter(filter);
154 } 154 }
155 }, 155 },
156 156
157 /** 157 /**
158 * Returns installed Adblock Plus version 158 * Returns installed Adblock Plus version
159 */ 159 */
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 getPatterns: function() 193 getPatterns: function()
194 { 194 {
195 let result = subscription.filters.map(function(filter) 195 let result = subscription.filters.map(function(filter)
196 { 196 {
197 return filter.text; 197 return filter.text;
198 }); 198 });
199 return result; 199 return result;
200 } 200 }
201 }; 201 };
202 } 202 }
OLDNEW
« no previous file with comments | « no previous file | lib/antiadblockInit.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld