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

Side by Side Diff: chrome/content/ui/filters-backup.js

Issue 5738402414592000: Issue 1602 - Pass array directly from backupCustomFilters() to IO.writeToFile() (Closed)
Patch Set: Created April 2, 2015, 5 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-2015 Eyeo GmbH 3 * Copyright (C) 2006-2015 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 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 list.unshift("[Adblock Plus " + minVersion + "]"); 318 list.unshift("[Adblock Plus " + minVersion + "]");
319 319
320 // Insert checksum. Have to add an empty line to the end of the list to 320 // Insert checksum. Have to add an empty line to the end of the list to
321 // account for the trailing newline in the file. 321 // account for the trailing newline in the file.
322 list.push(""); 322 list.push("");
323 let checksum = Utils.generateChecksum(list); 323 let checksum = Utils.generateChecksum(list);
324 list.pop(); 324 list.pop();
325 if (checksum) 325 if (checksum)
326 list.splice(1, 0, "! Checksum: " + checksum); 326 list.splice(1, 0, "! Checksum: " + checksum);
327 327
328 function* generator() 328 IO.writeToFile(file, list, function(e)
329 {
330 for (let i = 0; i < list.length; i++)
331 yield list[i];
332 }
333
334 IO.writeToFile(file, generator(), function(e)
335 { 329 {
336 if (e) 330 if (e)
337 { 331 {
338 Cu.reportError(e); 332 Cu.reportError(e);
339 Utils.alert(window, E("backupButton").getAttribute("_backupError"), E("b ackupButton").getAttribute("_backupDialogTitle")); 333 Utils.alert(window, E("backupButton").getAttribute("_backupError"), E("b ackupButton").getAttribute("_backupDialogTitle"));
340 } 334 }
341 }); 335 });
342 } 336 }
343 }; 337 };
344 338
345 window.addEventListener("load", function() 339 window.addEventListener("load", function()
346 { 340 {
347 Backup.init(); 341 Backup.init();
348 }, false); 342 }, false);
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