From 3c4e8e227e36ec938bb130984ed65d4d93d59e8d Mon Sep 17 00:00:00 2001 From: "valeski%netscape.com" Date: Sun, 9 Aug 1998 18:17:50 +0000 Subject: [PATCH] the previous checkin had the code in the wrong place (I overlooked a patch issue) git-svn-id: svn://10.0.0.236/branches/NGLayoutStability_BRANCH@7634 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/docshell/base/nsWebShell.cpp | 33 ++++++++++++++-------------- mozilla/webshell/src/nsWebShell.cpp | 33 ++++++++++++++-------------- 2 files changed, 32 insertions(+), 34 deletions(-) diff --git a/mozilla/docshell/base/nsWebShell.cpp b/mozilla/docshell/base/nsWebShell.cpp index c3ea8ff5675..84d7e0a56ab 100644 --- a/mozilla/docshell/base/nsWebShell.cpp +++ b/mozilla/docshell/base/nsWebShell.cpp @@ -797,22 +797,6 @@ nsWebShell::GetDocumentLoader(nsIDocumentLoader*& aResult) static void convertFileToURL(nsString &aIn, nsString &aOut) { #ifdef XP_PC - PRInt32 colon, fSlash; - PRUnichar port; - nsAutoString urlSpec(aURLSpec); - - fSlash=urlSpec.Find('/'); - - // if no scheme (protocol) is found, assume http. - if ( ((colon=urlSpec.Find(':')) == -1) // no colon at all - || ( (fSlash > -1) && (colon > fSlash) ) // the only colon comes after the first slash - || ( (colon < urlSpec.Length()-1) // the first char after the first colon is a digit (i.e. a port) - && ((port=urlSpec.CharAt(colon+1)) < '9') - && (port > '0') ) - ) { - nsString httpDef("http://"); - urlSpec.Insert(httpDef, 0, 7); - } char szFile[1000]; aIn.ToCString(szFile, sizeof(szFile)); if (PL_strchr(szFile, '\\')) { @@ -845,10 +829,25 @@ NS_IMETHODIMP nsWebShell::LoadURL(const PRUnichar* aURLSpec, nsIPostData* aPostData) { - nsAutoString urlSpec; nsresult rv; + PRInt32 colon, fSlash; + PRUnichar port; + nsAutoString urlSpec; convertFileToURL(nsString(aURLSpec), urlSpec); + fSlash=urlSpec.Find('/'); + + // if no scheme (protocol) is found, assume http. + if ( ((colon=urlSpec.Find(':')) == -1) // no colon at all + || ( (fSlash > -1) && (colon > fSlash) ) // the only colon comes after the first slash + || ( (colon < urlSpec.Length()-1) // the first char after the first colon is a digit (i.e. a port) + && ((port=urlSpec.CharAt(colon+1)) < '9') + && (port > '0') ) + ) { + nsString httpDef("http://"); + urlSpec.Insert(httpDef, 0, 7); + } + // Give web-shell-container right of refusal if (nsnull != mContainer) { rv = mContainer->WillLoadURL(this, urlSpec); diff --git a/mozilla/webshell/src/nsWebShell.cpp b/mozilla/webshell/src/nsWebShell.cpp index c3ea8ff5675..84d7e0a56ab 100644 --- a/mozilla/webshell/src/nsWebShell.cpp +++ b/mozilla/webshell/src/nsWebShell.cpp @@ -797,22 +797,6 @@ nsWebShell::GetDocumentLoader(nsIDocumentLoader*& aResult) static void convertFileToURL(nsString &aIn, nsString &aOut) { #ifdef XP_PC - PRInt32 colon, fSlash; - PRUnichar port; - nsAutoString urlSpec(aURLSpec); - - fSlash=urlSpec.Find('/'); - - // if no scheme (protocol) is found, assume http. - if ( ((colon=urlSpec.Find(':')) == -1) // no colon at all - || ( (fSlash > -1) && (colon > fSlash) ) // the only colon comes after the first slash - || ( (colon < urlSpec.Length()-1) // the first char after the first colon is a digit (i.e. a port) - && ((port=urlSpec.CharAt(colon+1)) < '9') - && (port > '0') ) - ) { - nsString httpDef("http://"); - urlSpec.Insert(httpDef, 0, 7); - } char szFile[1000]; aIn.ToCString(szFile, sizeof(szFile)); if (PL_strchr(szFile, '\\')) { @@ -845,10 +829,25 @@ NS_IMETHODIMP nsWebShell::LoadURL(const PRUnichar* aURLSpec, nsIPostData* aPostData) { - nsAutoString urlSpec; nsresult rv; + PRInt32 colon, fSlash; + PRUnichar port; + nsAutoString urlSpec; convertFileToURL(nsString(aURLSpec), urlSpec); + fSlash=urlSpec.Find('/'); + + // if no scheme (protocol) is found, assume http. + if ( ((colon=urlSpec.Find(':')) == -1) // no colon at all + || ( (fSlash > -1) && (colon > fSlash) ) // the only colon comes after the first slash + || ( (colon < urlSpec.Length()-1) // the first char after the first colon is a digit (i.e. a port) + && ((port=urlSpec.CharAt(colon+1)) < '9') + && (port > '0') ) + ) { + nsString httpDef("http://"); + urlSpec.Insert(httpDef, 0, 7); + } + // Give web-shell-container right of refusal if (nsnull != mContainer) { rv = mContainer->WillLoadURL(this, urlSpec);