diff --git a/docs/pages/docs/Other engines/web.md b/docs/pages/docs/Other engines/web.md index fa479ce2..2600f7cf 100644 --- a/docs/pages/docs/Other engines/web.md +++ b/docs/pages/docs/Other engines/web.md @@ -112,6 +112,9 @@ Note that Safari 16 has an [unfortunate bug](https://bugs.webkit.org/show_bug.cg preventing dedicated workers to be loaded from cache with these headers. However, shared and service workers are unaffected by this. +These headers are incompatible with [Google Auth +Popups](https://developers.google.com/identity/gsi/web/guides/get-google-api-clientid#:~:text=com%2Fgsi%2F%3B-,Cross%20Origin%20Opener%20Policy,popup%20window%20or%20similar%20bugs.). + ### Setup in Dart From a perspective of the Dart code used, drift on the web is similar to drift on other platforms. diff --git a/drift/lib/src/web/wasm_setup.dart b/drift/lib/src/web/wasm_setup.dart index ee2dcd0b..42ccb35e 100644 --- a/drift/lib/src/web/wasm_setup.dart +++ b/drift/lib/src/web/wasm_setup.dart @@ -93,11 +93,19 @@ class WasmDatabaseOpener { // format to avoid data loss (e.g. after a browser update that enables a // otherwise preferred storage implementation). In the future, we might want // to consider migrating between storage implementations as well. - if (_existsInIndexedDb) { + if (_existsInIndexedDb && + (availableImplementations + .contains(WasmStorageImplementation.sharedIndexedDb) || + availableImplementations + .contains(WasmStorageImplementation.unsafeIndexedDb))) { availableImplementations.removeWhere((element) => element != WasmStorageImplementation.sharedIndexedDb && element != WasmStorageImplementation.unsafeIndexedDb); - } else if (_existsInOpfs) { + } else if (_existsInOpfs && + (availableImplementations + .contains(WasmStorageImplementation.opfsShared) || + availableImplementations + .contains(WasmStorageImplementation.opfsLocks))) { availableImplementations.removeWhere((element) => element != WasmStorageImplementation.opfsShared && element != WasmStorageImplementation.opfsLocks);