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

Delta Between Two Patch Sets: messageResponder.js

Issue 29337878: Issue 3736 - Fixed: Checks for share resources failed (Closed)
Left Patch Set: Created March 4, 2016, 5:19 p.m.
Right Patch Set: Rebased and added RegExpFilter mock Created March 14, 2016, 3:48 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 | « background.js ('k') | 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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 if (message.filter) 176 if (message.filter)
177 listenerFilters.app = message.filter; 177 listenerFilters.app = message.filter;
178 else 178 else
179 delete listenerFilters.app; 179 delete listenerFilters.app;
180 break; 180 break;
181 case "app.open": 181 case "app.open":
182 if (message.what == "options") 182 if (message.what == "options")
183 ext.showOptions(); 183 ext.showOptions();
184 break; 184 break;
185 case "filters.add": 185 case "filters.add":
186 var filter = Filter.fromText(message.text);
187 var result = require("filterValidation").parseFilter(message.text); 186 var result = require("filterValidation").parseFilter(message.text);
187 var errors = [];
188 if (result.error) 188 if (result.error)
189 sendMessage("app", "error", [result.error.toString()], sender.page); 189 errors.push(result.error.toString());
190 else if (result.filter) 190 else if (result.filter)
191 FilterStorage.addFilter(result.filter); 191 FilterStorage.addFilter(result.filter);
192 callback(errors);
192 break; 193 break;
193 case "filters.blocked": 194 case "filters.blocked":
194 var filter = defaultMatcher.matchesAny(message.url, 195 var filter = defaultMatcher.matchesAny(message.url,
195 RegExpFilter.typeMap[message.requestType], message.docDomain, 196 RegExpFilter.typeMap[message.requestType], message.docDomain,
196 message.thirdParty); 197 message.thirdParty);
197 callback(filter instanceof BlockingFilter); 198 callback(filter instanceof BlockingFilter);
198 break; 199 break;
199 case "filters.get": 200 case "filters.get":
200 if (message.what == "cssproperties") 201 if (message.what == "cssproperties")
201 { 202 {
(...skipping 30 matching lines...) Expand all
232 case "filters.importRaw": 233 case "filters.importRaw":
233 var result = require("filterValidation").parseFilters(message.text); 234 var result = require("filterValidation").parseFilters(message.text);
234 var errors = []; 235 var errors = [];
235 for (var i = 0; i < result.errors.length; i++) 236 for (var i = 0; i < result.errors.length; i++)
236 { 237 {
237 var error = result.errors[i]; 238 var error = result.errors[i];
238 if (error.type != "unexpected-filter-list-header") 239 if (error.type != "unexpected-filter-list-header")
239 errors.push(error.toString()); 240 errors.push(error.toString());
240 } 241 }
241 242
243 callback(errors);
242 if (errors.length > 0) 244 if (errors.length > 0)
243 {
244 sendMessage("app", "error", errors, sender.page);
245 return; 245 return;
246 }
247 246
248 var seenFilter = Object.create(null); 247 var seenFilter = Object.create(null);
249 for (var i = 0; i < result.filters.length; i++) 248 for (var i = 0; i < result.filters.length; i++)
250 { 249 {
251 var filter = result.filters[i]; 250 var filter = result.filters[i];
252 FilterStorage.addFilter(filter); 251 FilterStorage.addFilter(filter);
253 seenFilter[filter.text] = null; 252 seenFilter[filter.text] = null;
254 } 253 }
255 254
256 for (var i = 0; i < FilterStorage.subscriptions.length; i++) 255 for (var i = 0; i < FilterStorage.subscriptions.length; i++)
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 if (subscription instanceof DownloadableSubscription) 363 if (subscription instanceof DownloadableSubscription)
365 Synchronizer.execute(subscription, true); 364 Synchronizer.execute(subscription, true);
366 } 365 }
367 break; 366 break;
368 case "subscriptions.isDownloading": 367 case "subscriptions.isDownloading":
369 callback(Synchronizer.isExecuting(message.url)); 368 callback(Synchronizer.isExecuting(message.url));
370 break; 369 break;
371 } 370 }
372 }); 371 });
373 })(this); 372 })(this);
LEFTRIGHT

Powered by Google App Engine
This is Rietveld