@found-in-space/skykit 0.2.0-alpha.20260528 → 0.2.0-alpha.20260529

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@found-in-space/skykit",
3
- "version": "0.2.0-alpha.20260528",
3
+ "version": "0.2.0-alpha.20260529",
4
4
  "description": "Slim composition and teaching layer for Found in Space packages",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -71,9 +71,9 @@
71
71
  "dependencies": {
72
72
  "@found-in-space/anchored-image": "0.2.0-alpha.0",
73
73
  "@found-in-space/hr-diagram": "0.2.0-alpha.1",
74
- "@found-in-space/meta-sidecar-provider": "0.2.0-alpha.0",
74
+ "@found-in-space/meta-sidecar-provider": "0.2.0-alpha.1",
75
75
  "@found-in-space/spatial": "0.2.0-alpha.20260528",
76
- "@found-in-space/star-octree-provider": "0.2.0-alpha.0",
76
+ "@found-in-space/star-octree-provider": "0.2.0-alpha.1",
77
77
  "@found-in-space/star-trees": "0.2.0-alpha.0",
78
78
  "@found-in-space/three-star-field": "0.2.0-alpha.0"
79
79
  },
@@ -191,6 +191,25 @@ test('createSkykitBrowser enables persistent provider cache by default and can o
191
191
  });
192
192
  });
193
193
 
194
+ test('createSkykitBrowser treats forbidden Cache API access as disabled', async () => {
195
+ await withFakeWindow(async () => {
196
+ await withForbiddenCaches(async () => {
197
+ const browser = await createSkykitBrowser({
198
+ host: createHost(),
199
+ status: false,
200
+ renderer: createRenderer(),
201
+ starField: createStarField(),
202
+ autoResize: false,
203
+ autoDispose: false,
204
+ autoStart: false,
205
+ });
206
+
207
+ assert.equal(browser.provider.describe().capabilities.persistentCache, false);
208
+ await browser.dispose();
209
+ });
210
+ });
211
+ });
212
+
194
213
  test('browser.install adds plugins after startup and cleans returned teardowns', async () => {
195
214
  await withFakeWindow(async () => {
196
215
  const calls = [];
@@ -330,7 +349,7 @@ async function withFakeWindow(callback) {
330
349
  }
331
350
 
332
351
  async function withFakeCaches(callback) {
333
- const previousCaches = globalThis.caches;
352
+ const previousCaches = Object.getOwnPropertyDescriptor(globalThis, 'caches');
334
353
  const previousFetch = globalThis.fetch;
335
354
  const cache = {
336
355
  async match() {
@@ -369,14 +388,7 @@ async function withFakeCaches(callback) {
369
388
  try {
370
389
  await callback();
371
390
  } finally {
372
- if (previousCaches === undefined) {
373
- delete globalThis.caches;
374
- } else {
375
- Object.defineProperty(globalThis, 'caches', {
376
- configurable: true,
377
- value: previousCaches,
378
- });
379
- }
391
+ restoreGlobalProperty('caches', previousCaches);
380
392
  if (previousFetch === undefined) {
381
393
  delete globalThis.fetch;
382
394
  } else {
@@ -388,6 +400,36 @@ async function withFakeCaches(callback) {
388
400
  }
389
401
  }
390
402
 
403
+ async function withForbiddenCaches(callback) {
404
+ const previousCaches = Object.getOwnPropertyDescriptor(globalThis, 'caches');
405
+ const previousWarn = console.warn;
406
+
407
+ Object.defineProperty(globalThis, 'caches', {
408
+ configurable: true,
409
+ get() {
410
+ const error = new Error('Cache API storage is blocked.');
411
+ error.name = 'SecurityError';
412
+ throw error;
413
+ },
414
+ });
415
+ console.warn = () => {};
416
+
417
+ try {
418
+ await callback();
419
+ } finally {
420
+ console.warn = previousWarn;
421
+ restoreGlobalProperty('caches', previousCaches);
422
+ }
423
+ }
424
+
425
+ function restoreGlobalProperty(name, descriptor) {
426
+ if (descriptor) {
427
+ Object.defineProperty(globalThis, name, descriptor);
428
+ } else {
429
+ delete globalThis[name];
430
+ }
431
+ }
432
+
391
433
  function createHost() {
392
434
  return {
393
435
  children: [],