Left: | ||
Right: |
LEFT | RIGHT |
---|---|
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-present eyeo GmbH | 3 * Copyright (C) 2006-present 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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
174 if (callResult.exceptionDetails) | 174 if (callResult.exceptionDetails) |
175 throwException(callResult.exceptionDetails, scriptName); | 175 throwException(callResult.exceptionDetails, scriptName); |
176 | 176 |
177 let promiseResult = await Runtime.awaitPromise({ | 177 let promiseResult = await Runtime.awaitPromise({ |
178 promiseObjectId: callResult.result.objectId | 178 promiseObjectId: callResult.result.objectId |
179 }); | 179 }); |
180 if (promiseResult.exceptionDetails) | 180 if (promiseResult.exceptionDetails) |
181 throwException(promiseResult.exceptionDetails, scriptName); | 181 throwException(promiseResult.exceptionDetails, scriptName); |
182 | 182 |
183 return Runtime.evaluate({ | 183 return Runtime.evaluate({ |
184 expression: "window.consoleLogs", | 184 expression: "window._consoleLogs", |
185 returnByValue: true | 185 returnByValue: true |
186 }).then(result => | 186 }).then(result => |
187 { | 187 { |
188 if (result.result.value.failures != 0) | 188 if (result.result.value.failures != 0) |
Sebastian Noack
2018/09/17 16:18:06
I'm not sure if I understand correctly, but wouldn
hub
2018/09/18 22:23:36
the messages ARE displayed aleready. Have always b
| |
189 return Promise.reject("Test failure"); | 189 throw "Chromium (Remote Interface)"; |
190 }); | 190 }); |
191 } | 191 } |
192 finally | 192 finally |
193 { | 193 { |
194 client.close(); | 194 client.close(); |
195 } | 195 } |
196 }); | 196 }); |
197 } | 197 } |
198 | 198 |
199 module.exports = function(script, scriptName, ...scriptArgs) | 199 module.exports = function(script, scriptName, ...scriptArgs) |
200 { | 200 { |
201 return ensureChromium(CHROMIUM_REVISION).then(chromiumPath => | 201 return ensureChromium(CHROMIUM_REVISION).then(chromiumPath => |
202 { | 202 { |
203 let child = startChromium(chromiumPath); | 203 let child = startChromium(chromiumPath); |
204 return Promise.race([ | 204 return Promise.race([ |
205 child.done, | 205 child.done, |
206 runScript(script, scriptName, scriptArgs) | 206 runScript(script, scriptName, scriptArgs) |
207 ]).then(result => | 207 ]).then(result => |
208 { | 208 { |
209 child.kill(); | 209 child.kill(); |
210 return result; | 210 return result; |
211 }).catch(error => | 211 }).catch(error => |
212 { | 212 { |
213 child.kill(); | 213 child.kill(); |
214 throw error; | 214 throw error; |
215 }); | 215 }); |
216 }); | 216 }); |
217 }; | 217 }; |
LEFT | RIGHT |