diff --git a/content/xul/document/src/nsXULDocument.cpp b/content/xul/document/src/nsXULDocument.cpp index 6eaa30047e3..b876688c974 100644 --- a/content/xul/document/src/nsXULDocument.cpp +++ b/content/xul/document/src/nsXULDocument.cpp @@ -2995,6 +2995,7 @@ nsXULDocument::ResumeWalk() if (! count) break; + nsCOMPtr overlayURI = mCurrentPrototype->GetURI(); nsCOMPtr uri = mUnloadedOverlays[count-1]; mUnloadedOverlays.RemoveObjectAt(count-1); @@ -3008,8 +3009,21 @@ nsXULDocument::ResumeWalk() continue; if (NS_FAILED(rv)) return rv; - if (shouldReturn) + if (shouldReturn) { + if (mOverlayLoadObservers.IsInitialized()) { + nsIObserver *obs = mOverlayLoadObservers.GetWeak(overlayURI); + if (obs) { + // This overlay has an unloaded overlay, so it will never + // notify. The best we can do is to notify for the unloaded + // overlay instead, assuming nobody is already notifiable + // for it. Note that this will confuse the observer. + if (!mOverlayLoadObservers.GetWeak(uri)) + mOverlayLoadObservers.Put(uri, obs); + mOverlayLoadObservers.Remove(overlayURI); + } + } return NS_OK; + } } // If we get here, there is nothing left for us to walk. The content