Closed Bug 786576 Opened 12 years ago Closed 12 years ago

firefox 15 typeerror cant access dead object

Categories

(WebExtensions :: General, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED INVALID

People

(Reporter: noitidart, Unassigned)

References

Details

User Agent: Mozilla/5.0 (Windows NT 5.1; rv:15.0) Gecko/20100101 Firefox/15.0
Build ID: 20120824154833

Steps to reproduce:

I have this code in my addon which but FF 15 throws typerror cant access dead object. It works fine in all other versions and also i use this same technique in webpage development and it works error free.

This is the code:
		for (var i=0; i<this.stock.length; i++){
			for (var n in this.stock[i])	{
				bbstr += n+'='+this.stock[i][n]+'\n'; //this is the line that is highlighted by error console
			}
//..... theres more here
}


Actual results:

addon bugged out. error console threw error " typeerror cant access dead object"


Expected results:

it should have ran smoothly like in all other versions of firefox
noitidart@gmail.com, can you please attach your add-on so I can try and reproduce the issue/confirm it?
Component: Untriaged → Extension Compatibility
Ill get you a copy of my addon but the same error occurs in this addon here:
https://addons.mozilla.org/en-US/firefox/addon/floatnotes/?src=search

Thanks!
Oh for the float notes you have to create a note on a site and then go back to the site and it wont show, but error console will have that error message. It worked fine till FF15.
(In reply to noitidart from comment #2)
> Ill get you a copy of my addon but the same error occurs in this addon here:
> https://addons.mozilla.org/en-US/firefox/addon/floatnotes/?src=search
> 
> Thanks!

Thanks for the link! I managed to reproduce the issue with this add-on on:
Mozilla/5.0 (Windows NT 6.1; rv:18.0) Gecko/18.0 Firefox/18.0 (20120902030516)
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Windows XP → All
Hardware: x86 → All
This means you're holding on to DOM references after the document has been destroyed. It is mentioned in this blog post: https://blog.mozilla.org/addons/2012/08/27/compatibility-for-firefox-15/
Blocks: hueyfix
Ah yes I am definitely doing that:
A: As.snapshotItem(i)

So can just read through it and if destroyed ignore it? Would I have to use try catch?
Ideally you should detect when the document is unloaded and then destroy the object yourself. Alternatively you could import the DOM object to a different document that doesn't depend on tabs. But I guess a try / catch could do the trick.
There's a new function to check if a window is destroyed, but I don't recall what it is called.
Also, it would probably be useful if there was an MDN article or something that contained this error message, and described how to fix it, including the new dead-proxy detection thing. I know there's a blog post, but a wiki article would be nice because then we could add things like the dead window detection.
Components.utils.isDeadWrapper().
Thank you all! I fixed my addon! I had stored this in an object:
var obj = {
A: As.snapshotItem(i),
//.....
}

so now Im just skipping over that after the page unloads.

Thanks again for your hard work! Firefox is becoming super!
Can you please mark this bug as fixed once your fixed add-on gets approved in AMO?
Component: Extension Compatibility → Add-ons
Product: Firefox → Tech Evangelism
Version: 15 Branch → unspecified
Oh sure thing! I'll mark it fixed right now, this is actually a personal addon.
marking resolved
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → INVALID
Component: Add-ons → General
Product: Tech Evangelism → WebExtensions
You need to log in before you can comment on or make changes to this bug.