| 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-2017 eyeo GmbH | 3 * Copyright (C) 2006-2017 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 processing = true; | 87 processing = true; |
| 88 try | 88 try |
| 89 { | 89 { |
| 90 let oldBuffer = buffer; | 90 let oldBuffer = buffer; |
| 91 buffer = data.substr(index + 1); | 91 buffer = data.substr(index + 1); |
| 92 data = data.substr(0, index + 1); | 92 data = data.substr(0, index + 1); |
| 93 let lines = data.split(/[\r\n]+/); | 93 let lines = data.split(/[\r\n]+/); |
| 94 lines.pop(); | 94 lines.pop(); |
| 95 lines[0] = oldBuffer + lines[0]; | 95 lines[0] = oldBuffer + lines[0]; |
| 96 for (let i = 0; i < lines.length; i++) | 96 for (let i = 0; i < lines.length; i++) |
| 97 { | 97 listener.process(lines[i]); |
| 98 let promise = listener.process(lines[i]); | |
| 99 if (promise) | |
| 100 yield promise; | |
| 101 } | |
| 102 } | 98 } |
| 103 finally | 99 finally |
| 104 { | 100 { |
| 105 processing = false; | 101 processing = false; |
| 106 data = buffer; | 102 data = buffer; |
| 107 buffer = ""; | 103 buffer = ""; |
| 108 yield* onProgress(data); | 104 yield* onProgress(data); |
| 109 | 105 |
| 110 if (loaded) | 106 if (loaded) |
| 111 { | 107 { |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 else | 326 else |
| 331 callback(e); | 327 callback(e); |
| 332 }); | 328 }); |
| 333 } | 329 } |
| 334 catch(e) | 330 catch(e) |
| 335 { | 331 { |
| 336 callback(e); | 332 callback(e); |
| 337 } | 333 } |
| 338 } | 334 } |
| 339 } | 335 } |
| OLD | NEW |