Page MenuHomePhabricator

D8611.diff
No OneTemporary

D8611.diff

diff --git a/web/database/types/sqlite-query-executor.js b/web/database/types/sqlite-query-executor.js
--- a/web/database/types/sqlite-query-executor.js
+++ b/web/database/types/sqlite-query-executor.js
@@ -23,6 +23,10 @@
setPersistStorageItem(key: string, item: string): void;
removePersistStorageItem(key: string): void;
getPersistStorageItem(key: string): string;
+
+ // method is provided to manually signal that a C++ object
+ // is no longer needed and can be deleted
+ delete(): void;
}
export type SQLiteQueryExecutorType = typeof SQLiteQueryExecutor;
diff --git a/web/database/utils/db-utils.js b/web/database/utils/db-utils.js
--- a/web/database/utils/db-utils.js
+++ b/web/database/utils/db-utils.js
@@ -7,9 +7,20 @@
import { isDev } from 'lib/utils/dev-utils.js';
import { DB_SUPPORTED_BROWSERS, DB_SUPPORTED_OS } from './constants.js';
+import { type EmscriptenModule } from '../types/module.js';
+import { type SQLiteQueryExecutor } from '../types/sqlite-query-executor.js';
const browser = detectBrowser();
+function clearSensitiveData(
+ dbModule: EmscriptenModule,
+ path: string,
+ sqliteQueryExecutor: SQLiteQueryExecutor,
+) {
+ sqliteQueryExecutor.delete();
+ dbModule.FS.unlink(path);
+}
+
function parseSQLiteQueryResult<T>(result: QueryExecResult): T[] {
const { columns, values } = result;
return values.map(rowResult => {
@@ -49,4 +60,9 @@
const isDesktopSafari: boolean =
browser && browser.name === 'safari' && browser.os === 'Mac OS';
-export { parseMultiStatementSQLiteResult, isSQLiteSupported, isDesktopSafari };
+export {
+ parseMultiStatementSQLiteResult,
+ isSQLiteSupported,
+ isDesktopSafari,
+ clearSensitiveData,
+};

File Metadata

Mime Type
text/plain
Expires
Sat, Nov 23, 1:39 PM (19 h, 21 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2570947
Default Alt Text
D8611.diff (1 KB)

Event Timeline