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-2016 Eyeo GmbH | 3 * Copyright (C) 2006-2016 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 { |
98 let promise = listener.process(lines[i]); | 98 let promise = listener.process(lines[i]); |
99 if (promise) | 99 if (promise) |
100 yield listener.process(lines[i]); | 100 yield promise; |
101 } | 101 } |
102 } | 102 } |
103 finally | 103 finally |
104 { | 104 { |
105 processing = false; | 105 processing = false; |
106 data = buffer; | 106 data = buffer; |
107 buffer = ""; | 107 buffer = ""; |
108 yield* onProgress(data); | 108 yield* onProgress(data); |
109 | 109 |
110 if (loaded) | 110 if (loaded) |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 else | 330 else |
331 callback(e); | 331 callback(e); |
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 |