From e608cdac053a95fa18e80a396bbfd899b2ddca46 Mon Sep 17 00:00:00 2001 From: Mats Palmgren Date: Sun, 14 Oct 2018 18:12:23 +0200 Subject: [PATCH] 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). --- dom/xml/nsXMLContentSink.cpp | 4 ++-- layout/style/Loader.cpp | 8 ++------ layout/style/Loader.h | 2 +- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/dom/xml/nsXMLContentSink.cpp b/dom/xml/nsXMLContentSink.cpp index 01fd371ccf37..c198cc69a134 100644 --- a/dom/xml/nsXMLContentSink.cpp +++ b/dom/xml/nsXMLContentSink.cpp @@ -319,8 +319,8 @@ nsXMLContentSink::DidBuildModel(bool aTerminated) // We're pretty-printing now. See whether we should wait up on // stylesheet loads - if (mDocument->CSSLoader()->HasPendingLoads() && - NS_SUCCEEDED(mDocument->CSSLoader()->AddObserver(this))) { + if (mDocument->CSSLoader()->HasPendingLoads()) { + mDocument->CSSLoader()->AddObserver(this); // wait for those sheets to load startLayout = false; } diff --git a/layout/style/Loader.cpp b/layout/style/Loader.cpp index 98663b351479..a3457aaf3582 100644 --- a/layout/style/Loader.cpp +++ b/layout/style/Loader.cpp @@ -2570,15 +2570,11 @@ Loader::HasPendingLoads() mDatasToNotifyOn != 0; } -nsresult +void Loader::AddObserver(nsICSSLoaderObserver* aObserver) { MOZ_ASSERT(aObserver, "Must have observer"); - if (mObservers.AppendElementUnlessExists(aObserver)) { - return NS_OK; - } - - return NS_ERROR_OUT_OF_MEMORY; + mObservers.AppendElementUnlessExists(aObserver); } void diff --git a/layout/style/Loader.h b/layout/style/Loader.h index bd244602842c..d0f74b4ec012 100644 --- a/layout/style/Loader.h +++ b/layout/style/Loader.h @@ -429,7 +429,7 @@ public: * * aObserver must not be null. */ - nsresult AddObserver(nsICSSLoaderObserver* aObserver); + void AddObserver(nsICSSLoaderObserver* aObserver); /** * Remove an observer added via AddObserver.