-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Start web worker from static URL on startup #6058
Comments
@ryanbaumann is this preferable over having a separate worker bundle, per #5939? |
@anandthakker Either solution should work fine - whether the developer has to build the specific CSP support version, or the browser could make a run-time decision of which web worker initialization source to use. |
Quick proof of concept here: https://github.com/mapbox/mapbox-gl-js/tree/blobless, just tries the blob url first, catches the exception and tries again with a (user-provided) network URL instead. |
The fact that Safari disallows I know of one other place that blobs are used in Mapbox GL JS: Line 141 in b5722b9
Presumably we'd need a workaround for that as well. |
@jfirebaugh thanks for linking the bug in Safari. Summarizing what we've tried so far to support Mapbox GL on Safari in a sandboxed iframe:
Given the three options above, the only option we know of to support Mapbox GL in Safari using an iframe sandbox without the |
As of #6196, we're now building our bundle using Rollup, and while we're still producing a single bundle that loads the worker via a blob URL, we're much closer to being able to build & load the worker as a separate bundle:
|
@anandthakker fwiw, this is an important issue for us, now that Kibana will start shipping with a mapbox-gl dependency. Are there any plans to bump up this issue and add this option to future versions of mapbox-gl? thanks, |
@thomasneirynck - thanks for raising this issue to us. We'll add this to our planning and get back to you when we have a timeline. |
Looked at this again and turns out most of the groundwork for this was already laid out when we switched to Rollup for bundling. So I JFDI: #8044 |
Issue
Currently, Mapbox GL JS dynamically generates a worker on startup and hosts it in a local window URL. This startup method causes issues with:
worker:src
CSPallow-same-origin
on IE11, Safari, and Edge browsers.Possible implementation
Ideal solution
Ideally, we'd be able to detect CSP on the client and load the same JS file again, with a different entry point. The entry point can be a static worker URL if CSP
worker:src
is enforced.cc @kkaefer
Related: #6056
The text was updated successfully, but these errors were encountered: