Bug 185236 part 2. Make sure to remove our SheetLoadData from mPostedEvents before calling SheetComplete on it, so that checking for pending loads from inside SheetComplete will work correctly. r=peterv

This commit is contained in:
Boris Zbarsky 2011-09-26 17:26:05 -04:00
Родитель af9fbb68d4
Коммит 3752e6e036
2 изменённых файлов: 7 добавлений и 2 удалений

Просмотреть файл

@ -2178,6 +2178,12 @@ Loader::HandleLoadEvent(SheetLoadData* aEvent)
// we're unblocking the parser // we're unblocking the parser
// NS_ASSERTION(aEvent->mObserver, "Must have observer"); // NS_ASSERTION(aEvent->mObserver, "Must have observer");
NS_ASSERTION(aEvent->mSheet, "Must have sheet"); NS_ASSERTION(aEvent->mSheet, "Must have sheet");
// Very important: this needs to come before the SheetComplete call
// below, so that HasPendingLoads() will test true as needed under
// notifications we send from that SheetComplete call.
mPostedEvents.RemoveElement(aEvent);
if (!aEvent->mIsCancelled) { if (!aEvent->mIsCancelled) {
// SheetComplete will call Release(), so give it a reference to do // SheetComplete will call Release(), so give it a reference to do
// that with. // that with.
@ -2185,8 +2191,6 @@ Loader::HandleLoadEvent(SheetLoadData* aEvent)
SheetComplete(aEvent, NS_OK); SheetComplete(aEvent, NS_OK);
} }
mPostedEvents.RemoveElement(aEvent);
if (mDocument) { if (mDocument) {
mDocument->UnblockOnload(PR_TRUE); mDocument->UnblockOnload(PR_TRUE);
} }

Просмотреть файл

@ -472,6 +472,7 @@ private:
LoadDataArray mPostedEvents; LoadDataArray mPostedEvents;
// Our array of "global" observers // Our array of "global" observers
// XXXbz these are strong refs; should we be cycle collecting CSS loaders?
nsTObserverArray<nsCOMPtr<nsICSSLoaderObserver> > mObservers; nsTObserverArray<nsCOMPtr<nsICSSLoaderObserver> > mObservers;
// the load data needs access to the document... // the load data needs access to the document...