I am currently working on an add-on which is built on top of React and uses Redux for state management, it uses webext-redux for syncing the state between the content scripts and background page. The extension works pretty well in Google Chrome, however in Firefox I keep running into this error whenever a store.dispatch() statement is encountered.
Most of the threads regarding the message seem to be outdated and Mozilla also doesn't have proper documentation (some links are lead to dead pages). I understand that Mozilla tries to kill all references to the DOM, and hence any strong references end up in throwing that error. I have noticed that it usually throws this error once the pop-up closes and loses its context so as to speak. However, the background-page is persisted and should be running at all times
What I don't seem to understand is how to fix this? I am on Firefox 94 on Ubuntu. Below are a couple of stack traces. Thank you for your help!
Uncaught (in promise) TypeError: can't access dead object
Redux 7
_detectMutations
_detectMutations
_detectMutations
detectMutations
createImmutableStateInvariantMiddleware
measureTime
createImmutableStateInvariantMiddleware
Controller Controller.ts:230
_callee$ BackgroundProcessor.ts:149
Babel 10
promise callback*run index.js:16
earlyBound index.js:55
BackgroundProcessor BackgroundProcessor.ts:79
can't access dead object background.bundle.js line 11686 > eval:196
holdMessage ExtensionChild.jsm:239
sendPortMessage ExtensionChild.jsm:293
sendPortMessage self-hosted:1175
Redux 3
apply self-hosted:2715
applySafeWithoutClone ExtensionCommon.jsm:623
asyncWithoutClone ExtensionCommon.jsm:2409
Redux 7
_detectMutations
_detectMutations
_detectMutations
detectMutations
createImmutableStateInvariantMiddleware
measureTime
createImmutableStateInvariantMiddleware
Controller Controller.ts:340
BackgroundProcessor BackgroundProcessor.ts:299
The lines at in Controller are your typical store.dispatch(action) statements.