Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix CSP bundle by not mangling class names there, and add CSP tests #11739

Merged
merged 3 commits into from
Apr 13, 2022

Conversation

mourner
Copy link
Member

@mourner mourner commented Apr 12, 2022

Fixes #11684, fixes #11686 (regression introduced in #11511). Disables class name mangling when making the CSP bundle. To make generic transfer of class instances between web worker and main thread work, we depend on class names being the same on both sides. However, the CSP bundle config runs the bundling process separately for the main thread and the worker, meaning that mangled names won't align as they are in the default bundle.

Disabling class name mangling only increases the size of both bundled files by ~2KB, and it's not the default bundle but rather one for strict CSP environments only, so it should be fine. We could approach this with a more elaborate fix that uses chunks to avoid this tiny overhead, but it doesn't seem to be worth it.

Also needs a test if possible to make sure this doesn't regress in the future. Added a new render test job that uses the CSP bundle to make sure we never regress on this again.

Launch Checklist

  • briefly describe the changes in this PR
  • write tests for all new functionality
  • manually test the debug page
  • apply changelog label ('bug', 'feature', 'docs', etc) or use the label 'skip changelog'
  • add an entry inside this element for inclusion in the mapbox-gl-js changelog: <changelog>Fix the special bundle for CSP-restricted environments that broke in the previous release.</changelog>

@mourner mourner requested a review from ryanhamley April 12, 2022 14:48
@mourner mourner requested a review from ansis April 12, 2022 16:21
@mourner mourner changed the title Fix CSP bundle by not mangling class names there Fix CSP bundle by not mangling class names there, and add CSP tests Apr 12, 2022
@mourner mourner merged commit 9bf51d9 into main Apr 13, 2022
@mourner mourner deleted the fix-csp-bundle branch April 13, 2022 09:08
avpeery pushed a commit that referenced this pull request Apr 13, 2022
…11739)

* fix CSP bundle by not mangling class names there

* add a render tests job that uses the CSP bundle

* fix lint
@avpeery avpeery mentioned this pull request Apr 13, 2022
2 tasks
karimnaaji pushed a commit that referenced this pull request Apr 13, 2022
* add missing roundZoom in CustomSource coveringTiles (#11749)

* Fix CSP bundle by not mangling class names there, and add CSP tests (#11739)

* fix CSP bundle by not mangling class names there

* add a render tests job that uses the CSP bundle

* fix lint

* update patch version too

Co-authored-by: Stepan Kuzmin <[email protected]>
Co-authored-by: Volodymyr Agafonkin <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants