From bfaa3dd87086cec916a801cec69afd2098b2eecf Mon Sep 17 00:00:00 2001 From: Timothy Sullivan Date: Thu, 9 Apr 2020 14:19:23 -0700 Subject: [PATCH] revert unrelated changes --- .../browsers/chromium/driver_factory/args.ts | 2 +- .../browsers/chromium/driver_factory/index.ts | 18 ++++++++---------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/x-pack/legacy/plugins/reporting/server/browsers/chromium/driver_factory/args.ts b/x-pack/legacy/plugins/reporting/server/browsers/chromium/driver_factory/args.ts index 928f3b8377809..a2f7a1f3ad0da 100644 --- a/x-pack/legacy/plugins/reporting/server/browsers/chromium/driver_factory/args.ts +++ b/x-pack/legacy/plugins/reporting/server/browsers/chromium/driver_factory/args.ts @@ -10,7 +10,7 @@ type ViewportConfig = CaptureConfig['viewport']; type BrowserConfig = CaptureConfig['browser']['chromium']; interface LaunchArgs { - userDataDir: string; + userDataDir: BrowserConfig['userDataDir']; viewport: ViewportConfig; disableSandbox: BrowserConfig['disableSandbox']; proxy: BrowserConfig['proxy']; diff --git a/x-pack/legacy/plugins/reporting/server/browsers/chromium/driver_factory/index.ts b/x-pack/legacy/plugins/reporting/server/browsers/chromium/driver_factory/index.ts index 46cd71c208388..cb228150efbcd 100644 --- a/x-pack/legacy/plugins/reporting/server/browsers/chromium/driver_factory/index.ts +++ b/x-pack/legacy/plugins/reporting/server/browsers/chromium/driver_factory/index.ts @@ -56,7 +56,7 @@ export class HeadlessChromiumDriverFactory { type = BROWSER_TYPE; - async test(logger: Logger) { + test(logger: Logger) { const chromiumArgs = args({ userDataDir: this.userDataDir, viewport: { width: 800, height: 600 }, @@ -64,21 +64,19 @@ export class HeadlessChromiumDriverFactory { proxy: this.browserConfig.proxy, }); - try { - return await puppeteerLaunch({ - userDataDir: this.userDataDir, - executablePath: this.binaryPath, - ignoreHTTPSErrors: true, - args: chromiumArgs, - } as LaunchOptions); - } catch (error) { + return puppeteerLaunch({ + userDataDir: this.userDataDir, + executablePath: this.binaryPath, + ignoreHTTPSErrors: true, + args: chromiumArgs, + } as LaunchOptions).catch((error: Error) => { logger.error( `The Reporting plugin encountered issues launching Chromium in a self-test. You may have trouble generating reports.` ); logger.error(error); logger.warning(`See Chromium's log output at "${getChromeLogLocation(this.binaryPath)}"`); return null; - } + }); } /*