From 7d0dceb5486420084b60a22d0917d866fb6b3a97 Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Mon, 25 Nov 2019 09:20:16 -0500 Subject: [PATCH] use worker --- src/legacy/server/csp/index.test.ts | 2 -- src/legacy/server/csp/index.ts | 2 -- test/api_integration/apis/general/csp.js | 2 -- .../maps/public/connected_components/map/mb/view.js | 10 ++++++++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/legacy/server/csp/index.test.ts b/src/legacy/server/csp/index.test.ts index 207b7be9df26a..6df00d02b6671 100644 --- a/src/legacy/server/csp/index.test.ts +++ b/src/legacy/server/csp/index.test.ts @@ -40,8 +40,6 @@ test('default CSP rules', () => { expect(DEFAULT_CSP_RULES).toMatchInlineSnapshot(` Array [ "script-src 'unsafe-eval' 'self'", - "worker-src blob:", - "child-src blob:", "style-src 'unsafe-inline' 'self'", ] `); diff --git a/src/legacy/server/csp/index.ts b/src/legacy/server/csp/index.ts index 476997dc48d66..880059c0548d9 100644 --- a/src/legacy/server/csp/index.ts +++ b/src/legacy/server/csp/index.ts @@ -19,8 +19,6 @@ export const DEFAULT_CSP_RULES = Object.freeze([ `script-src 'unsafe-eval' 'self'`, - 'worker-src blob:', - 'child-src blob:', `style-src 'unsafe-inline' 'self'`, ]); diff --git a/test/api_integration/apis/general/csp.js b/test/api_integration/apis/general/csp.js index ae5cf27ff68ff..72fe5ebec2ea9 100644 --- a/test/api_integration/apis/general/csp.js +++ b/test/api_integration/apis/general/csp.js @@ -37,8 +37,6 @@ export default function ({ getService }) { const entries = Array.from(parsed.entries()); expect(entries).to.eql([ [ 'script-src', [ '\'unsafe-eval\'', '\'self\'' ] ], - [ 'worker-src', [ 'blob:' ] ], - [ 'child-src', [ 'blob:' ] ], [ 'style-src', [ '\'unsafe-inline\'', '\'self\'' ] ] ]); }); diff --git a/x-pack/legacy/plugins/maps/public/connected_components/map/mb/view.js b/x-pack/legacy/plugins/maps/public/connected_components/map/mb/view.js index 84d7f8004ad9b..0808885f5c448 100644 --- a/x-pack/legacy/plugins/maps/public/connected_components/map/mb/view.js +++ b/x-pack/legacy/plugins/maps/public/connected_components/map/mb/view.js @@ -13,8 +13,12 @@ import { addSpritesheetToMap, } from './utils'; import { getGlyphUrl, isRetina } from '../../../meta'; -import { DECIMAL_DEGREES_PRECISION, ZOOM_PRECISION } from '../../../../common/constants'; -import mapboxgl from 'mapbox-gl'; +import { + DECIMAL_DEGREES_PRECISION, + ZOOM_PRECISION, +} from '../../../../common/constants'; +import mapboxgl from 'mapbox-gl/dist/mapbox-gl-csp'; +import mbWorkerUrl from '!!file-loader!mapbox-gl/dist/mapbox-gl-csp-worker'; import chrome from 'ui/chrome'; import { spritesheet } from '@elastic/maki'; import sprites1 from '@elastic/maki/dist/sprite@1.png'; @@ -22,6 +26,8 @@ import sprites2 from '@elastic/maki/dist/sprite@2.png'; import { DrawControl } from './draw_control'; import { TooltipControl } from './tooltip_control'; +mapboxgl.workerUrl = mbWorkerUrl; + export class MBMapContainer extends React.Component { state = { prevLayerList: undefined,