author Randell Jesup <>
Sat, 01 Sep 2012 22:35:17 -0400
changeset 104468 3d9424eb6eb473cfd14309fd635ff7d6e29322c2
parent 103381 a16372ce30b5f6b747246b01fcd215a4bf3b6342
child 107183 ae68e6c539a21a7a2b65e33b1e9d7fd3401812a1
permissions -rw-r--r--
Bug 773151: Convert nsCAutoString->nsAutoCString CLOSED TREE r=bsmedberg

/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at */

#include "nsIURI.h"
#include "nsString.h"
#include "nsReadableUtils.h"
#include "nsIAboutModule.h"

inline nsresult
NS_GetAboutModuleName(nsIURI *aAboutURI, nsCString& aModule)
#ifdef DEBUG
        bool isAbout;
        NS_ASSERTION(NS_SUCCEEDED(aAboutURI->SchemeIs("about", &isAbout)) &&
                     "should be used only on about: URIs");

    nsresult rv = aAboutURI->GetPath(aModule);
    NS_ENSURE_SUCCESS(rv, rv);

    int32_t f = aModule.FindCharInSet(NS_LITERAL_CSTRING("#?"));
    if (f != kNotFound) {

    // convert to lowercase, as all about: modules are lowercase
    return NS_OK;

inline nsresult
NS_GetAboutModule(nsIURI *aAboutURI, nsIAboutModule** aModule)
  NS_PRECONDITION(aAboutURI, "Must have URI");

  nsAutoCString contractID;
  nsresult rv = NS_GetAboutModuleName(aAboutURI, contractID);
  if (NS_FAILED(rv)) return rv;

  // look up a handler to deal with "what"

  return CallGetService(contractID.get(), aModule);