--- a/suite/browser/tabbrowser.xml
+++ b/suite/browser/tabbrowser.xml
@@ -182,19 +182,16 @@
new Array()
</field>
<field name="mTabFilters">
new Array()
</field>
<field name="mLastRelatedIndex">
0
</field>
- <field name="mIsBusy">
- false
- </field>
<field name="mMissedIconCache">
null
</field>
<field name="mContextTab">
null
</field>
<field name="_keyEventHandler" readonly="true">
<![CDATA[({
@@ -407,26 +404,35 @@
<body>
<![CDATA[
return ({
mTabBrowser: this,
mTab: aTab,
mBrowser: aBrowser,
mBlank: aStartsBlank,
mFeeds: [],
+ mRequest: null,
+ mStateFlags: 0,
+ mStatus: 0,
+ mMessage: "",
+ mCurProgress: 0,
+ mMaxProgress: 0,
onProgressChange: function (aWebProgress, aRequest,
aCurSelfProgress, aMaxSelfProgress,
aCurTotalProgress, aMaxTotalProgress) {
if (aMaxTotalProgress > 0)
this.mTab.setAttribute("progress", Math.floor(aCurTotalProgress * 9.9 / aMaxTotalProgress));
if (this.mBlank)
return;
+ this.mCurProgress = aCurTotalProgress;
+ this.mMaxProgress = aMaxTotalProgress;
+
this.mTabBrowser._callProgressListeners(this.mBrowser, "onProgressChange",
[aWebProgress, aRequest,
aCurSelfProgress, aMaxSelfProgress,
aCurTotalProgress, aMaxTotalProgress]);
},
onStateChange: function (aWebProgress, aRequest, aStateFlags, aStatus) {
if (!aRequest)
@@ -450,19 +456,16 @@
if (aWebProgress.DOMWindow == this.mBrowser.contentWindow)
this.mBrowser.userTypedClear += 2;
if (!this.mBlank) {
this.mTab.removeAttribute("progress");
this.mTab.setAttribute("busy", "true");
this.mTab.label = this.mTabBrowser.mStringBundle.getString("tabs.loading");
this.mTab.removeAttribute("image");
-
- if (this.mTabBrowser.mCurrentTab == this.mTab)
- this.mTabBrowser.mIsBusy = true;
}
}
else if (aStateFlags & nsIWebProgressListener.STATE_STOP &&
aStateFlags & nsIWebProgressListener.STATE_IS_NETWORK) {
// The document is done loading, it's okay to clear
// the value again.
if (aWebProgress.DOMWindow == this.mBrowser.contentWindow)
if (this.mBrowser.userTypedClear > 1)
@@ -500,24 +503,26 @@
}
}
}
else if (this.mTabBrowser.shouldLoadFavIcon(location))
this.mTabBrowser.loadFavIcon(location, "image", this.mTab);
if (this.mTab.label == this.mTabBrowser.mStringBundle.getString("tabs.loading"))
this.mTabBrowser.setTabTitle(this.mTab);
-
- if (this.mTabBrowser.mCurrentTab == this.mTab)
- this.mTabBrowser.mIsBusy = false;
}
if (oldBlank)
return;
+ this.mRequest = aRequest;
+ this.mStateFlags = aStateFlags;
+ this.mStatus = aStatus;
+ this.mMessage = "";
+
this.mTabBrowser._callProgressListeners(this.mBrowser, "onStateChange",
[aWebProgress, aRequest, aStateFlags, aStatus]);
},
// The first location change is gotoIndex called from mInstallSH,
// the second one is considered a user action.
mLocationChangeCount : 0,
@@ -551,16 +556,18 @@
[aWebProgress, aRequest, aLocation],
false);
},
onStatusChange: function(aWebProgress, aRequest, aStatus, aMessage) {
if (this.mBlank)
return;
+ this.mMessage = aMessage;
+
this.mTabBrowser._callProgressListeners(this.mBrowser, "onStatusChange",
[aWebProgress, aRequest, aStatus, aMessage]);
},
onSecurityChange: function (aWebProgress, aRequest, aState) {
this.mTabBrowser._callProgressListeners(this.mBrowser, "onSecurityChange",
[aWebProgress, aRequest, aState]);
},
@@ -996,55 +1003,69 @@
this.mCurrentBrowser.setAttribute("type", "content-targetable");
this.mCurrentBrowser.docShell.isActive = false;
}
newBrowser.setAttribute("type", "content-primary");
newBrowser.docShell.isActive = true;
this.mCurrentBrowser = newBrowser;
this.mCurrentTab = this.selectedTab;
+ var tabListener = this.mTabListeners[this.tabContainer.selectedIndex];
// Update the URL bar.
this.updateUrlBar(newBrowser.webProgress,
null,
newBrowser.currentURI,
newBrowser.securityUI,
newBrowser,
- this.mTabListeners[this.tabContainer.selectedIndex].mFeeds);
+ tabListener.mFeeds);
// Update the window title.
this.updateTitlebar();
// FAYT
this.fastFind.setDocShell(this.mCurrentBrowser.docShell);
- // If the new tab is busy, and our current state is not busy, then
- // we need to fire a start to all progress listeners.
+ // Send the state, status and progress to all progress listeners.
const nsIWebProgressListener = Components.interfaces.nsIWebProgressListener;
- if (this.mCurrentTab.hasAttribute("busy") && !this.mIsBusy) {
- this.mIsBusy = true;
+ var flags = tabListener.mStateFlags &
+ (nsIWebProgressListener.STATE_START |
+ nsIWebProgressListener.STATE_STOP);
+ this._callProgressListeners(null, "onStateChange",
+ [this.mCurrentBrowser.webProgress,
+ tabListener.mRequest,
+ flags,
+ tabListener.mStatus],
+ true, false);
+
+ this._callProgressListeners(null, "onStatusChange",
+ [this.mCurrentBrowser.webProgress,
+ tabListener.mRequest,
+ tabListener.mStatus,
+ tabListener.mMessage],
+ true, false);
- this._callProgressListeners(null, "onStateChange",
- [this.mCurrentBrowser.webProgress, null,
- nsIWebProgressListener.STATE_START |
- nsIWebProgressListener.STATE_IS_NETWORK, 0],
- true, false);
- }
+ this._callProgressListeners(this.mBrowser, "onProgressChange",
+ [this.mCurrentBrowser.webProgress,
+ tabListener.mRequest,
+ tabListener.mCurProgress,
+ tabListener.mMaxProgress,
+ tabListener.mCurProgress,
+ tabListener.mMaxProgress],
+ true, false);
- // If the new tab is not busy, and our current state is busy, then
- // we need to fire a stop to all progress listeners.
- if (!this.mCurrentTab.hasAttribute("busy") && this.mIsBusy) {
- this.mIsBusy = false;
-
- this._callProgressListeners(null, "onStateChange",
- [this.mCurrentBrowser.webProgress, null,
- nsIWebProgressListener.STATE_STOP |
- nsIWebProgressListener.STATE_IS_NETWORK, 0],
- true, false);
- }
+ // Also send the onUpdateCurrentBrowser event for compatibility
+ var progress = tabListener.mMaxProgress > 0 ?
+ tabListener.mCurProgress / tabListener.mMaxProgress : 0;
+ this._callProgressListeners(this.mBrowser, "onUpdateCurrentBrowser",
+ [tabListener.mStateFlags,
+ tabListener.mStatus,
+ tabListener.mMessage,
+ progress],
+ true, false);
// We've selected the new tab, so go ahead and notify listeners
var event = document.createEvent("Events");
event.initEvent("TabSelect", true, false);
this.mCurrentTab.dispatchEvent(event);
if (document.commandDispatcher.focusedElement &&
document.commandDispatcher.focusedElement.parentNode ==