Merge mozilla-central to autoland. CLOSED TREE
[gecko.git] / netwerk / base / nsIURIMutatorUtils.cpp
blob6c7fd7c92bad933f37fe49d2be00b6e0e10d33a2
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #include "nsIURIMutator.h"
8 #include "nsIURI.h"
9 #include "nsComponentManagerUtils.h"
11 static nsresult GetURIMutator(nsIURI* aURI, nsIURIMutator** aMutator) {
12 if (NS_WARN_IF(!aURI)) {
13 return NS_ERROR_INVALID_ARG;
15 return aURI->Mutate(aMutator);
18 NS_MutateURI::NS_MutateURI(nsIURI* aURI) {
19 mStatus = GetURIMutator(aURI, getter_AddRefs(mMutator));
20 NS_ENSURE_SUCCESS_VOID(mStatus);
23 NS_MutateURI::NS_MutateURI(const char* aContractID)
24 : mStatus(NS_ERROR_NOT_INITIALIZED) {
25 mMutator = do_CreateInstance(aContractID, &mStatus);
26 MOZ_ASSERT(NS_SUCCEEDED(mStatus), "Called with wrong aContractID");