mainmatter / ember-cookies

Cookies abstraction for Ember.js that works both in the browser as well as with Fastboot on the server

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TypeError: can't access dead object

swelham opened this issue · comments

On several occasions, we have caught the following error in one of our production apps.

TypeError: can't access dead object
  at _getDocumentCookies(addon-tree-output/ember-cookies/services/cookies.js:26:1)
  at read(addon-tree-output/ember-cookies/services/cookies.js:58:1)

Looking at the code, it appears the call to this._document.cookie is returning a dead object (I'm guessing the same as this on MDN?), causing the code to raise.

For reference, we have only seen this occur on Firefox, so this may be specific to that browser and not an issue on others.

As a potential fix, could this function check if the object is available and default to an empty array if it's not?

The MDN page you're linking to talks about Firefor add-ons specifically which seems to imply this isn't actually caused by ember-cookies but some kind of addon (which means you can likely just ignore this in tools like Sentry)?

Yeah, that's what I initially thought to do until I realised it appears to be coming from our app (from ember-simple-auth specifically).

Though I guess it's possible someone could have been trying to load our app in a way that caused this error, so might just be safe to ignore.