From 26bd04c61362763a9dbaff1f6192c80a227b34e5 Mon Sep 17 00:00:00 2001 From: "neil%parkwaycc.co.uk" Date: Tue, 26 Feb 2008 23:47:49 +0000 Subject: [PATCH] Fire dynamic overlay load observers in more cases b=419452 r+sr=jst a=beltzner --- content/xul/document/src/nsXULDocument.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) 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