Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/examples/OPFSAdaptiveVFS.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 13 additions & 0 deletions test/OPFSAdaptiveVFS.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Loading