mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 03:45:46 +00:00
fix bug 37616, Retire SetRelativePath, removing unused SetRelativePath from nsIURI.idl and all it's implementations, r=warren@netscape.com, a=mscott@netscape.com for the mailnews part
This commit is contained in:
parent
318c844a28
commit
f8406c718e
@ -385,11 +385,6 @@ NS_IMETHODIMP nsAddbookUrl::Clone(nsIURI **_retval)
|
|||||||
return m_baseURL->Clone(_retval);
|
return m_baseURL->Clone(_retval);
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsAddbookUrl::SetRelativePath(const char *i_RelativePath)
|
|
||||||
{
|
|
||||||
return m_baseURL->SetRelativePath(i_RelativePath);
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP nsAddbookUrl::Resolve(const char *relativePath, char **result)
|
NS_IMETHODIMP nsAddbookUrl::Resolve(const char *relativePath, char **result)
|
||||||
{
|
{
|
||||||
return m_baseURL->Resolve(relativePath, result);
|
return m_baseURL->Resolve(relativePath, result);
|
||||||
|
@ -413,11 +413,6 @@ NS_IMETHODIMP nsMsgMailNewsUrl::Clone(nsIURI **_retval)
|
|||||||
return m_baseURL->Clone(_retval);
|
return m_baseURL->Clone(_retval);
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsMsgMailNewsUrl::SetRelativePath(const char *i_RelativePath)
|
|
||||||
{
|
|
||||||
return m_baseURL->SetRelativePath(i_RelativePath);
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP nsMsgMailNewsUrl::Resolve(const char *relativePath, char **result)
|
NS_IMETHODIMP nsMsgMailNewsUrl::Resolve(const char *relativePath, char **result)
|
||||||
{
|
{
|
||||||
// mailnews urls aren't like http or file urls...
|
// mailnews urls aren't like http or file urls...
|
||||||
|
@ -388,11 +388,6 @@ NS_IMETHODIMP nsMailtoUrl::Clone(nsIURI **_retval)
|
|||||||
return m_baseURL->Clone(_retval);
|
return m_baseURL->Clone(_retval);
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsMailtoUrl::SetRelativePath(const char *i_RelativePath)
|
|
||||||
{
|
|
||||||
return m_baseURL->SetRelativePath(i_RelativePath);
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP nsMailtoUrl::Resolve(const char *relativePath, char **result)
|
NS_IMETHODIMP nsMailtoUrl::Resolve(const char *relativePath, char **result)
|
||||||
{
|
{
|
||||||
return m_baseURL->Resolve(relativePath, result);
|
return m_baseURL->Resolve(relativePath, result);
|
||||||
|
@ -290,30 +290,6 @@ nsJARURI::Clone(nsIURI **result)
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsJARURI::SetRelativePath(const char *relativePath)
|
|
||||||
{
|
|
||||||
nsresult rv;
|
|
||||||
NS_WITH_SERVICE(nsIIOService, serv, kIOServiceCID, &rv);
|
|
||||||
if (NS_FAILED(rv)) return rv;
|
|
||||||
|
|
||||||
nsCAutoString path(mJAREntry);
|
|
||||||
PRInt32 pos = path.RFind("/");
|
|
||||||
if (pos >= 0)
|
|
||||||
path.Truncate(pos + 1);
|
|
||||||
else
|
|
||||||
path = "";
|
|
||||||
|
|
||||||
char* resolvedEntry;
|
|
||||||
rv = serv->ResolveRelativePath(relativePath, path.GetBuffer(),
|
|
||||||
&resolvedEntry);
|
|
||||||
if (NS_FAILED(rv)) return rv;
|
|
||||||
|
|
||||||
nsCRT::free(mJAREntry);
|
|
||||||
mJAREntry = resolvedEntry;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsJARURI::Resolve(const char *relativePath, char **result)
|
nsJARURI::Resolve(const char *relativePath, char **result)
|
||||||
{
|
{
|
||||||
|
@ -131,15 +131,6 @@ interface nsIURI : nsISupports
|
|||||||
*/
|
*/
|
||||||
nsIURI clone();
|
nsIURI clone();
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the given string to be a relative path for this URI, and
|
|
||||||
* changes this to read relative. Thus for example- if this =
|
|
||||||
* http://foo.com/bar/index.html, then calling SetRelativePath("/baz") will
|
|
||||||
* change this to http://foo.com/baz and calling it with "baz" will
|
|
||||||
* change this to http://foo.com/bar/baz.
|
|
||||||
*/
|
|
||||||
void setRelativePath(in string relativePath);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method resolves a relative string into an absolute URI string,
|
* This method resolves a relative string into an absolute URI string,
|
||||||
* using the URI as the base.
|
* using the URI as the base.
|
||||||
|
@ -259,13 +259,6 @@ nsSimpleURI::Clone(nsIURI* *result)
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsSimpleURI::SetRelativePath(const char *i_RelativePath)
|
|
||||||
{
|
|
||||||
NS_ASSERTION(PR_FALSE, "This is meaningless in hack context!");
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsSimpleURI::Resolve(const char *relativePath, char **result)
|
nsSimpleURI::Resolve(const char *relativePath, char **result)
|
||||||
{
|
{
|
||||||
|
@ -579,101 +579,6 @@ nsStdURL::SetRef(const char* i_Ref)
|
|||||||
(i_Ref+1) : i_Ref);
|
(i_Ref+1) : i_Ref);
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsStdURL::SetRelativePath(const char* i_Relative)
|
|
||||||
{
|
|
||||||
nsresult rv = NS_OK;
|
|
||||||
nsCAutoString options;
|
|
||||||
char* ref;
|
|
||||||
char* query;
|
|
||||||
char* file;
|
|
||||||
char* i_Path;
|
|
||||||
char* ePath = nsnull;
|
|
||||||
|
|
||||||
if (!i_Relative)
|
|
||||||
return NS_ERROR_NULL_POINTER;
|
|
||||||
|
|
||||||
NS_PRECONDITION( (nsnull != mURLParser), "Parse called without parser!");
|
|
||||||
if (!mURLParser) return NS_ERROR_NULL_POINTER;
|
|
||||||
|
|
||||||
// Make sure that if there is a : its before other delimiters
|
|
||||||
// If not then its an absolute case
|
|
||||||
static const char delimiters[] = "/;?#:";
|
|
||||||
char* brk = PL_strpbrk(i_Relative, delimiters);
|
|
||||||
if (brk && (*brk == ':')) // This is an absolute case
|
|
||||||
{
|
|
||||||
rv = SetSpec((char*) i_Relative);
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (*i_Relative == '/' && *(i_Relative+1) != '\0' &&
|
|
||||||
*(i_Relative+1) == '/') {
|
|
||||||
CRTFREEIF(mUsername);
|
|
||||||
CRTFREEIF(mPassword);
|
|
||||||
CRTFREEIF(mHost);
|
|
||||||
mPort = -1;
|
|
||||||
rv = mURLParser->ParseAtPreHost((char*)i_Relative, &mUsername,
|
|
||||||
&mPassword, &mHost, &mPort, &ePath);
|
|
||||||
if (NS_FAILED(rv))
|
|
||||||
return rv;
|
|
||||||
i_Path = ePath;
|
|
||||||
} else {
|
|
||||||
i_Path = (char*)i_Relative;
|
|
||||||
}
|
|
||||||
|
|
||||||
char* eFileName = nsnull;
|
|
||||||
|
|
||||||
switch (*i_Path)
|
|
||||||
{
|
|
||||||
case '/':
|
|
||||||
rv = SetPath((char*) i_Path);
|
|
||||||
CRTFREEIF(ePath);
|
|
||||||
return rv;
|
|
||||||
|
|
||||||
case ';':
|
|
||||||
// Append to Filename add then call SetFileName
|
|
||||||
rv = GetFileName(&eFileName);
|
|
||||||
options = eFileName;
|
|
||||||
CRTFREEIF(eFileName);
|
|
||||||
options += (char*)i_Path;
|
|
||||||
file = options.ToNewCString();
|
|
||||||
rv = SetFileName(file);
|
|
||||||
CRTFREEIF(ePath);
|
|
||||||
return rv;
|
|
||||||
|
|
||||||
case '?':
|
|
||||||
// check for ref part
|
|
||||||
ref = PL_strrchr(i_Path, '#');
|
|
||||||
if (!ref) {
|
|
||||||
CRTFREEIF(mRef);
|
|
||||||
rv = SetQuery((char*)i_Path);
|
|
||||||
CRTFREEIF(ePath);
|
|
||||||
return rv;
|
|
||||||
} else {
|
|
||||||
DupString(&query,nsnull);
|
|
||||||
ExtractString((char*)i_Path, &query,
|
|
||||||
(PL_strlen(i_Path)-(ref-i_Path)));
|
|
||||||
CRTFREEIF(ePath);
|
|
||||||
rv = SetQuery(query);
|
|
||||||
CRTFREEIF(query);
|
|
||||||
if (NS_FAILED(rv)) return rv;
|
|
||||||
rv = SetRef(ref);
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case '#':
|
|
||||||
rv = SetRef((char*)i_Path);
|
|
||||||
CRTFREEIF(ePath);
|
|
||||||
return rv;
|
|
||||||
|
|
||||||
default:
|
|
||||||
rv = SetFileName((char*)i_Path);
|
|
||||||
CRTFREEIF(ePath);
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsStdURL::Resolve(const char *relativePath, char **result)
|
nsStdURL::Resolve(const char *relativePath, char **result)
|
||||||
{
|
{
|
||||||
|
@ -290,30 +290,6 @@ nsJARURI::Clone(nsIURI **result)
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsJARURI::SetRelativePath(const char *relativePath)
|
|
||||||
{
|
|
||||||
nsresult rv;
|
|
||||||
NS_WITH_SERVICE(nsIIOService, serv, kIOServiceCID, &rv);
|
|
||||||
if (NS_FAILED(rv)) return rv;
|
|
||||||
|
|
||||||
nsCAutoString path(mJAREntry);
|
|
||||||
PRInt32 pos = path.RFind("/");
|
|
||||||
if (pos >= 0)
|
|
||||||
path.Truncate(pos + 1);
|
|
||||||
else
|
|
||||||
path = "";
|
|
||||||
|
|
||||||
char* resolvedEntry;
|
|
||||||
rv = serv->ResolveRelativePath(relativePath, path.GetBuffer(),
|
|
||||||
&resolvedEntry);
|
|
||||||
if (NS_FAILED(rv)) return rv;
|
|
||||||
|
|
||||||
nsCRT::free(mJAREntry);
|
|
||||||
mJAREntry = resolvedEntry;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsJARURI::Resolve(const char *relativePath, char **result)
|
nsJARURI::Resolve(const char *relativePath, char **result)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user