Passpack + Chrome = Frustration
Everyday I log into Passpack and leave it open all day. So here’s the problem after having Passpack open for a while I get the following message (it is extremely annoying as it interupts whatever else your up to on the net). This only happens for me in Chrome. It works like butter in Firefox and I can’t speak for IE.
The initial trigger for the message seems to be random. But after it initial message is seems to come back around every 3 minutes. So I did some digging. After poking around in the source I discovered that they’re using an older version of Tako Sano’s jQuery history plugin.
So I added some code to the historyCallback do some logging so I could get a better feel for what was going on.
errorOccurred = lastErrorOccurred = new Date().getTime(); | |
_back = function(h) { | |
if (_backOk) { | |
if (_backCallback) { | |
_backCallback(); | |
_backCallback = null; | |
} | |
var hh = parseInt(h); | |
var m = $.browser.netscape ? 2 : $.browser.msie ? 3 : 7; | |
if (hh > m) { | |
errorOccurred = new Date().getTime(); | |
console.log("hh: "+ hh +", m: "+ m +", delta: "+ (errorOccurred - lastErrorOccurred)); | |
lastErrorOccurred = errorOccurred; | |
alert(PP.msg.man.bac); | |
} | |
} | |
}; |
After letting this run for a while I started to see a pattern. Here’s an excerpt of the results.
- hh: 8, m: 7, delta: 209901 (~3.4 minutes)
- hh: 8, m: 7, delta: 200888 (~3.3 minutes)
- hh: 8, m: 7, delta: 190944 (~3.2 minutes)
- hh: 8, m: 7, delta: 183514 (~3.0 minutes)
- hh: 8, m: 7, delta: 197517 (~3.3 minutes)
For webkit (Chrome/Safari) based browsers the jQuery history plugin manually creates a stack to keep track of the history. So this is where I believe we are encountering the problem. If you look at line 4426 you can see that we create a history with a stack length of 9.
_back = function(h) { | |
if (_backOk) { | |
if (_backCallback) { | |
_backCallback(); | |
_backCallback = null; | |
} | |
var hh = parseInt(h); | |
var m = $.browser.netscape ? 2 : $.browser.msie ? 3 : 7; | |
if (hh > m) alert(PP.msg.man.bac); | |
} | |
}; | |
runHistory = function() { | |
$.historyInit(_back); | |
z = $.browser.netscape ? 2 : $.browser.msie ? 4 : 8; | |
for (var j = z; j >= 0; j--) $.historyLoad(j); | |
_SetTimeout(function() { | |
_backOk = 1 | |
}, | |
3000); | |
}; |
But on line 4419 we are working with a stack with a length of 8.
var m = $.browser.netscape ? 2 : $.browser.msie ? 3 : 7;
Shouldn’t this read as follows?
var m = $.browser.netscape ? 2 : $.browser.msie ? 4 : 8;