From 39e7e1ff49e8e514c091cda81d037a2e5278135b Mon Sep 17 00:00:00 2001 From: Alexandre LEGOUT Date: Sat, 3 Oct 2026 22:13:23 +0000 Subject: [PATCH 1/2] Load OPFSAdaptiveVFS where FileSystemSyncAccessHandle is unavailable. The module read FileSystemSyncAccessHandle.prototype while it was evaluated, so importing it threw wherever the interface is missing: on a main thread, in Node, on a page that is not a secure context, and in browsers older than the interface. A worker bundling several VFS then failed to load as a whole. Co-Authored-By: Claude Opus 5.5 --- src/examples/OPFSAdaptiveVFS.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/examples/OPFSAdaptiveVFS.js b/src/examples/OPFSAdaptiveVFS.js index 07405d7e..38ff140c 100644 --- a/src/examples/OPFSAdaptiveVFS.js +++ b/src/examples/OPFSAdaptiveVFS.js @@ -6,7 +6,7 @@ import { WebLocksMixin } from '../WebLocksMixin.js'; const LOCK_NOTIFY_INTERVAL = 1000; const hasUnsafeAccessHandle = - globalThis.FileSystemSyncAccessHandle.prototype.hasOwnProperty('mode'); + globalThis.FileSystemSyncAccessHandle?.prototype.hasOwnProperty('mode'); /** * @param {string} pathname From 80934a52e8b05f3775e241f15f8765b7ee15fafb Mon Sep 17 00:00:00 2001 From: Alexandre LEGOUT Date: Sat, 3 Oct 2026 22:13:23 +0000 Subject: [PATCH 2/2] Add a test that OPFSAdaptiveVFS loads without FileSystemSyncAccessHandle. Co-Authored-By: Claude Opus 5.5 --- test/OPFSAdaptiveVFS.test.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/OPFSAdaptiveVFS.test.js b/test/OPFSAdaptiveVFS.test.js index aadaea28..917bb994 100644 --- a/test/OPFSAdaptiveVFS.test.js +++ b/test/OPFSAdaptiveVFS.test.js @@ -12,6 +12,19 @@ const BUILDS = ['asyncify', 'jspi']; const supportsJSPI = await TestContext.supportsJSPI(); describe(CONFIG, function() { + it('should load where FileSystemSyncAccessHandle is unavailable', async function() { + // The interface exists in dedicated workers only, so this page lacks it, + // as do Node and a page that is not a secure context. + expect(globalThis.FileSystemSyncAccessHandle).toBeUndefined(); + let error; + try { + await import('../src/examples/OPFSAdaptiveVFS.js'); + } catch (e) { + error = e; + } + expect(error?.message).toBeUndefined(); + }); + for (const build of BUILDS) { if (build === 'jspi' && !supportsJSPI) return;