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

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

Ext 3.1.1

Adapter used:


css used:

only default ext-all.css

Browser versions tested against:


Operating System:

WinXP Pro


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.

<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.EventManager.on( Ext.getBody() ,'unload' ,function()
//do something




Debugging already done:

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

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.