Bug 725372 - Limit Content:StateChange messages to top-level windows r=mbrubeck

This commit is contained in:
Mark Finkle 2012-02-08 14:23:32 -05:00
parent 7f3c43cea2
commit b025ca9653

View File

@ -1871,6 +1871,10 @@ Tab.prototype = {
},
onStateChange: function(aWebProgress, aRequest, aStateFlags, aStatus) {
let contentWin = aWebProgress.DOMWindow;
if (contentWin != contentWin.top)
return;
if (aStateFlags & Ci.nsIWebProgressListener.STATE_IS_NETWORK) {
// Filter optimization: Only really send NETWORK state changes to Java listener
let browser = BrowserApp.getBrowserForWindow(aWebProgress.DOMWindow);
@ -1878,13 +1882,18 @@ Tab.prototype = {
if (browser)
uri = browser.currentURI.spec;
// Check to see if we restoring the content from a previous presentation (session)
// since there should be no real network activity
let restoring = aStateFlags & Ci.nsIWebProgressListener.STATE_RESTORING;
let showProgress = restoring ? false : this.showProgress;
let message = {
gecko: {
type: "Content:StateChange",
tabID: this.id,
uri: uri,
state: aStateFlags,
showProgress: this.showProgress
showProgress: showProgress
}
};
sendMessageToJava(message);