Left: | ||
Right: |
OLD | NEW |
---|---|
(Empty) | |
1 /* | |
kzar
2018/05/04 10:52:43
Since this file (the Chromium WebDriver runner) is
hub
2018/05/18 00:04:22
There are trivial enough that merging them would m
| |
2 * This file is part of Adblock Plus <https://adblockplus.org/>, | |
3 * Copyright (C) 2006-present eyeo GmbH | |
4 * | |
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 | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * Adblock Plus is distributed in the hope that it will be useful, | |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 * GNU General Public License for more details. | |
13 * | |
14 * You should have received a copy of the GNU General Public License | |
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | |
16 */ | |
17 | |
18 "use strict"; | |
19 | |
20 const {Builder} = require("selenium-webdriver"); | |
21 const chrome = require("selenium-webdriver/chrome"); | |
22 require("chromedriver"); | |
23 | |
24 const {executeScript} = require("./webdriver"); | |
25 const {ensureChromium} = require("./chromium_download"); | |
26 | |
27 // Chromium 63.0.3239.x | |
kzar
2018/05/04 10:52:43
Seems like one of these comments can go?
hub
2018/05/18 00:04:22
Yes and no. It is kinda difficult to figure out wh
| |
28 const CHROMIUM_REVISION = 508578; | |
29 // Chromium 65.0.3325.0 is 530368 | |
30 | |
31 function runScript(chromiumPath, script, scriptName, scriptArgs) | |
32 { | |
33 const options = new chrome.Options() | |
34 .headless() | |
35 .setChromeBinaryPath(chromiumPath); | |
36 | |
37 const driver = new Builder() | |
38 .forBrowser("chrome") | |
39 .setChromeOptions(options) | |
40 .build(); | |
41 | |
42 return executeScript(driver, "Chromium (WebDriver)", | |
43 script, scriptName, scriptArgs); | |
44 } | |
45 | |
46 module.exports = function(script, scriptName, ...scriptArgs) | |
47 { | |
48 return ensureChromium(CHROMIUM_REVISION).then(chromiumPath => | |
49 { | |
50 return runScript(chromiumPath, script, scriptName, scriptArgs) | |
51 .then(result => | |
52 { | |
53 return result; | |
54 }).catch(error => | |
55 { | |
56 throw error; | |
57 }); | |
58 }); | |
59 }; | |
OLD | NEW |