From f7b5b34c7c4849a8111907d649ca7cad8f4382a5 Mon Sep 17 00:00:00 2001 From: Joel Griffith Date: Fri, 17 Jan 2020 10:09:49 -0800 Subject: [PATCH] Better destructuring and comments --- .../browsers/chromium/driver/chromium_driver.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/x-pack/legacy/plugins/reporting/server/browsers/chromium/driver/chromium_driver.ts b/x-pack/legacy/plugins/reporting/server/browsers/chromium/driver/chromium_driver.ts index 46f4867e505f2..de8449ff29132 100644 --- a/x-pack/legacy/plugins/reporting/server/browsers/chromium/driver/chromium_driver.ts +++ b/x-pack/legacy/plugins/reporting/server/browsers/chromium/driver/chromium_driver.ts @@ -67,11 +67,16 @@ export class HeadlessChromiumDriver { await this.page.setRequestInterception(true); - // We have to reach into the Chrome Remote Protocol to apply headers as using - // puppeteer's API will render map tiles as blanks :/ + // We have to reach into the Chrome Devtools Protocol to apply headers as using + // puppeteer's API will cause map tile requests to hang indefinitely: + // https://github.com/puppeteer/puppeteer/issues/5003 + // Docs on this client/protocol can be found here: + // https://chromedevtools.github.io/devtools-protocol/tot/Fetch client.on('Fetch.requestPaused', (interceptedRequest: InterceptedRequest) => { - const requestId = interceptedRequest.requestId; - const interceptedUrl = interceptedRequest.request.url; + const { + requestId, + request: { url: interceptedUrl }, + } = interceptedRequest; const allowed = !interceptedUrl.startsWith('file://'); const isData = interceptedUrl.startsWith('data:');