fixes bug 124042 "support internationalized URIs" r=dougt, sr=alecf, a=asa

git-svn-id: svn://10.0.0.236/trunk@115936 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
darin%netscape.com
2002-03-06 07:48:55 +00:00
parent d6d2d2537e
commit 04849998e1
373 changed files with 5638 additions and 5259 deletions

View File

@@ -263,17 +263,15 @@ extern "C" NS_EXPORT int DebugRobot(
if (NS_FAILED(rv)) return rv;
nsIURI *uri = nsnull;
char *uriStr = ToNewCString(*urlName);
if (!uriStr) return NS_ERROR_OUT_OF_MEMORY;
rv = service->NewURI(uriStr, nsnull, &uri);
nsCRT::free(uriStr);
NS_ConvertUCS2toUTF8 uriStr(*urlName);
rv = service->NewURI(uriStr, nsnull, nsnull, &uri);
if (NS_FAILED(rv)) return rv;
rv = uri->QueryInterface(NS_GET_IID(nsIURI), (void**)&url);
NS_RELEASE(uri);
if (NS_OK != rv) {
printf("invalid URL: '");
fputs(NS_LossyConvertUCS2toASCII(*urlName).get(), stdout);
fputs(uriStr.get(), stdout);
printf("'\n");
NS_RELEASE(myObserver);
return -1;
@@ -321,10 +319,9 @@ extern "C" NS_EXPORT int DebugRobot(
parser->Parse(url, nsnull,PR_TRUE);/* XXX hook up stream listener here! */
while (!g_bReadyForNextUrl) {
if (yieldProc != NULL) {
char* spec;
(void)url->GetSpec(&spec);
(*yieldProc)(spec);
nsCRT::free(spec);
nsCAutoString spec;
(void)url->GetSpec(spec);
(*yieldProc)(spec.get());
}
}
g_bReadyForNextUrl = PR_FALSE;
@@ -334,10 +331,9 @@ extern "C" NS_EXPORT int DebugRobot(
(void) progress->AddProgressListener(pl);
char* spec;
(void)url->GetSpec(&spec);
nsAutoString theSpec; theSpec.AssignWithConversion(spec);
nsCRT::free(spec);
nsCAutoString spec;
(void)url->GetSpec(spec);
NS_ConvertUTF8toUCS2 theSpec(spec);
nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(docShell));
webNav->LoadURI(theSpec.get(),
nsIWebNavigation::LOAD_FLAGS_NONE,
@@ -346,9 +342,8 @@ extern "C" NS_EXPORT int DebugRobot(
nsnull);/* XXX hook up stream listener here! */
while (!g_bReadyForNextUrl) {
if (yieldProc != NULL) {
(void)url->GetSpec(&spec);
(*yieldProc)(spec);
nsCRT::free(spec);
(void)url->GetSpec(spec);
(*yieldProc)(spec.get());
}
}
}

View File

@@ -368,10 +368,8 @@ void RobotSink::ProcessLink(const nsString& aLink)
rv = mDocumentURL->QueryInterface(NS_GET_IID(nsIURI), (void**)&baseUri);
if (NS_FAILED(rv)) return;
char *uriStr = ToNewCString(aLink);
if (!uriStr) return;
rv = service->NewURI(uriStr, baseUri, &uri);
nsCRT::free(uriStr);
NS_ConvertUCS2toUTF8 uriStr(aLink);
rv = service->NewURI(uriStr, nsnull, baseUri, &uri);
NS_RELEASE(baseUri);
if (NS_FAILED(rv)) return;
@@ -380,10 +378,9 @@ void RobotSink::ProcessLink(const nsString& aLink)
if (NS_OK == rv) {
absURLSpec.Truncate();
char* str;
absurl->GetSpec(&str);
absURLSpec.AssignWithConversion(str);
nsCRT::free(str);
nsCAutoString str;
absurl->GetSpec(str);
absURLSpec = NS_ConvertUTF8toUCS2(str);
}
}