OLD | NEW |
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 Loading... |
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 function* generator() |
329 { | 329 { |
330 for (let i = 0; i < list.length; i++) | 330 for (let i = 0; i < list.length; i++) |
331 yield list[i]; | 331 yield list[i]; |
332 } | 332 } |
333 | 333 |
334 IO.writeToFile(file, generator(), function(e) | 334 IO.writeToFile(file, generator(), function(e) |
335 { | 335 { |
336 if (e) | 336 if (e) |
337 { | 337 { |
338 Cu.reportError(e); | 338 Cu.reportError(e); |
339 Utils.alert(window, E("backupButton").getAttribute("_backupError"), E("b
ackupButton").getAttribute("_backupDialogTitle")); | 339 Utils.alert(window, E("backupButton").getAttribute("_backupError"), E("b
ackupButton").getAttribute("_backupDialogTitle")); |
340 } | 340 } |
341 }); | 341 }); |
342 } | 342 } |
343 }; | 343 }; |
344 | 344 |
345 window.addEventListener("load", function() | 345 window.addEventListener("load", function() |
346 { | 346 { |
347 Backup.init(); | 347 Backup.init(); |
348 }, false); | 348 }, false); |
OLD | NEW |