bug 458489. Avoid doing unnecessary work when iframes finish loading

when we only care about the main document. r=gavin
This commit is contained in:
Stuart Parmenter 2008-10-04 00:29:08 -07:00
parent 616cf7ce25
commit fde38e1d43
2 changed files with 12 additions and 10 deletions

View File

@ -390,15 +390,16 @@ ProgressController.prototype = {
},
onStateChange : function(aWebProgress, aRequest, aStateFlags, aStatus) {
// we currently only care if we're getting things for the main document, not sub-frames
if (aWebProgress.DOMWindow != this._browser.contentWindow) {
return;
}
if (aStateFlags & Ci.nsIWebProgressListener.STATE_IS_NETWORK) {
if (aRequest && aWebProgress.DOMWindow == this._browser.contentWindow) {
if (aStateFlags & Ci.nsIWebProgressListener.STATE_START) {
BrowserUI.update(TOOLBARSTATE_LOADING, this._browser);
}
else if (aStateFlags & Ci.nsIWebProgressListener.STATE_STOP) {
BrowserUI.update(TOOLBARSTATE_LOADED, this._browser);
}
}
if (aStateFlags & Ci.nsIWebProgressListener.STATE_START)
BrowserUI.update(TOOLBARSTATE_LOADING, this._browser);
else if (aStateFlags & Ci.nsIWebProgressListener.STATE_STOP)
BrowserUI.update(TOOLBARSTATE_LOADED, this._browser);
}
if (aStateFlags & Ci.nsIWebProgressListener.STATE_IS_DOCUMENT) {

View File

@ -136,7 +136,9 @@
<method name="updateCanvasState">
<body><![CDATA[
// Clear the whole canvas
// XXX is this really necessary given zoomToPage's redraw?
// we clear the whole canvas becaues the browser's width or height
// could be less than the area we end up actually drawing.
// XXX we could be smarter about this and only clear when necessary
var ctx = this._canvas.getContext("2d");
ctx.clearRect(0, 0, this._canvas.width, this._canvas.height);
@ -517,7 +519,6 @@
<method name="_browserToCanvas">
<body><![CDATA[
// FIXME: canvas needs to know it's actual width/height
// we should be able to use _canvas.width/_canvas.height here
// and can, most of the time