Open Bug 1258596 Opened 7 years ago Updated 6 months ago

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


(Core :: DOM: Push Notifications, defect, P3)





(Reporter: lina, Unassigned)



(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 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.
See Also: → 1185716
Whiteboard: btpp-fixlater
No longer blocks: 1260801
See Also: → 1246615
Summary: Recover from IndexedDB corruption in Push → `PushDB` won't initialize if there are backward-incompatible changes to the IDB schema
Priority: -- → P3
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.