Left: | ||
Right: |
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-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 17 matching lines...) Expand all Loading... | |
28 // Chromium 63.0.3239.x is 508578 | 28 // Chromium 63.0.3239.x is 508578 |
29 // Chromium 65.0.3325.0 is 530368 | 29 // Chromium 65.0.3325.0 is 530368 |
30 // We currently want Chromiun 63, as we still support it and that's the | 30 // We currently want Chromiun 63, as we still support it and that's the |
31 // loweset version that supports WebDriver. | 31 // loweset version that supports WebDriver. |
32 const CHROMIUM_REVISION = 508578; | 32 const CHROMIUM_REVISION = 508578; |
33 | 33 |
34 function runScript(chromiumPath, script, scriptName, scriptArgs) | 34 function runScript(chromiumPath, script, scriptName, scriptArgs) |
35 { | 35 { |
36 const options = new chrome.Options() | 36 const options = new chrome.Options() |
37 .headless() | 37 .headless() |
38 // disabling sandboxing. It is needed on some systems. | |
Sebastian Noack
2018/08/22 17:02:04
Nit: Proper capitalization and punctuation please:
hub
2018/08/22 17:36:55
Done.
| |
39 .addArguments("--no-sandbox") | |
38 .setChromeBinaryPath(chromiumPath); | 40 .setChromeBinaryPath(chromiumPath); |
39 | 41 |
40 const driver = new Builder() | 42 const driver = new Builder() |
41 .forBrowser("chrome") | 43 .forBrowser("chrome") |
42 .setChromeOptions(options) | 44 .setChromeOptions(options) |
43 .build(); | 45 .build(); |
44 | 46 |
45 return executeScript(driver, "Chromium (WebDriver)", | 47 return executeScript(driver, "Chromium (WebDriver)", |
46 script, scriptName, scriptArgs); | 48 script, scriptName, scriptArgs); |
47 } | 49 } |
48 | 50 |
49 module.exports = function(script, scriptName, ...scriptArgs) | 51 module.exports = function(script, scriptName, ...scriptArgs) |
50 { | 52 { |
51 return ensureChromium(CHROMIUM_REVISION).then(chromiumPath => | 53 return ensureChromium(CHROMIUM_REVISION).then(chromiumPath => |
52 { | 54 { |
53 return runScript(chromiumPath, script, scriptName, scriptArgs) | 55 return runScript(chromiumPath, script, scriptName, scriptArgs) |
54 .then(result => result) | 56 .then(result => result) |
55 .catch(error => | 57 .catch(error => |
56 { | 58 { |
57 console.log("chromium_process: error caught"); | 59 console.log("chromium_process: error caught"); |
58 throw error; | 60 throw error; |
59 }); | 61 }); |
60 }); | 62 }); |
61 }; | 63 }; |
OLD | NEW |