Bug 635610 - Show the discovery pane's content earlier in the loading process. r=Unfocused, ui-r=limi

This commit is contained in:
Dave Townsend 2012-02-01 14:21:16 +13:00
Родитель dfab09deff
Коммит f0a2b56387
1 изменённых файлов: 17 добавлений и 2 удалений

Просмотреть файл

@ -1850,8 +1850,7 @@ var gDiscoverView = {
}
self._browser.homePage = self.homepageURL.spec;
self._browser.addProgressListener(self, Ci.nsIWebProgress.NOTIFY_ALL |
Ci.nsIWebProgress.NOTIFY_STATE_ALL);
self._browser.addProgressListener(self);
if (self.loaded)
self._loadURL(self.homepageURL.spec, false, notifyInitialized);
@ -1888,6 +1887,15 @@ var gDiscoverView = {
});
},
destroy: function() {
try {
this._browser.removeProgressListener(this);
}
catch (e) {
// Ignore the case when the listener wasn't already registered
}
},
show: function(aParam, aRequest, aState, aIsRefresh) {
gViewController.updateCommands();
@ -2006,6 +2014,13 @@ var gDiscoverView = {
},
onStateChange: function(aWebProgress, aRequest, aStateFlags, aStatus) {
let transferStart = Ci.nsIWebProgressListener.STATE_IS_DOCUMENT |
Ci.nsIWebProgressListener.STATE_IS_REQUEST |
Ci.nsIWebProgressListener.STATE_IS_TRANSFERRING;
// Once transferring begins show the content
if (aStateFlags & transferStart)
this.node.selectedPanel = this._browser;
// Only care about the network events
if (!(aStateFlags & (Ci.nsIWebProgressListener.STATE_IS_NETWORK)))
return;