Bug 1494745 part 4 - Make Loader::AddObserver void since it's infallible. r=bz

mObservers is a nsTObserverArray which is infallible, so no need to
check the return value from AppendElementUnlessExists
(which a later patch in this series will remove).
This commit is contained in:
Mats Palmgren 2018-10-14 18:12:23 +02:00
Родитель f29a7e848d
Коммит e608cdac05
3 изменённых файлов: 5 добавлений и 9 удалений

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

@ -319,8 +319,8 @@ nsXMLContentSink::DidBuildModel(bool aTerminated)
// We're pretty-printing now. See whether we should wait up on // We're pretty-printing now. See whether we should wait up on
// stylesheet loads // stylesheet loads
if (mDocument->CSSLoader()->HasPendingLoads() && if (mDocument->CSSLoader()->HasPendingLoads()) {
NS_SUCCEEDED(mDocument->CSSLoader()->AddObserver(this))) { mDocument->CSSLoader()->AddObserver(this);
// wait for those sheets to load // wait for those sheets to load
startLayout = false; startLayout = false;
} }

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

@ -2570,15 +2570,11 @@ Loader::HasPendingLoads()
mDatasToNotifyOn != 0; mDatasToNotifyOn != 0;
} }
nsresult void
Loader::AddObserver(nsICSSLoaderObserver* aObserver) Loader::AddObserver(nsICSSLoaderObserver* aObserver)
{ {
MOZ_ASSERT(aObserver, "Must have observer"); MOZ_ASSERT(aObserver, "Must have observer");
if (mObservers.AppendElementUnlessExists(aObserver)) { mObservers.AppendElementUnlessExists(aObserver);
return NS_OK;
}
return NS_ERROR_OUT_OF_MEMORY;
} }
void void

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

@ -429,7 +429,7 @@ public:
* *
* aObserver must not be null. * aObserver must not be null.
*/ */
nsresult AddObserver(nsICSSLoaderObserver* aObserver); void AddObserver(nsICSSLoaderObserver* aObserver);
/** /**
* Remove an observer added via AddObserver. * Remove an observer added via AddObserver.