PDA

View Full Version : [INFOREQ] Ext.History bug



poopsmith
12 Mar 2010, 10:37 AM
The following code will replicate the bug:



Ext.History.addListener('change', function() {
console.log('Change Event Fired');
});

setTimeout(function() {
console.log('Location1 - Event should fire and does fire');
Ext.History.add('Location1');
}, 2000);

setTimeout(function() {
console.log('Location2 - Event should fire and does fire');
Ext.History.add('Location2');
}, 4000);
setTimeout(function() {
console.log('Location2 - Event shouldn\'t fire and doesn\'t fire');
Ext.History.add('Location2');
}, 6000);
setTimeout(function() {
console.log('Location2 - Event should fire but doesn\'t fire');
Ext.History.add('Location2', false);
}, 8000);
setTimeout(function() {
console.log('Location3 - Event should fire and does fire');
Ext.History.add('Location3');
}, 10000);
setTimeout(function() {
console.log('Location3 - Event should fire but doesn\'t fire');
Ext.History.add('Location3', false);
}, 12000);


We have examined the code in ext-all-debug.js on lines 47429 and 47548 and it appears that there is no real connection between the preventDup boolean and the 50ms setInterval() polling function.

You might want to look into that. We have decided not to patch your code ourselves as we do not know if a submitted patch would be accepted by you and we do not want to have to apply patches (and deal with potential conflicts) whenever we upgrade to the latest version of ExtJs.

Jamie Avins
12 Mar 2010, 12:07 PM
Welcome to the bug forum. I'm not able to follow what you are doing. Can you follow this guideline so we can get this addressed:

http://www.extjs.com/forum/showthread.php?t=71015

poopsmith
12 Mar 2010, 12:43 PM
Ext version tested:

Ext 3.2 rev 6256-157


Adapter used:

ext


css used:

only default ext-all.css




Browser versions tested against:

FF3.6 (firebug 1.5.2 installed)


Operating System:

Windows 7 Pro


Description:

Ext.History.add does not fire the history's change event when the token is the same, EVEN when preventDup is false.


Test Case:



Ext.History.addListener('change', function() {
console.log('Change Event Fired');
});

setTimeout(function() {
console.log('Location1 - Event should fire and does fire');
Ext.History.add('Location1');
}, 2000);

setTimeout(function() {
console.log('Location2 - Event should fire and does fire');
Ext.History.add('Location2');
}, 4000);
setTimeout(function() {
console.log('Location2 - Event shouldn\'t fire and doesn\'t fire');
Ext.History.add('Location2');
}, 6000);
setTimeout(function() {
console.log('Location2 - Event should fire but doesn\'t fire');
Ext.History.add('Location2', false);
}, 8000);
setTimeout(function() {
console.log('Location3 - Event should fire and does fire');
Ext.History.add('Location3');
}, 10000);
setTimeout(function() {
console.log('Location3 - Event should fire but doesn\'t fire');
Ext.History.add('Location3', false);
}, 12000);


Steps to reproduce the problem:

See test case above.


The result that was expected:

As described in the test case.


The result that occurs instead:

As described in the test case.


Screenshot or Video:

None


Debugging already done:

We have looked at the code but decided not to pursue debugging since we do not want to fork ExtJs.


Possible fix:

We have a temporary fix by creating an interceptor for the Ext.History.add global singleton function thusly:


Ext.History.add = Ext.History.add.createInterceptor(function(token) {
if(Ext.History.getToken() == token) {
Ext.History.fireEvent('change', token);
return false;
}
return true;
});