Guard browser storage behind OPFS

This commit is contained in:
cnc
2026-06-02 07:11:41 +08:00
parent 0db23b4a5d
commit dab7b9e2ef
4 changed files with 17 additions and 0 deletions

View File

@@ -753,6 +753,10 @@ grep -F -- './test-web-wasm-node-smoke.sh' build-wasm.sh >/dev/null
grep -F -- './test-web-wasm-browser-smoke.sh' build-wasm.sh >/dev/null
grep -F 'const opfsOptions = options.opfs ?? (isOpfsAvailable() ? {} : false)' web/src/wasm-core.js >/dev/null
grep -F 'OPFS cannot be disabled in browser contexts with OPFS support' web/src/wasm-core.js >/dev/null
if grep -R -n -E 'localStorage|sessionStorage|indexedDB|showOpenFilePicker|showSaveFilePicker|webkitRequestFileSystem|FileReader' web/src; then
echo "browser app/wasm code must not add filesystem persistence outside OPFS" >&2
exit 1
fi
grep -F 'async function opfsEntryExists(workspacePath, relativePath)' web/src/wasm-core.js >/dev/null
grep -F 'async function statOpfsEntry(workspacePath, relativePath)' web/src/wasm-core.js >/dev/null
grep -F 'async function readOpfsDirectoryTree(workspacePath, relativePath, relativeRoot = "")' web/src/wasm-core.js >/dev/null