Skip to content

Commit 1807e1a

Browse files
stepankuzmingithub-actions[bot]
authored andcommitted
Improve CSP tests to cover 3D features and WASM usage (internal-9274)
GitOrigin-RevId: 25d9c0772ff99a66a48a511adfd3f779d8103c40
1 parent 6d229d9 commit 1807e1a

3 files changed

Lines changed: 12 additions & 4 deletions

File tree

test/integration/csp-tests/fixtures/csp.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@
1414
if (e.data.type === 'load') {
1515
const map = new mapboxgl.Map({
1616
container: 'map',
17-
style: e.data.payload
17+
style: e.data.payload,
18+
center: [-74.006, 40.7128], // NYC
19+
zoom: 16,
20+
pitch: 60
1821
});
1922

2023
map.once('load', () => {

test/integration/csp-tests/fixtures/strict.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@
1515
if (e.data.type === 'load') {
1616
const map = new mapboxgl.Map({
1717
container: 'map',
18-
style: e.data.payload
18+
style: e.data.payload,
19+
center: [-74.006, 40.7128], // NYC
20+
zoom: 16,
21+
pitch: 60
1922
});
2023

2124
map.once('load', () => {

test/integration/csp-tests/index.test.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@ default-src 'none';
66
img-src data: blob:;
77
worker-src blob:;
88
style-src https://api.mapbox.com/mapbox-gl-js/ 'unsafe-inline';
9-
script-src https://api.mapbox.com/mapbox-gl-js/ 'unsafe-inline';
9+
script-src https://api.mapbox.com/mapbox-gl-js/ 'unsafe-inline' 'wasm-unsafe-eval';
1010
connect-src
1111
https://api.mapbox.com/v4/
1212
https://api.mapbox.com/raster/v1/
1313
https://api.mapbox.com/rasterarrays/v1/
1414
https://api.mapbox.com/styles/v1/mapbox/
1515
https://api.mapbox.com/fonts/v1/mapbox/
1616
https://api.mapbox.com/models/v1/mapbox/
17+
https://api.mapbox.com/mapbox-gl-js/
1718
https://api.mapbox.com/map-sessions/v1
1819
https://events.mapbox.com/
1920
`;
@@ -23,14 +24,15 @@ default-src 'none';
2324
img-src data: blob:;
2425
worker-src ${href}dist/mapbox-gl-csp-worker.js;
2526
style-src https://api.mapbox.com/mapbox-gl-js/ 'unsafe-inline';
26-
script-src https://api.mapbox.com/mapbox-gl-js/ 'unsafe-inline';
27+
script-src https://api.mapbox.com/mapbox-gl-js/ 'unsafe-inline' 'wasm-unsafe-eval';
2728
connect-src
2829
https://api.mapbox.com/v4/
2930
https://api.mapbox.com/raster/v1/
3031
https://api.mapbox.com/rasterarrays/v1/
3132
https://api.mapbox.com/styles/v1/mapbox/
3233
https://api.mapbox.com/fonts/v1/mapbox/
3334
https://api.mapbox.com/models/v1/mapbox/
35+
https://api.mapbox.com/mapbox-gl-js/
3436
https://api.mapbox.com/map-sessions/v1
3537
https://events.mapbox.com/
3638
`;

0 commit comments

Comments
 (0)