зеркало из https://github.com/mozilla/gecko-dev.git
first round of checkins to fix bug 37616, Retire SetRelativePath, r=warren@netscape.com
This commit is contained in:
Родитель
31aea70ec6
Коммит
e365632082
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче