cozy / cozy-client

Document store and React components for the Cozy platform
MIT License
13 stars 13 forks source link

dead object error when trying to do a query in a Firefox extension popup #1550

Open zatteo opened 2 weeks ago

zatteo commented 2 weeks ago

Firefox is very strict about memory management in an browser extension popup.

In the cozy-keys-browser extension, we had a simple favorite method that fetch a contact and save it after adding favorite: true in the popup.

But if we :

We will get an error like this cozy-client warn Could not get query from state. queryId: io.cozy.contacts/667277395369678d85fe4a93f8984909, error: can't access dead object because Firefox cleaned at least a part of the store.

Issue was bypassed in https://github.com/cozy/cozy-keys-browser/pull/319 by doing the query in the background instead of the popup but I write it also here for the record.

paultranvan commented 2 weeks ago

See https://blog.mozilla.org/addons/2012/09/12/what-does-cant-access-dead-object-mean/