tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

sync-access-handle-test.js (689B)


      1 async function cleanupSandboxedFileSystem() {
      2  const dir = await navigator.storage.getDirectory();
      3  for await (let entry of dir.values())
      4    await dir.removeEntry(entry.name, {recursive: entry.kind === 'directory'});
      5 }
      6 
      7 function sync_access_handle_test(test, description) {
      8  promise_test(async t => {
      9    // To be extra resilient against bad tests, cleanup before every test.
     10    await cleanupSandboxedFileSystem();
     11    const dir = await navigator.storage.getDirectory();
     12    const fileHandle = await dir.getFileHandle('OPFS.test', {create: true});
     13    const syncHandle = await fileHandle.createSyncAccessHandle();
     14    test(t, syncHandle);
     15    syncHandle.close();
     16  }, description);
     17 }