forked from mirrors/gecko-dev
Calling NS_ENSURE_SUCCESS at the begining of the methods shows the error in the console, but what we really care about is where the error code comes from. So it is best to use if (NS_FAILED(mStatus) {} at the begining of the methods, and NS_ENSURE_SUCCESS right after calling the appropriate method on mMutator.
MozReview-Commit-ID: 5vVuHk3N4FU
--HG--
extra : rebase_source : f477f0f87b3303422a595f27d9b39ac25335d701
24 lines
589 B
C++
24 lines
589 B
C++
#include "nsIURIMutator.h"
|
|
#include "nsIURI.h"
|
|
#include "nsComponentManagerUtils.h"
|
|
|
|
static nsresult
|
|
GetURIMutator(nsIURI* aURI, nsIURIMutator** aMutator)
|
|
{
|
|
if (NS_WARN_IF(!aURI)) {
|
|
return NS_ERROR_INVALID_ARG;
|
|
}
|
|
return aURI->Mutate(aMutator);
|
|
}
|
|
|
|
NS_MutateURI::NS_MutateURI(nsIURI* aURI)
|
|
{
|
|
mStatus = GetURIMutator(aURI, getter_AddRefs(mMutator));
|
|
NS_ENSURE_SUCCESS_VOID(mStatus);
|
|
}
|
|
|
|
NS_MutateURI::NS_MutateURI(const char * aContractID)
|
|
{
|
|
mMutator = do_CreateInstance(aContractID, &mStatus);
|
|
MOZ_ASSERT(NS_SUCCEEDED(mStatus), "Called with wrong aContractID");
|
|
}
|