first round of checkins to fix bug 37616, Retire SetRelativePath, r=warren@netscape.com

This commit is contained in:
andreas.otte%primus-online.de 2000-05-05 23:39:25 +00:00
Родитель 31aea70ec6
Коммит e365632082
10 изменённых файлов: 112 добавлений и 99 удалений

Просмотреть файл

@ -622,16 +622,18 @@ nsChromeProtocolHandler::NewURI(const char *aSpec, nsIURI *aBaseURI,
// URLs, so there is no "outer" given to CreateInstance
nsIURI* url;
if (aBaseURI) {
rv = aBaseURI->Clone(&url);
if (NS_FAILED(rv)) return rv;
rv = url->SetRelativePath(aSpec);
}
else {
rv = nsComponentManager::CreateInstance(kStandardURLCID, nsnull,
NS_GET_IID(nsIURI),
(void**)&url);
if (NS_FAILED(rv)) return rv;
if (aBaseURI) {
nsXPIDLCString aResolvedURI;
rv = aBaseURI->Resolve(aSpec, getter_Copies(aResolvedURI));
if (NS_FAILED(rv)) return rv;
rv = url->SetSpec(aResolvedURI);
}
else {
rv = url->SetSpec((char*)aSpec);
}

Просмотреть файл

@ -28,6 +28,7 @@
#include "nsJARURI.h"
#include "nsIURL.h"
#include "nsJARChannel.h"
#include "nsXPIDLString.h"
static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
static NS_DEFINE_CID(kJARUriCID, NS_JARURI_CID);
@ -94,16 +95,19 @@ NS_IMETHODIMP
nsJARProtocolHandler::NewURI(const char *aSpec, nsIURI *aBaseURI,
nsIURI **result)
{
nsresult rv;
nsresult rv = NS_OK;
nsIURI* url;
if (aBaseURI) {
rv = aBaseURI->Clone(&url);
if (NS_FAILED(rv)) return rv;
rv = url->SetRelativePath(aSpec);
}
else {
rv = nsJARURI::Create(nsnull, NS_GET_IID(nsIJARURI), (void**)&url);
if (NS_FAILED(rv)) return rv;
if (aBaseURI)
{
nsXPIDLCString aResolvedURI;
rv = aBaseURI->Resolve(aSpec, getter_Copies(aResolvedURI));
if (NS_FAILED(rv)) return rv;
rv = url->SetSpec(aResolvedURI);
} else {
rv = url->SetSpec((char*)aSpec);
}

Просмотреть файл

@ -95,22 +95,15 @@ nsAboutProtocolHandler::NewURI(const char *aSpec, nsIURI *aBaseURI,
{
nsresult rv;
// about: URIs are implemented by the "Simple URI" implementation
// no concept of a relative about url
NS_ASSERTION(!aBaseURI, "base url passed into about protocol handler");
nsIURI* url;
if (aBaseURI) {
rv = aBaseURI->Clone(&url);
if (NS_FAILED(rv)) return rv;
rv = url->SetRelativePath(aSpec);
}
else {
rv = nsComponentManager::CreateInstance(kSimpleURICID, nsnull,
NS_GET_IID(nsIURI),
(void**)&url);
if (NS_FAILED(rv)) return rv;
rv = url->SetSpec((char*)aSpec);
}
if (NS_FAILED(rv)) {
NS_RELEASE(url);
return rv;

Просмотреть файл

@ -34,6 +34,7 @@
#include "nsISupportsArray.h"
#include "nsFileSpec.h"
#include "nsAutoLock.h"
#include "nsXPIDLString.h"
static NS_DEFINE_CID(kStandardURLCID, NS_STANDARDURL_CID);
static NS_DEFINE_CID(kNoAuthUrlParserCID, NS_NOAUTHORITYURLPARSER_CID);
@ -105,12 +106,7 @@ nsFileProtocolHandler::NewURI(const char *aSpec, nsIURI *aBaseURI,
nsCOMPtr<nsIURI> url;
nsCOMPtr<nsIURLParser> urlparser;
if (aBaseURI) {
rv = aBaseURI->Clone(getter_AddRefs(url));
if (NS_FAILED(rv)) return rv;
rv = url->SetRelativePath(aSpec);
}
else {
rv = nsComponentManager::CreateInstance(kNoAuthUrlParserCID,
nsnull, NS_GET_IID(nsIURLParser),
getter_AddRefs(urlparser));
@ -119,12 +115,18 @@ nsFileProtocolHandler::NewURI(const char *aSpec, nsIURI *aBaseURI,
nsnull, NS_GET_IID(nsIURI),
getter_AddRefs(url));
if (NS_FAILED(rv)) return rv;
rv = url->SetURLParser(urlparser);
if (NS_FAILED(rv)) return rv;
if (aBaseURI)
{
nsXPIDLCString aResolvedURI;
rv = aBaseURI->Resolve(aSpec, getter_Copies(aResolvedURI));
if (NS_FAILED(rv)) return rv;
rv = url->SetSpec(aResolvedURI);
} else {
rv = url->SetSpec((char*)aSpec);
}
if (NS_FAILED(rv)) return rv;
*result = url.get();

Просмотреть файл

@ -144,12 +144,6 @@ nsFtpProtocolHandler::NewURI(const char *aSpec, nsIURI *aBaseURI,
nsresult rv = NS_OK;
nsCOMPtr<nsIURI> url;
nsCOMPtr<nsIURLParser> urlparser;
if (aBaseURI) {
rv = aBaseURI->Clone(getter_AddRefs(url));
if (NS_FAILED(rv)) return rv;
rv = url->SetRelativePath(aSpec);
}
else {
rv = nsComponentManager::CreateInstance(kAuthUrlParserCID,
nsnull, NS_GET_IID(nsIURLParser),
getter_AddRefs(urlparser));
@ -158,10 +152,16 @@ nsFtpProtocolHandler::NewURI(const char *aSpec, nsIURI *aBaseURI,
nsnull, NS_GET_IID(nsIURI),
getter_AddRefs(url));
if (NS_FAILED(rv)) return rv;
rv = url->SetURLParser(urlparser);
if (NS_FAILED(rv)) return rv;
if (aBaseURI)
{
nsXPIDLCString aResolvedURI;
rv = aBaseURI->Resolve(aSpec, getter_Copies(aResolvedURI));
if (NS_FAILED(rv)) return rv;
rv = url->SetSpec(aResolvedURI);
} else {
rv = url->SetSpec((char*)aSpec);
}
if (NS_FAILED(rv)) return rv;

Просмотреть файл

@ -181,17 +181,8 @@ nsHTTPHandler::NewURI(const char *aSpec, nsIURI *aBaseURI,
nsIURI **result)
{
nsresult rv = NS_OK;
nsCOMPtr<nsIURI> url;
nsCOMPtr<nsIURLParser> urlparser;
if (aBaseURI)
{
rv = aBaseURI->Clone(getter_AddRefs(url));
if (NS_FAILED(rv)) return rv;
rv = url->SetRelativePath(aSpec);
}
else
{
rv = nsComponentManager::CreateInstance(kAuthUrlParserCID,
nsnull, NS_GET_IID(nsIURLParser),
getter_AddRefs(urlparser));
@ -200,12 +191,20 @@ nsHTTPHandler::NewURI(const char *aSpec, nsIURI *aBaseURI,
nsnull, NS_GET_IID(nsIURI),
getter_AddRefs(url));
if (NS_FAILED(rv)) return rv;
rv = url->SetURLParser(urlparser);
if (NS_FAILED(rv)) return rv;
if (aBaseURI)
{
nsXPIDLCString aResolvedURI;
rv = aBaseURI->Resolve(aSpec, getter_Copies(aResolvedURI));
if (NS_FAILED(rv)) return rv;
rv = url->SetSpec(aResolvedURI);
} else {
rv = url->SetSpec((char*)aSpec);
}
if (NS_FAILED(rv)) return rv;
*result = url.get();
NS_ADDREF(*result);
return rv;

Просмотреть файл

@ -28,6 +28,7 @@
#include "nsJARURI.h"
#include "nsIURL.h"
#include "nsJARChannel.h"
#include "nsXPIDLString.h"
static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
static NS_DEFINE_CID(kJARUriCID, NS_JARURI_CID);
@ -94,16 +95,19 @@ NS_IMETHODIMP
nsJARProtocolHandler::NewURI(const char *aSpec, nsIURI *aBaseURI,
nsIURI **result)
{
nsresult rv;
nsresult rv = NS_OK;
nsIURI* url;
if (aBaseURI) {
rv = aBaseURI->Clone(&url);
if (NS_FAILED(rv)) return rv;
rv = url->SetRelativePath(aSpec);
}
else {
rv = nsJARURI::Create(nsnull, NS_GET_IID(nsIJARURI), (void**)&url);
if (NS_FAILED(rv)) return rv;
if (aBaseURI)
{
nsXPIDLCString aResolvedURI;
rv = aBaseURI->Resolve(aSpec, getter_Copies(aResolvedURI));
if (NS_FAILED(rv)) return rv;
rv = url->SetSpec(aResolvedURI);
} else {
rv = url->SetSpec((char*)aSpec);
}

Просмотреть файл

@ -151,16 +151,21 @@ nsResChannel::Substitutions::Next(nsIURI* *result)
PRBool ok = mSubstitutions->RemoveCStringAt(0);
if (!ok) return NS_ERROR_FAILURE;
char* path;
char* path = nsnull;
rv = channel->mResourceURI->GetPath(&path);
if (NS_FAILED(rv)) return rv;
// XXX this path[0] check is a hack -- it seems to me that GetPath
// shouldn't include the leading slash:
rv = resolvedURI->SetRelativePath(path[0] == '/' ? path+1 : path);
nsXPIDLCString aResolvedURI;
rv = resolvedURI->Resolve(path[0] == '/' ? path+1 : path,
getter_Copies(aResolvedURI));
nsCRT::free(path);
if (NS_FAILED(rv)) return rv;
rv = resolvedURI->SetSpec(aResolvedURI);
if (NS_FAILED(rv)) return rv;
*result = resolvedURI;
NS_IF_ADDREF(*result);
return NS_OK;

Просмотреть файл

@ -42,6 +42,7 @@
#include "prenv.h"
#include "prmem.h"
#include "prprf.h"
#include "nsXPIDLString.h"
static NS_DEFINE_CID(kStandardURLCID, NS_STANDARDURL_CID);
@ -232,16 +233,17 @@ nsResProtocolHandler::NewURI(const char *aSpec, nsIURI *aBaseURI,
// URLs, so there is no "outer" given to CreateInstance
nsIURI* url;
if (aBaseURI) {
rv = aBaseURI->Clone(&url);
if (NS_FAILED(rv)) return rv;
rv = url->SetRelativePath(aSpec);
}
else {
rv = nsComponentManager::CreateInstance(kStandardURLCID, nsnull,
NS_GET_IID(nsIURI),
(void**)&url);
if (NS_FAILED(rv)) return rv;
if (aBaseURI) {
nsXPIDLCString aResolvedURI;
rv = aBaseURI->Resolve(aSpec, getter_Copies(aResolvedURI));
if (NS_FAILED(rv)) return rv;
rv = url->SetSpec(aResolvedURI);
} else {
rv = url->SetSpec((char*)aSpec);
}

Просмотреть файл

@ -622,16 +622,18 @@ nsChromeProtocolHandler::NewURI(const char *aSpec, nsIURI *aBaseURI,
// URLs, so there is no "outer" given to CreateInstance
nsIURI* url;
if (aBaseURI) {
rv = aBaseURI->Clone(&url);
if (NS_FAILED(rv)) return rv;
rv = url->SetRelativePath(aSpec);
}
else {
rv = nsComponentManager::CreateInstance(kStandardURLCID, nsnull,
NS_GET_IID(nsIURI),
(void**)&url);
if (NS_FAILED(rv)) return rv;
if (aBaseURI) {
nsXPIDLCString aResolvedURI;
rv = aBaseURI->Resolve(aSpec, getter_Copies(aResolvedURI));
if (NS_FAILED(rv)) return rv;
rv = url->SetSpec(aResolvedURI);
}
else {
rv = url->SetSpec((char*)aSpec);
}