| OLD | NEW |
| 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 } | 80 } |
| 81 | 81 |
| 82 if (!file) | 82 if (!file) |
| 83 Cu.reportError("Adblock Plus: Failed to resolve filter file location from
extensions.adblockplus.patternsfile preference"); | 83 Cu.reportError("Adblock Plus: Failed to resolve filter file location from
extensions.adblockplus.patternsfile preference"); |
| 84 | 84 |
| 85 this.__defineGetter__("sourceFile", function() file); | 85 this.__defineGetter__("sourceFile", function() file); |
| 86 return this.sourceFile; | 86 return this.sourceFile; |
| 87 }, | 87 }, |
| 88 | 88 |
| 89 /** | 89 /** |
| 90 * Will be set to true if no patterns.ini file exists. |
| 91 * @type Boolean |
| 92 */ |
| 93 firstRun: false, |
| 94 |
| 95 /** |
| 90 * Map of properties listed in the filter storage file before the sections | 96 * Map of properties listed in the filter storage file before the sections |
| 91 * start. Right now this should be only the format version. | 97 * start. Right now this should be only the format version. |
| 92 */ | 98 */ |
| 93 fileProperties: {__proto__: null}, | 99 fileProperties: {__proto__: null}, |
| 94 | 100 |
| 95 /** | 101 /** |
| 96 * List of filter subscriptions containing all filters | 102 * List of filter subscriptions containing all filters |
| 97 * @type Array of Subscription | 103 * @type Array of Subscription |
| 98 */ | 104 */ |
| 99 subscriptions: [], | 105 subscriptions: [], |
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 459 } | 465 } |
| 460 else | 466 else |
| 461 { | 467 { |
| 462 explicitFile = false; | 468 explicitFile = false; |
| 463 sourceFile = FilterStorage.sourceFile; | 469 sourceFile = FilterStorage.sourceFile; |
| 464 | 470 |
| 465 let callback = function(e, statData) | 471 let callback = function(e, statData) |
| 466 { | 472 { |
| 467 if (e || !statData.exists) | 473 if (e || !statData.exists) |
| 468 { | 474 { |
| 469 let {addonRoot} = require("info"); | 475 this.firstRun = true; |
| 470 sourceFile = Services.io.newURI(addonRoot + "defaults/patterns.ini", n
ull, null); | 476 this._loading = false; |
| 477 FilterNotifier.triggerListeners("load"); |
| 478 |
| 479 TimeLine.leave("FilterStorage.loadFromDisk() read callback done"); |
| 471 } | 480 } |
| 472 startRead(sourceFile); | 481 startRead(sourceFile); |
| 473 } | 482 } |
| 474 | 483 |
| 475 if (sourceFile) | 484 if (sourceFile) |
| 476 IO.statFile(sourceFile, callback); | 485 IO.statFile(sourceFile, callback); |
| 477 else | 486 else |
| 478 callback(true); | 487 callback(true); |
| 479 } | 488 } |
| 480 | 489 |
| (...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 880 Subscription.knownSubscriptions = origKnownSubscriptions; | 889 Subscription.knownSubscriptions = origKnownSubscriptions; |
| 881 } | 890 } |
| 882 | 891 |
| 883 // Allow events to be processed every now and then. | 892 // Allow events to be processed every now and then. |
| 884 // Note: IO.readFromFile() will deal with the potential reentrance here. | 893 // Note: IO.readFromFile() will deal with the potential reentrance here. |
| 885 this.linesProcessed++; | 894 this.linesProcessed++; |
| 886 if (this.linesProcessed % 1000 == 0) | 895 if (this.linesProcessed % 1000 == 0) |
| 887 Utils.yield(); | 896 Utils.yield(); |
| 888 } | 897 } |
| 889 }; | 898 }; |
| OLD | NEW |