Repository navigation
fix(viz): load map panels in sandboxed frames without allow-same-origin - #5033
Merged
Merged
Conversation
In a sandboxed frame without allow-same-origin (CKAN's recommended Webpage view sandbox), the page's window.origin is "null" while location.origin is still the URL's, and MapLibre's blob: worker reports "null". The MapLibre bundled in plotly.js 3.x drops every page<->worker message whose origin differs from its own, so every map panel stayed blank with no error. Its filter exempts the literal origin "file://". A small Worker wrapper, emitted first in plotly_js_block() so it runs before plotly.js creates its workers, stamps that origin on every message in both directions. It is inert outside opaque-origin, non-file: pages. Verified in Chrome, Firefox and Safari for region and clustered point maps in Data Schematics and viz map: strict sandbox blank -> loaded, with no change under no sandbox, allow-same-origin or file://. Removes the #4947 note shown above each map in such a frame, and regenerates the gallery. The wrapper can go once plotly.js bundles MapLibre >= 6.17 (maplibre-gl-js#8912). Fixes #4946 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Up to standards ✅🟢 Issues
|
There was a problem hiding this comment.
Pull Request Overview
This pull request is too large for an AI review. Its diff is over the size the reviewer can fetch from the Git provider. Splitting it into smaller pull requests lets the reviewer cover it.
TIP How was this review? Give us feedback
jqnatividad
added a commit
that referenced
this pull request
Nov 11, 2026
The sandbox Worker shim from #5033 only covers MapLibre 4.x (plotly.js 3.x). plotly.js 4.1.2 and 4.2.0 bundle MapLibre 6.11.2, whose module blob: worker Chrome and Safari refuse in opaque origins, and the shim tests only check the shim is emitted. Record the trap and the three-browser check on the shim's doc comment. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
jqnatividad
added a commit
that referenced
this pull request
Nov 15, 2026
Regenerated from the 29.0.0 run in b45bb98 with scripts/gen_benchmark_viz.py, including hero.png for the wiki. The data-driven prose now reads qsv 29.0.0 and 67 releases. Every page also picks up #5033's viz template change: the sandboxed-frame notice is gone and the opaque-origin fix is in <head>. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #4946.
Problem
Every MapLibre map (
viz map,viz choropleth --map, and the point and region maps in a Data Schematic) stayed blank, with no error, in a sandboxed frame withoutallow-same-origin. That includes the CKAN Webpage view sandbox the wiki recommends (sandbox="allow-scripts allow-popups allow-downloads").In such a frame the page's
window.originis"null"butlocation.originis still the URL's, and MapLibre'sblob:worker reports"null". MapLibre 4.7.1 (bundled in plotly.js 3.7.0) drops every page↔worker message whoseoriginfield differs from its own, so tiles never load.Fix
MapLibre's filter exempts the literal origin
"file://". A ~15-lineWorkerwrapper (SANDBOX_WORKER_SHIM) stamps that origin on every message in both directions. Itsmessagelistener is registered in the constructor, so it runs before MapLibre's. It is emitted first inplotly_js_block(), before plotly.js creates its workers, so it covers every page path (Data Schematics and single charts) and every bundle mode (inline gzip,QSV_VIZ_NO_COMPRESS,QSV_VIZ_CDN). It does nothing except in an opaque-origin page that isn't afile:page.This needs no plotly.js 4.x upgrade, which is on hold pending plotly/plotly.rs#437. The wrapper can go once the vendored plotly.js bundles MapLibre ≥ 6.17 (maplibre/maplibre-gl-js#8912).
Also removes the #4947 note shown above each map in such a frame (the JS, its placeholder substitution, 7 locale strings and its unit test), and regenerates all 23 gallery Data Schematics. Their diffs are only the shim, the removed note, the compile time and a new schematic UUID.
Verification
Browser matrix: Chrome, Firefox and Safari, each page in an iframe in three frame modes. Pass = MapLibre
loaded()+isStyleLoaded()+areTilesLoaded().viz map).allow-same-originandfile://case that reported loaded both with and without the shim. Four control results from the last run never posted back and weren't re-run.Tests:
plotly_js_block_installs_sandbox_worker_shim_first, and integration testviz_sandbox_worker_shim_precedes_plotly_bundle, which checks the shim comes before the plotly bundle forviz mapin all three bundle modes and forviz smart. Its marker stringqsvStampOrigincannot occur in the plotly bundle.plotly_js_block()fails both tests.test_viz619 passed; viz unit tests 449 passed; clippy clean on changed lines.Wiki: the Visualization › CKAN advice that map panels don't work in that sandbox is updated separately.
🤖 Generated with Claude Code