Embed views and the application shell leave the Cesium allow-list

The embed views fly through rendererOf's camera port with geo maths, and
the panel render loop that keeps an inline panel drawing moves into the
Cesium adapter (src/render/cesium/panelRendering.js); the application
scene hands it to the embed views as `keepRendering`. The shell reaches
the camera, effects and globe through rendererOf and loads no Cesium
factories; whether Cockpit's aircraft is an entity of the viewer's own
comes from the scene's `viewerDrawsEntity`, wired in through the
controls. Callers handing the shell or the application tools a viewer
of their own load ./render/cesium/unbound once, as the ports' unbound
check now records.
This commit is contained in:
Sameh Khamis committed 2026-11-09 12:43:36 -08:00
1 parent e6d9ec0636
commit 26665e8390
16 files changed
+222 -185

No files matched your search

+8 -68
View File
@@ -5,7 +5,6 @@ import {
applyView,
installViews,
isEmbedded,
keepPanelRendering,
panelAwareVisibility,
} from './embed.js';
import { LayerLifecycle } from '../data/lifecycle.js';
@@ -203,6 +202,7 @@ test('an app loaded inline into a panel page talks through its own window', asyn
globalThis.GEV_EMBED_INLINE = true;
try {
assert.equal(isEmbedded({ search: '' }), true);
const kept = [];
const remove = installViews({
shell: { initialRestorePromise: Promise.resolve() },
viewer: fakeViewer(),
@@ -210,7 +210,13 @@ test('an app loaded inline into a panel page talks through its own window', asyn
run: recorder().run,
location: { search: '', hash: '' },
windowRef,
// The scene's panel rendering, kept on while the views are installed.
keepRendering: (options) => {
kept.push(options.windowRef === windowRef);
return () => kept.push('stopped');
},
});
assert.deepEqual(kept, [true]);
await new Promise((resolve) => setTimeout(resolve, 0));
assert.deepEqual(posted, [{ type: 'gev:ready' }]);
const event = new Event('message');
@@ -223,6 +229,7 @@ test('an app loaded inline into a panel page talks through its own window', asyn
assert.equal(posted[1].id, 7);
assert.equal(posted[1].ok, true);
remove();
assert.deepEqual(kept, [true, 'stopped']);
} finally {
delete globalThis.GEV_EMBED_INLINE;
}
@@ -301,73 +308,6 @@ test('annotations in a link are drawn after it restores, embedded or not', async
]);
});
test('a panel keeps drawing from a timer while animation frames stop', () => {
let clock = 0;
let tick = null;
let frame = null;
const windowRef = {
requestAnimationFrame: (fn) => ((frame = fn), 1),
cancelAnimationFrame: () => (frame = null),
setInterval: (fn) => ((tick = fn), 1),
clearInterval: () => (tick = null),
};
const drawn = [];
const viewer = {
resize: () => drawn.push('resize'),
render: () => drawn.push('render'),
};
const stop = keepPanelRendering(viewer, { windowRef, now: () => clock });
// Frames arrive: the render loop draws, so the timer does nothing.
clock = 100;
frame();
tick();
assert.deepEqual(drawn, []);
// Frames stop, as in a panel its host reports hidden: the timer draws.
clock = 400;
tick();
assert.deepEqual(drawn, ['resize', 'render']);
stop();
assert.equal(tick, null);
assert.equal(frame, null);
});
test('a panel reports a render error in full and stops drawing', () => {
let listener = null;
let tick = null;
const windowRef = {
requestAnimationFrame: () => 1,
cancelAnimationFrame() {},
setInterval: (fn) => ((tick = fn), 1),
clearInterval() {},
};
const drawn = [];
const viewer = {
resize() {},
render: () => drawn.push('render'),
scene: {
renderError: {
addEventListener: (fn) => ((listener = fn), () => (listener = null)),
},
},
};
const logged = [];
const original = console.error;
console.error = (...args) => logged.push(args.join(' '));
try {
let clock = 0;
const stop = keepPanelRendering(viewer, { windowRef, now: () => clock });
listener(viewer.scene, { name: 'RuntimeError', message: 'worker failed' });
assert.match(logged[0], /render error: .*"message":"worker failed"/);
clock = 1000;
tick();
assert.deepEqual(drawn, []);
stop();
assert.equal(listener, null);
} finally {
console.error = original;
}
});
test('a followed aircraft owns the camera, and cockpit view is entered after it', async () => {
const viewer = fakeViewer();
const { calls, run } = recorder();