Feature Request / Inquiry
Hi,
We're looking into using Cesium in a desktop app, and are debating expanding our CSP to support wasm. As part of the discussion, we'd like to know if it is possible to run Cesium without wasm support - or to at least move all wasm usage to within workers to allow for a less-permissive CSP where wasm-unsafe-eval is scoped to worker contexts.
With the help of Claude I've gathered all instances of wasm usage in the library below. As mentioned, one compromise might be to move all wasm usage into workers. Then we could dynamically add headers to worker responses with the CSP only for that response (CSPs are set from the response for the resource that creates the context for which a particular CSP is valid)
Main Thread
| Dependency |
Imported at |
Compile timing |
Runtime trigger |
meshoptimizer |
Scene/GltfBufferViewLoader.js#L5 (sync decodeGltfBuffer at L176); Core/Cesium3DTilesTerrainGeometryProcessor.js#L1 |
Eager — module-scope IIFE calls WebAssembly.instantiate at import (meshopt_decoder.mjs, ~L30) |
EXT_meshopt_compression content; 3D Tiles terrain |
@spz-loader/core |
Scene/GltfSpzLoader.js#L7 |
Lazy — instantiates on first loadSpz(), but still main-thread |
SPZ Gaussian splat content |
long (via protobufjs, from Core/GoogleEarthEnterpriseMetadata.js / Scene/GoogleEarthEnterpriseImageryProvider.js) |
long/index.js, ~L24 |
Eager — module-scope new WebAssembly.Instance feature probe (try/caught, but still generates a CSP violation report) |
none (feature probe) |
Worker-side
Pattern: main thread fetches .wasm bytes (TaskProcessor.initWebAssemblyModule), posts to worker, worker compiles under its own header-delivered policy.¹
Thanks in advance :)
P.S. only partially used AI for the source-gathering.
AI acknowledgment
At least tangentially related: #13412
Feature Request / Inquiry
Hi,
We're looking into using Cesium in a desktop app, and are debating expanding our CSP to support wasm. As part of the discussion, we'd like to know if it is possible to run Cesium without wasm support - or to at least move all wasm usage to within workers to allow for a less-permissive CSP where
wasm-unsafe-evalis scoped to worker contexts.With the help of Claude I've gathered all instances of wasm usage in the library below. As mentioned, one compromise might be to move all wasm usage into workers. Then we could dynamically add headers to worker responses with the CSP only for that response (CSPs are set from the response for the resource that creates the context for which a particular CSP is valid)
Main Thread
meshoptimizerScene/GltfBufferViewLoader.js#L5(syncdecodeGltfBufferat L176);Core/Cesium3DTilesTerrainGeometryProcessor.js#L1WebAssembly.instantiateat import (meshopt_decoder.mjs, ~L30)EXT_meshopt_compressioncontent; 3D Tiles terrain@spz-loader/coreScene/GltfSpzLoader.js#L7loadSpz(), but still main-threadlong(viaprotobufjs, fromCore/GoogleEarthEnterpriseMetadata.js/Scene/GoogleEarthEnterpriseImageryProvider.js)long/index.js, ~L24new WebAssembly.Instancefeature probe (try/caught, but still generates a CSP violation report)Worker-side
Pattern: main thread fetches
.wasmbytes (TaskProcessor.initWebAssemblyModule), posts to worker, worker compiles under its own header-delivered policy.¹Scene/DracoLoader.jsWorkers/decodeDraco.jsThirdParty/draco_decoder.wasmCore/KTX2Transcoder.jsWorkers/transcodeKTX2.jsThirdParty/basis_transcoder.wasmScene/I3SDecoder.jsWorkers/decodeI3S.jsThirdParty/draco_decoder.wasmScene/GaussianSplatSorter.jsWorkers/gaussianSplatSorter.jsThirdParty/wasm_splats_bg.wasmScene/GaussianSplatTextureGenerator.jsWorkers/gaussianSplatTextureGenerator.jsThirdParty/wasm_splats_bg.wasmDataSources/KmlDataSource.js(configure()insideloadKmz()— lazy and worker-routed)ThirdParty/Workers/zip-web-worker.jsThirdParty/zip-module.wasmThanks in advance :)
P.S. only partially used AI for the source-gathering.
AI acknowledgment
At least tangentially related: #13412