From 5e803b125cc64a288c7851cd568324da29ba8957 Mon Sep 17 00:00:00 2001 From: Neil Rashbrook Date: Sun, 23 Aug 2009 23:48:07 +0100 Subject: [PATCH] Bug 408599 Expose nsSimpleNestedURI to XPCOM r=biesi sr=bz --- netwerk/base/public/nsINetUtil.idl | 9 ++++++++- netwerk/base/src/nsIOService.cpp | 15 ++++++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/netwerk/base/public/nsINetUtil.idl b/netwerk/base/public/nsINetUtil.idl index f9c271bfae52..8d2cd1b9285c 100644 --- a/netwerk/base/public/nsINetUtil.idl +++ b/netwerk/base/public/nsINetUtil.idl @@ -46,7 +46,7 @@ interface nsIPrefBranch; /** * nsINetUtil provides various network-related utility methods. */ -[scriptable, uuid(a50d5516-5c0a-4f08-b427-703ca0c44ac3)] +[scriptable, uuid(ca68c485-9db3-4c12-82a6-4fab7948e2d5)] interface nsINetUtil : nsISupports { /** @@ -95,6 +95,13 @@ interface nsINetUtil : nsISupports */ nsIURI toImmutableURI(in nsIURI aURI); + /** + * Create a simple nested URI using the result of + * toImmutableURI on the passed-in aURI which may not be null. + * Note: The return URI will not have had its spec set yet. + */ + nsIURI newSimpleNestedURI(in nsIURI aURI); + /** Escape every character with its %XX-escaped equivalent */ const unsigned long ESCAPE_ALL = 0; diff --git a/netwerk/base/src/nsIOService.cpp b/netwerk/base/src/nsIOService.cpp index 1fde70489396..6bbb12ea8a8d 100644 --- a/netwerk/base/src/nsIOService.cpp +++ b/netwerk/base/src/nsIOService.cpp @@ -67,7 +67,7 @@ #include "nsIRecyclingAllocator.h" #include "nsISocketTransport.h" #include "nsCRT.h" -#include "nsINestedURI.h" +#include "nsSimpleNestedURI.h" #include "nsNetUtil.h" #include "nsThreadUtils.h" #include "nsIPermissionManager.h" @@ -939,6 +939,19 @@ nsIOService::ToImmutableURI(nsIURI* uri, nsIURI** result) return NS_OK; } +NS_IMETHODIMP +nsIOService::NewSimpleNestedURI(nsIURI* aURI, nsIURI** aResult) +{ + NS_ENSURE_ARG(aURI); + + nsCOMPtr safeURI; + nsresult rv = NS_EnsureSafeToReturn(aURI, getter_AddRefs(safeURI)); + NS_ENSURE_SUCCESS(rv, rv); + + NS_IF_ADDREF(*aResult = new nsSimpleNestedURI(safeURI)); + return *aResult ? NS_OK : NS_ERROR_OUT_OF_MEMORY; +} + NS_IMETHODIMP nsIOService::SetManageOfflineStatus(PRBool aManage) { PRBool wasManaged = mManageOfflineStatus;