`PushDB` won't initialize if there are backward-incompatible changes to the IDB schema

NEW
Unassigned

Status

()

Core
DOM: Push Notifications
2 years ago
8 months ago

People

(Reporter: kitcambridge, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: btpp-fixlater)

:markh encountered bug 1258595 with a test profile the other day. The likely culprit is IndexedDB corruption caused by using the profile with multiple release channels (bug 1236557):

> 12:43:28.935 Quota 'resource' is not a valid schema!: ActorsParent.cpp:63661(unknown)
> 12:43:28.935 IndexedDB UnknownErr: ActorsParent.cpp:5841(unknown)

Although downgrading profiles isn't supported, Push could definitely be more resilient in the face of IDB errors. Bug 1258595 addresses the deadlock on startup, but still prevents callers from using Push: all calls to `subscribe`, `getSubscription`, and `unsubscribe` via the XPCOM and DOM APIs will reject with errors.

I'm wondering if we can use https://dxr.mozilla.org/mozilla-central/rev/4037eb98974db1b1e0b5012c8a7f3a36428eaa11/dom/quota/nsIQuotaManagerService.idl#48-50 to reset IDB if we encounter "unknown errors" like that. `nsIQuotaManagerService.clearStoragesForPrincipal(Services.scriptSecurityManager.getSystemPrincipal(), "persistent")` seems like it would do the trick, but there are some questions to consider:

1. Will this drop all IDB databases created by privileged code? (Probably not a concern on Desktop. I know B2G uses IDB in other JS-implemented Web APIs, but we don't have to worry about those here).

2. Will this actually solve the corruption, or is it happening at a lower level in SQLite?

3. Should we move away from using IDB to flat files instead? This would also fix storage invalidation via `nsIQuotaManagerService.clear()`, which is blocking bug 1185716. But I'd prefer not to rewrite PushDB.jsm if there's an easier answer.
(Reporter)

Updated

2 years ago
See Also: → bug 1185716

Updated

2 years ago
Blocks: 1260801
Whiteboard: btpp-fixlater
(Reporter)

Updated

2 years ago
No longer blocks: 1260801
(Reporter)

Updated

2 years ago
Duplicate of this bug: 1202907
Duplicate of this bug: 1311359
(Reporter)

Updated

8 months ago
See Also: → bug 1246615
Summary: Recover from IndexedDB corruption in Push → `PushDB` won't initialize if there are backward-incompatible changes to the IDB schema
You need to log in before you can comment on or make changes to this bug.