From 106ae7277aa4a185252ef5da38dcbfbbd11ba419 Mon Sep 17 00:00:00 2001 From: "neil%parkwaycc.co.uk" Date: Wed, 5 Mar 2008 21:32:27 +0000 Subject: [PATCH] Fire dynamic overlay load observers in more cases b=419452 r+sr=jst a=beltzner git-svn-id: svn://10.0.0.236/trunk@247130 18797224-902f-48f8-a5cc-f745e15eee43 --- .../content/xul/document/src/nsXULDocument.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/mozilla/content/xul/document/src/nsXULDocument.cpp b/mozilla/content/xul/document/src/nsXULDocument.cpp index f2a29c6e04c..5f4f76421ba 100644 --- a/mozilla/content/xul/document/src/nsXULDocument.cpp +++ b/mozilla/content/xul/document/src/nsXULDocument.cpp @@ -2762,6 +2762,7 @@ nsXULDocument::ResumeWalk() // ) can be properly re-loaded if the // cached copy of the document becomes stale. nsresult rv; + nsCOMPtr overlayURI = mCurrentPrototype->GetURI(); while (1) { // Begin (or resume) walking the current prototype. @@ -2950,8 +2951,6 @@ nsXULDocument::ResumeWalk() const PRUnichar* params[] = { piProto->mTarget.get() }; - nsCOMPtr overlayURI = mCurrentPrototype->GetURI(); - nsContentUtils::ReportToConsole( nsContentUtils::eXUL_PROPERTIES, "PINotInProlog", @@ -3006,8 +3005,21 @@ nsXULDocument::ResumeWalk() continue; if (NS_FAILED(rv)) return rv; + 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); + } + } if (shouldReturn) return NS_OK; + overlayURI.swap(uri); } // If we get here, there is nothing left for us to walk. The content