PDA

View Full Version : [FIXED-600] 'unloadListeners' is null or not an object



bt_bruno
18 Feb 2010, 8:00 AM
Ext version tested:

Ext 3.1.1


Adapter used:

ext


css used:

only default ext-all.css



Browser versions tested against:

IE8


Operating System:

WinXP Pro


Description:

Unload events attached to the body element causes issues with Ext default unload behavior.

It has been noticed in a post at premium area but with no feedback from the user: unloadListeners is null or not an object? (http://www.extjs.com/forum/showthread.php?t=89743)


Test Case:

Really simple to simulate. Create this html file, load on IE8 with debugging activated, and hit F5 to reload. I guess in firefox the error occurs too but it bypasses the error notification as it is on unload event.


<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Ext Unload Bug</title>

<link rel="stylesheet" type="text/css" href="../../resources/css/ext-all.css"/>
<script type="text/javascript" src="../../adapter/ext/ext-base-debug.js"></script>
<script type="text/javascript" src="../../ext-all-debug.js"></script>


<script type="text/javascript">

Ext.onReady(function()
{
Ext.EventManager.on( Ext.getBody() ,'unload' ,function()
{
//do something

},this)
});

</script>

</head>
<body>
</body>
</html>


Debugging already done:

In ext-base-all.js we can see this on _unload method:
unloadListeners = null;
Ext.EventManager._unload();

First the unloadListeners is clean, and then Ext.EventManager._unload(); is fired. Somewhere on Ext.EventManager._unload(); method chain it calls removeListener(), to remove the unload event attached by us at the body element. That's when unloadListeners is null and the error occours


Possible fix:

clear unloadListeners after call Ext.EventManager._unload();

Jamie Avins
18 Feb 2010, 10:57 AM
Fixed in ext-core 144 - 3.1.x and 3.2.x branches.