| OLD | NEW |
| 1 /* | 1 /* |
| 2 * This file is part of the Adblock Plus, | 2 * This file is part of the Adblock Plus, |
| 3 * Copyright (C) 2006-2012 Eyeo GmbH | 3 * Copyright (C) 2006-2012 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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 let e = Cc["@mozilla.org/js/xpc/Exception;1"].createInstance(Ci.nsIX
PCException); | 182 let e = Cc["@mozilla.org/js/xpc/Exception;1"].createInstance(Ci.nsIX
PCException); |
| 183 e.initialize("File write operation failed", result, null, Components
.stack, file, null); | 183 e.initialize("File write operation failed", result, null, Components
.stack, file, null); |
| 184 callback(e); | 184 callback(e); |
| 185 } | 185 } |
| 186 else | 186 else |
| 187 callback(null); | 187 callback(null); |
| 188 } | 188 } |
| 189 }, null); | 189 }, null); |
| 190 | 190 |
| 191 let lineBreak = this.lineBreak; | 191 let lineBreak = this.lineBreak; |
| 192 function writeNextChunk() | 192 let writeNextChunk = function() |
| 193 { | 193 { |
| 194 let buf = []; | 194 let buf = []; |
| 195 let bufLen = 0; | 195 let bufLen = 0; |
| 196 while (bufLen < 0x4000) | 196 while (bufLen < 0x4000) |
| 197 { | 197 { |
| 198 try | 198 try |
| 199 { | 199 { |
| 200 let str = data.next(); | 200 let str = data.next(); |
| 201 buf.push(str); | 201 buf.push(str); |
| 202 bufLen += str.length; | 202 bufLen += str.length; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 } | 237 } |
| 238 else | 238 else |
| 239 outStream.close(); | 239 outStream.close(); |
| 240 | 240 |
| 241 if (timeLineID) | 241 if (timeLineID) |
| 242 { | 242 { |
| 243 TimeLine.asyncEnd(timeLineID); | 243 TimeLine.asyncEnd(timeLineID); |
| 244 } | 244 } |
| 245 } | 245 } |
| 246 }, 0, 0, Services.tm.currentThread); | 246 }, 0, 0, Services.tm.currentThread); |
| 247 } | 247 }; |
| 248 writeNextChunk(); | 248 writeNextChunk(); |
| 249 } | 249 } |
| 250 catch (e) | 250 catch (e) |
| 251 { | 251 { |
| 252 callback(e); | 252 callback(e); |
| 253 } | 253 } |
| 254 }, | 254 }, |
| 255 | 255 |
| 256 /** | 256 /** |
| 257 * Copies a file asynchronously. The callback will be called when the copy | 257 * Copies a file asynchronously. The callback will be called when the copy |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 isFile: exists && file.isFile(), | 330 isFile: exists && file.isFile(), |
| 331 lastModified: exists ? file.lastModifiedTime : 0 | 331 lastModified: exists ? file.lastModifiedTime : 0 |
| 332 }); | 332 }); |
| 333 } | 333 } |
| 334 catch(e) | 334 catch(e) |
| 335 { | 335 { |
| 336 callback(e); | 336 callback(e); |
| 337 } | 337 } |
| 338 } | 338 } |
| 339 } | 339 } |
| OLD | NEW |