greiner wrote:2) The five second delay that was mentioned in previous posts is only a fallback. Under normal circumstances we initialize the UI after receiving the "sessionstore-windows-restored" event from the browser. If we don't get this event within five seconds we also start initializing the UI.
The problem is that timer is not affected by window process, it fires regardless if window on halt due to child modal window or not, so it continue executing the initialization and because main window is on halt at this time the initialization fails to properly recognize
windowtype attribute (because it still blank at that time), at which point ABP aborts initialization for this window.
lib/ui.js/UI.applyToWindow():
Code: Select all
if (!isKnownWindow(window))
return;
The fix is simple: remove the timer and relay solely on observer.
Done.
In my extensive tests I couldn't make
sessionstore-windows-restored event not get fired and ABP works just fine. Even though some people say it only fires on firefox startup, in my tests it fires on new windows too.
Fixed function:
Code: Select all
/**
* Observer waiting for the browsing session to be restored on startup.
*/
function SessionRestoreObserver(/**function*/ callback)
{
sessionRestoreObserver = this;
this.callback = callback;
Services.obs.addObserver(this, "sessionstore-windows-restored", true);
}
SessionRestoreObserver.prototype =
{
callback: null,
observe: function(subject, topic, data)
{
Services.obs.removeObserver(this, "sessionstore-windows-restored");
sessionRestoreObserver = null;
if (!onShutdown.done)
this.callback();
},
QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver, Ci.nsISupportsWeakReference])
}