Source code

Revision control

Other Tools

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/. */
6
7
#include "nsIURIMutator.h"
8
#include "nsIURI.h"
9
#include "nsComponentManagerUtils.h"
10
11
static nsresult GetURIMutator(nsIURI* aURI, nsIURIMutator** aMutator) {
12
if (NS_WARN_IF(!aURI)) {
13
return NS_ERROR_INVALID_ARG;
14
}
15
return aURI->Mutate(aMutator);
16
}
17
18
NS_MutateURI::NS_MutateURI(nsIURI* aURI) {
19
mStatus = GetURIMutator(aURI, getter_AddRefs(mMutator));
20
NS_ENSURE_SUCCESS_VOID(mStatus);
21
}
22
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");
27
}