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 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 yield listener.process(lines[i]); | 97 { |
| 98 let promise = listener.process(lines[i]); |
| 99 if (promise) |
| 100 yield listener.process(lines[i]); |
| 101 } |
98 } | 102 } |
99 finally | 103 finally |
100 { | 104 { |
101 processing = false; | 105 processing = false; |
102 data = buffer; | 106 data = buffer; |
103 buffer = ""; | 107 buffer = ""; |
104 yield* onProgress(data); | 108 yield* onProgress(data); |
105 | 109 |
106 if (loaded) | 110 if (loaded) |
107 { | 111 { |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 else | 330 else |
327 callback(e); | 331 callback(e); |
328 }); | 332 }); |
329 } | 333 } |
330 catch(e) | 334 catch(e) |
331 { | 335 { |
332 callback(e); | 336 callback(e); |
333 } | 337 } |
334 } | 338 } |
335 } | 339 } |
OLD | NEW |