Update text component to fix unsafe-eval error with a strict CSP#5821
Conversation
|
Test is failing as expected until the other PR is merged and this PR is rebased |
|
Small nitpick: the test explicitly mentions the |
Loads the A-Frame bundle inside an iframe enforcing a CSP without 'unsafe-eval' (mirroring examples/test/text/index.html) and asserts the browser reports no eval / new Function() securitypolicyviolation. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
d31ecf8 to
0a56863
Compare
|
You're absolutely right. |
|
Locally the test is green, but in CI it's failing. The in-memory I'll write the test in another way. |
The in-memory karma-webpack bundle is istanbul-instrumented under TEST_ENV=ci, and the instrumentation itself emits new Function() (its global-object lookup). That tripped the CSP test in CI even though A-Frame no longer evals. Load the built dist/aframe-master.js instead, which CI rebuilds via `npm run dist` before tests; detect success via the global AFRAME the bundle assigns. Also capture the violation source/sample for clearer diagnostics. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Firefox enforced the iframe srcdoc CSP with an about:srcdoc base URL, so the absolute-path bundle <script> did not resolve to the real origin and was blocked by script-src (a script-src-elem load violation, not an eval). Load a real served page (tests/csp/csp-host.html) in the iframe instead so 'self' and URL resolution behave the same in Chrome and Firefox, and match only actual eval/wasm-eval blockedURIs rather than any script-src* entry. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
The test pass on Chrome and Firefox. I updated the PR title and description. |
|
Thank you! |
Update three-bmfont-text version to include dmarcos/three-bmfont-text#5 to avoid using "new Function()" that triggers unsafe-eval error with a strict CSP (Content Security Policy), see #5028 for context.
Add a unsafe-eval error non regression test that runs in CI with Chrome and Firefox.