Bug 1289933 - Port |Bug 1280584 - About protocol handler totally ignores baseURI and doesn't work for relative (#foo) URIs| to comm-central. r=rkent a=jorgk CLOSED TREE
This commit is contained in:
Родитель
bcfd68395e
Коммит
b1ed331c60
|
@ -390,7 +390,9 @@ NS_IMETHODIMP nsLDAPURL::SchemeIs(const char *aScheme, bool *aEquals)
|
|||
|
||||
// nsIURI clone ();
|
||||
//
|
||||
NS_IMETHODIMP nsLDAPURL::Clone(nsIURI **aResult)
|
||||
nsresult
|
||||
nsLDAPURL::CloneInternal(RefHandlingEnum aRefHandlingMode,
|
||||
const nsACString& newRef, nsIURI** aResult)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aResult);
|
||||
|
||||
|
@ -405,13 +407,38 @@ NS_IMETHODIMP nsLDAPURL::Clone(nsIURI **aResult)
|
|||
clone->mOptions = mOptions;
|
||||
clone->mAttributes = mAttributes;
|
||||
|
||||
nsresult rv = mBaseURL->Clone(getter_AddRefs(clone->mBaseURL));
|
||||
nsresult rv;
|
||||
if (aRefHandlingMode == eHonorRef) {
|
||||
rv = mBaseURL->Clone(getter_AddRefs(clone->mBaseURL));
|
||||
} else if (aRefHandlingMode == eReplaceRef) {
|
||||
rv = mBaseURL->CloneWithNewRef(newRef, getter_AddRefs(clone->mBaseURL));
|
||||
} else {
|
||||
rv = mBaseURL->CloneIgnoringRef(getter_AddRefs(clone->mBaseURL));
|
||||
}
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
NS_ADDREF(*aResult = clone);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLDAPURL::Clone(nsIURI** result)
|
||||
{
|
||||
return CloneInternal(eHonorRef, EmptyCString(), result);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLDAPURL::CloneIgnoringRef(nsIURI** result)
|
||||
{
|
||||
return CloneInternal(eIgnoreRef, EmptyCString(), result);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLDAPURL::CloneWithNewRef(const nsACString& newRef, nsIURI** result)
|
||||
{
|
||||
return CloneInternal(eReplaceRef, newRef, result);
|
||||
}
|
||||
|
||||
// string resolve (in string relativePath);
|
||||
//
|
||||
NS_IMETHODIMP nsLDAPURL::Resolve(const nsACString &relativePath,
|
||||
|
@ -676,12 +703,6 @@ NS_IMETHODIMP nsLDAPURL::EqualsExceptRef(nsIURI *other, bool *result)
|
|||
return mBaseURL->EqualsExceptRef(other, result);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLDAPURL::CloneIgnoringRef(nsIURI** result)
|
||||
{
|
||||
return mBaseURL->CloneIgnoringRef(result);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLDAPURL::GetSpecIgnoringRef(nsACString &result)
|
||||
{
|
||||
|
|
|
@ -39,11 +39,18 @@ public:
|
|||
nsLDAPURL();
|
||||
|
||||
protected:
|
||||
enum RefHandlingEnum {
|
||||
eIgnoreRef,
|
||||
eHonorRef,
|
||||
eReplaceRef
|
||||
};
|
||||
virtual ~nsLDAPURL();
|
||||
|
||||
void GetPathInternal(nsCString &aPath);
|
||||
nsresult SetPathInternal(const nsCString &aPath);
|
||||
nsresult SetAttributeArray(char** aAttributes);
|
||||
nsresult CloneInternal(RefHandlingEnum aRefHandlingMode,
|
||||
const nsACString& newRef, nsIURI** aResult);
|
||||
|
||||
nsCString mDN; // Base Distinguished Name (Base DN)
|
||||
int32_t mScope; // Search scope (base, one or sub)
|
||||
|
|
|
@ -183,7 +183,9 @@ NS_IMETHODIMP nsAddbookUrl::Equals(nsIURI *other, bool *_retval)
|
|||
return m_baseURL->Equals(other, _retval);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAddbookUrl::Clone(nsIURI **_retval)
|
||||
nsresult
|
||||
nsAddbookUrl::CloneInternal(RefHandlingEnum aRefHandlingMode,
|
||||
const nsACString& newRef, nsIURI** _retval)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(_retval);
|
||||
|
||||
|
@ -192,12 +194,36 @@ NS_IMETHODIMP nsAddbookUrl::Clone(nsIURI **_retval)
|
|||
if (!clone)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
nsresult rv = m_baseURL->Clone(getter_AddRefs(clone->m_baseURL));
|
||||
nsresult rv;
|
||||
if (aRefHandlingMode == eHonorRef) {
|
||||
rv = m_baseURL->Clone(getter_AddRefs(clone->m_baseURL));
|
||||
} else if (aRefHandlingMode == eReplaceRef) {
|
||||
rv = m_baseURL->CloneWithNewRef(newRef, getter_AddRefs(clone->m_baseURL));
|
||||
} else {
|
||||
rv = m_baseURL->CloneIgnoringRef(getter_AddRefs(clone->m_baseURL));
|
||||
}
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
clone->ParseUrl();
|
||||
clone.forget(_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAddbookUrl::Clone(nsIURI **_retval)
|
||||
{
|
||||
return CloneInternal(eHonorRef, EmptyCString(), _retval);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAddbookUrl::CloneIgnoringRef(nsIURI** _retval)
|
||||
{
|
||||
return CloneInternal(eIgnoreRef, EmptyCString(), _retval);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAddbookUrl::CloneWithNewRef(const nsACString& newRef, nsIURI** _retval)
|
||||
{
|
||||
return CloneInternal(eReplaceRef, newRef, _retval);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAddbookUrl::Resolve(const nsACString &relativePath, nsACString &result)
|
||||
{
|
||||
|
@ -228,23 +254,6 @@ NS_IMETHODIMP nsAddbookUrl::EqualsExceptRef(nsIURI *other, bool *_retval)
|
|||
return m_baseURL->EqualsExceptRef(other, _retval);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAddbookUrl::CloneIgnoringRef(nsIURI** _retval)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(_retval);
|
||||
|
||||
RefPtr<nsAddbookUrl> clone = new nsAddbookUrl();
|
||||
|
||||
if (!clone)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
nsresult rv = m_baseURL->CloneIgnoringRef(getter_AddRefs(clone->m_baseURL));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
clone->ParseUrl();
|
||||
clone.forget(_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAddbookUrl::GetSpecIgnoringRef(nsACString &result)
|
||||
{
|
||||
|
|
|
@ -20,8 +20,17 @@ public:
|
|||
nsAddbookUrl();
|
||||
|
||||
protected:
|
||||
enum RefHandlingEnum {
|
||||
eIgnoreRef,
|
||||
eHonorRef,
|
||||
eReplaceRef
|
||||
};
|
||||
virtual ~nsAddbookUrl();
|
||||
nsresult ParseUrl();
|
||||
nsresult
|
||||
CloneInternal(RefHandlingEnum aRefHandlingMode,
|
||||
const nsACString& newRef, nsIURI** _retval);
|
||||
|
||||
nsresult ParseUrl();
|
||||
int32_t mOperationType; // the internal ID for the operation
|
||||
|
||||
nsCOMPtr<nsIURI> m_baseURL; // the base URL for the object
|
||||
|
|
|
@ -500,20 +500,6 @@ NS_IMETHODIMP nsMsgMailNewsUrl::EqualsExceptRef(nsIURI *other, bool *result)
|
|||
return m_baseURL->EqualsExceptRef(other, result);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgMailNewsUrl::CloneIgnoringRef(nsIURI** result)
|
||||
{
|
||||
nsCOMPtr<nsIURI> clone;
|
||||
nsresult rv = Clone(getter_AddRefs(clone));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = clone->SetRef(EmptyCString());
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
clone.forget(result);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgMailNewsUrl::GetSpecIgnoringRef(nsACString &result)
|
||||
{
|
||||
|
@ -531,7 +517,9 @@ NS_IMETHODIMP nsMsgMailNewsUrl::SchemeIs(const char *aScheme, bool *_retval)
|
|||
return m_baseURL->SchemeIs(aScheme, _retval);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgMailNewsUrl::Clone(nsIURI **_retval)
|
||||
nsresult
|
||||
nsMsgMailNewsUrl::CloneInternal(RefHandlingEnum aRefHandlingMode,
|
||||
const nsACString& newRef, nsIURI** _retval)
|
||||
{
|
||||
nsresult rv;
|
||||
nsAutoCString urlSpec;
|
||||
|
@ -552,8 +540,33 @@ NS_IMETHODIMP nsMsgMailNewsUrl::Clone(nsIURI **_retval)
|
|||
msgMailNewsUrl->SetMsgWindow(msgWindow);
|
||||
}
|
||||
|
||||
if (aRefHandlingMode == eReplaceRef) {
|
||||
rv = (*_retval)->SetRef(newRef);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
} else if (aRefHandlingMode == eIgnoreRef) {
|
||||
rv = (*_retval)->SetRef(EmptyCString());
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgMailNewsUrl::Clone(nsIURI **_retval)
|
||||
{
|
||||
return CloneInternal(eHonorRef, EmptyCString(), _retval);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgMailNewsUrl::CloneIgnoringRef(nsIURI** _retval)
|
||||
{
|
||||
return CloneInternal(eIgnoreRef, EmptyCString(), _retval);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgMailNewsUrl::CloneWithNewRef(const nsACString& newRef, nsIURI** _retval)
|
||||
{
|
||||
return CloneInternal(eReplaceRef, newRef, _retval);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgMailNewsUrl::Resolve(const nsACString &relativePath, nsACString &result)
|
||||
{
|
||||
|
|
|
@ -47,7 +47,14 @@ public:
|
|||
NS_DECL_NSIURL
|
||||
|
||||
protected:
|
||||
enum RefHandlingEnum {
|
||||
eIgnoreRef,
|
||||
eHonorRef,
|
||||
eReplaceRef
|
||||
};
|
||||
virtual ~nsMsgMailNewsUrl();
|
||||
nsresult CloneInternal(RefHandlingEnum aRefHandlingMode,
|
||||
const nsACString& newRef, nsIURI** _retval);
|
||||
|
||||
nsCOMPtr<nsIURL> m_baseURL;
|
||||
nsWeakPtr m_statusFeedbackWeak;
|
||||
|
|
|
@ -515,7 +515,9 @@ NS_IMETHODIMP nsMailtoUrl::Equals(nsIURI *other, bool *_retval)
|
|||
return m_baseURL->Equals(other, _retval);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMailtoUrl::Clone(nsIURI **_retval)
|
||||
nsresult
|
||||
nsMailtoUrl::CloneInternal(RefHandlingEnum aRefHandlingMode,
|
||||
const nsACString& newRef, nsIURI** _retval)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(_retval);
|
||||
|
||||
|
@ -523,14 +525,38 @@ NS_IMETHODIMP nsMailtoUrl::Clone(nsIURI **_retval)
|
|||
|
||||
NS_ENSURE_TRUE(clone, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
nsresult rv = m_baseURL->Clone(getter_AddRefs(clone->m_baseURL));
|
||||
nsresult rv;
|
||||
if (aRefHandlingMode == eHonorRef) {
|
||||
rv = m_baseURL->Clone(getter_AddRefs(clone->m_baseURL));
|
||||
} else if (aRefHandlingMode == eReplaceRef) {
|
||||
rv = m_baseURL->CloneWithNewRef(newRef, getter_AddRefs(clone->m_baseURL));
|
||||
} else {
|
||||
rv = m_baseURL->CloneIgnoringRef(getter_AddRefs(clone->m_baseURL));
|
||||
}
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
clone->ParseUrl();
|
||||
clone.forget(_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMailtoUrl::Clone(nsIURI **_retval)
|
||||
{
|
||||
return CloneInternal(eHonorRef, EmptyCString(), _retval);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMailtoUrl::CloneIgnoringRef(nsIURI** _retval)
|
||||
{
|
||||
return CloneInternal(eIgnoreRef, EmptyCString(), _retval);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMailtoUrl::CloneWithNewRef(const nsACString& newRef, nsIURI** _retval)
|
||||
{
|
||||
return CloneInternal(eReplaceRef, newRef, _retval);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMailtoUrl::Resolve(const nsACString &relativePath, nsACString &result)
|
||||
{
|
||||
return m_baseURL->Resolve(relativePath, result);
|
||||
|
@ -558,20 +584,6 @@ NS_IMETHODIMP nsMailtoUrl::EqualsExceptRef(nsIURI *other, bool *result)
|
|||
return m_baseURL->EqualsExceptRef(other, result);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMailtoUrl::CloneIgnoringRef(nsIURI** result)
|
||||
{
|
||||
nsCOMPtr<nsIURI> clone;
|
||||
nsresult rv = Clone(getter_AddRefs(clone));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = clone->SetRef(EmptyCString());
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
clone.forget(result);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMailtoUrl::GetSpecIgnoringRef(nsACString &result)
|
||||
{
|
||||
|
|
|
@ -27,10 +27,17 @@ public:
|
|||
nsMailtoUrl();
|
||||
|
||||
protected:
|
||||
enum RefHandlingEnum {
|
||||
eIgnoreRef,
|
||||
eHonorRef,
|
||||
eReplaceRef
|
||||
};
|
||||
virtual ~nsMailtoUrl();
|
||||
nsresult ParseUrl();
|
||||
nsresult CleanupMailtoState();
|
||||
nsresult ParseMailtoUrl(char * searchPart);
|
||||
nsresult CloneInternal(RefHandlingEnum aRefHandlingMode,
|
||||
const nsACString& newRef, nsIURI** _retval);
|
||||
|
||||
nsCOMPtr<nsIURI> m_baseURL;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче