From 754dd7ddd18f8378ce92802baad30a38d74a80f6 Mon Sep 17 00:00:00 2001 From: Hadrien Milano Date: Thu, 16 Jul 2020 11:23:14 +0200 Subject: [PATCH] Fix alternate CDN --- lib/binaries/chrome_driver.ts | 2 +- lib/binaries/chrome_xml.ts | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/binaries/chrome_driver.ts b/lib/binaries/chrome_driver.ts index 74ac0f74..9b45d1d3 100644 --- a/lib/binaries/chrome_driver.ts +++ b/lib/binaries/chrome_driver.ts @@ -11,7 +11,7 @@ export class ChromeDriver extends Binary { constructor(opt_alternativeCdn?: string) { super(opt_alternativeCdn || Config.cdnUrls().chrome); - this.configSource = new ChromeXml(); + this.configSource = new ChromeXml(opt_alternativeCdn); this.name = 'chromedriver'; this.versionDefault = ChromeDriver.versionDefault; this.versionCustom = this.versionDefault; diff --git a/lib/binaries/chrome_xml.ts b/lib/binaries/chrome_xml.ts index 3ab6fca8..7d08f82c 100644 --- a/lib/binaries/chrome_xml.ts +++ b/lib/binaries/chrome_xml.ts @@ -9,8 +9,8 @@ import {XmlConfigSource} from './config_source'; export class ChromeXml extends XmlConfigSource { maxVersion = Config.binaryVersions().maxChrome; - constructor() { - super('chrome', Config.cdnUrls()['chrome']); + constructor(opt_alternativeCdn?: string) { + super('chrome', opt_alternativeCdn || Config.cdnUrls()['chrome']); } getUrl(version: string): Promise { @@ -63,7 +63,7 @@ export class ChromeXml extends XmlConfigSource { * Gets the latest item from the XML. */ private getLatestChromeDriverVersion(): Promise { - const latestReleaseUrl = 'https://chromedriver.storage.googleapis.com/LATEST_RELEASE'; + const latestReleaseUrl = `${this.xmlUrl}/LATEST_RELEASE`; return requestBody(latestReleaseUrl).then(latestVersion => { return this.getSpecificChromeDriverVersion(latestVersion); }); @@ -111,7 +111,7 @@ export class ChromeXml extends XmlConfigSource { if (itemFound == '') { return {url: '', version: inputVersion}; } else { - return {url: Config.cdnUrls().chrome + itemFound, version: inputVersion}; + return {url: this.xmlUrl + itemFound, version: inputVersion}; } }); }