From 10605b78237b0a2b1fcee7299d4d99660110ee15 Mon Sep 17 00:00:00 2001 From: "mscott%netscape.com" Date: Tue, 20 Jul 1999 23:53:03 +0000 Subject: [PATCH] Necko Only!! Yuck. something was pretty bogus here...whenever we were parsing a url we'd create an empty base url then try to turn the empty url into an absolute url which was returning an error. Looks like ParseURL would never work. --- content/html/style/src/nsCSSParser.cpp | 24 +++++------------------- layout/html/style/src/nsCSSParser.cpp | 24 +++++------------------- layout/style/nsCSSParser.cpp | 24 +++++------------------- 3 files changed, 15 insertions(+), 57 deletions(-) diff --git a/content/html/style/src/nsCSSParser.cpp b/content/html/style/src/nsCSSParser.cpp index fa136a9e791..6b020317e19 100644 --- a/content/html/style/src/nsCSSParser.cpp +++ b/content/html/style/src/nsCSSParser.cpp @@ -33,6 +33,7 @@ #include "nsIURL.h" #ifdef NECKO #include "nsNeckoUtil.h" +#include "nsCOMPtr.h" #else #include "nsIURLGroup.h" #endif // NECKO @@ -2459,25 +2460,10 @@ PRBool CSSParserImpl::ParseURL(PRInt32& aErrorCode, nsCSSValue& aValue) nsString baseURL; nsresult rv; #ifdef NECKO - nsIURI* base; - if (baseURL.Length() == 0) { - rv = NS_NewURI(&base, baseURL); - } - else { - rv = mURL->Clone(&base); - } - if (NS_FAILED(rv)) return PR_FALSE; - - char* str = tk->mIdent.ToNewCString(); - if (!str) { - NS_RELEASE(base); - aErrorCode = NS_ERROR_OUT_OF_MEMORY; - return PR_FALSE; - } - - rv = NS_MakeAbsoluteURI(str, base, absURL); - NS_RELEASE(base); - delete [] str; + nsCOMPtr base; + rv = mURL->Clone(getter_AddRefs(base)); + if (NS_SUCCEEDED(rv)) + rv = NS_MakeAbsoluteURI(nsCAutoString(tk->mIdent), base, absURL); #else rv = NS_MakeAbsoluteURL(mURL, baseURL, tk->mIdent, absURL); #endif // NECKO diff --git a/layout/html/style/src/nsCSSParser.cpp b/layout/html/style/src/nsCSSParser.cpp index fa136a9e791..6b020317e19 100644 --- a/layout/html/style/src/nsCSSParser.cpp +++ b/layout/html/style/src/nsCSSParser.cpp @@ -33,6 +33,7 @@ #include "nsIURL.h" #ifdef NECKO #include "nsNeckoUtil.h" +#include "nsCOMPtr.h" #else #include "nsIURLGroup.h" #endif // NECKO @@ -2459,25 +2460,10 @@ PRBool CSSParserImpl::ParseURL(PRInt32& aErrorCode, nsCSSValue& aValue) nsString baseURL; nsresult rv; #ifdef NECKO - nsIURI* base; - if (baseURL.Length() == 0) { - rv = NS_NewURI(&base, baseURL); - } - else { - rv = mURL->Clone(&base); - } - if (NS_FAILED(rv)) return PR_FALSE; - - char* str = tk->mIdent.ToNewCString(); - if (!str) { - NS_RELEASE(base); - aErrorCode = NS_ERROR_OUT_OF_MEMORY; - return PR_FALSE; - } - - rv = NS_MakeAbsoluteURI(str, base, absURL); - NS_RELEASE(base); - delete [] str; + nsCOMPtr base; + rv = mURL->Clone(getter_AddRefs(base)); + if (NS_SUCCEEDED(rv)) + rv = NS_MakeAbsoluteURI(nsCAutoString(tk->mIdent), base, absURL); #else rv = NS_MakeAbsoluteURL(mURL, baseURL, tk->mIdent, absURL); #endif // NECKO diff --git a/layout/style/nsCSSParser.cpp b/layout/style/nsCSSParser.cpp index fa136a9e791..6b020317e19 100644 --- a/layout/style/nsCSSParser.cpp +++ b/layout/style/nsCSSParser.cpp @@ -33,6 +33,7 @@ #include "nsIURL.h" #ifdef NECKO #include "nsNeckoUtil.h" +#include "nsCOMPtr.h" #else #include "nsIURLGroup.h" #endif // NECKO @@ -2459,25 +2460,10 @@ PRBool CSSParserImpl::ParseURL(PRInt32& aErrorCode, nsCSSValue& aValue) nsString baseURL; nsresult rv; #ifdef NECKO - nsIURI* base; - if (baseURL.Length() == 0) { - rv = NS_NewURI(&base, baseURL); - } - else { - rv = mURL->Clone(&base); - } - if (NS_FAILED(rv)) return PR_FALSE; - - char* str = tk->mIdent.ToNewCString(); - if (!str) { - NS_RELEASE(base); - aErrorCode = NS_ERROR_OUT_OF_MEMORY; - return PR_FALSE; - } - - rv = NS_MakeAbsoluteURI(str, base, absURL); - NS_RELEASE(base); - delete [] str; + nsCOMPtr base; + rv = mURL->Clone(getter_AddRefs(base)); + if (NS_SUCCEEDED(rv)) + rv = NS_MakeAbsoluteURI(nsCAutoString(tk->mIdent), base, absURL); #else rv = NS_MakeAbsoluteURL(mURL, baseURL, tk->mIdent, absURL); #endif // NECKO