a=asa for QA checkins that are not part of the default builds.

Removed getAdders for GetSpec() and GetPath(). use nsAutoString.
This commit is contained in:
depstein%netscape.com 2002-03-16 02:31:53 +00:00
Родитель 6a32c83ffd
Коммит 70272d6305
9 изменённых файлов: 58 добавлений и 30 удалений

Просмотреть файл

@ -112,7 +112,7 @@ void CBrowserFrame::BrowserFrameGlueObj::UpdateCurrentURI(nsIURI *aLocation)
if(aLocation)
{
nsXPIDLCString uriString;
aLocation->GetSpec(getter_Copies(uriString));
aLocation->GetSpec(uriString);
pThis->m_wndUrlBar.SetCurrentURL(uriString.get());
}

Просмотреть файл

@ -253,14 +253,14 @@ NS_IMETHODIMP CBrowserImpl::OnLocationChange(nsIWebProgress* aWebProgress,
QAOutput("Entering nsIWebProgLstnr::OnLocationChange().");
nsresult rv;
char *uriSpec;
rv = location->GetSpec(&uriSpec);
nsCAutoString uriString;
rv = location->GetSpec(uriString);
if (NS_FAILED(rv))
QAOutput("Bad result for GetSpec().");
else
QAOutput("Good result for GetSpec().");
FormatAndPrintOutput("OnLocationChange(): The location url = ", uriSpec, 1);
FormatAndPrintOutput("OnLocationChange(): The location url = ", uriString, 1);
// RequestName(aRequest, stringMsg); // because of crash bug bugzilla 86521

Просмотреть файл

@ -412,7 +412,7 @@ void CBrowserView::OnViewSource()
// Get the uri string associated with the nsIURI object
nsXPIDLCString uriString;
rv = currentURI->GetSpec(getter_Copies(uriString));
rv = currentURI->GetSpec(uriString);
if(NS_FAILED(rv))
return;
@ -813,11 +813,10 @@ void CBrowserView::OnSaveLinkAs()
// Get the "path" portion (see nsIURI.h for more info
// on various parts of a URI)
nsXPIDLCString path;
linkURI->GetPath(getter_Copies(path));
nsCAutoString fileName;
linkURI->GetPath(fileName);
// The path may have the "/" char in it - strip those
nsCAutoString fileName(path);
fileName.StripChars("\\/");
// Now, use this file name in a File Save As dlg...
@ -859,8 +858,8 @@ void CBrowserView::OnSaveImageAs()
// Get the "path" portion (see nsIURI.h for more info
// on various parts of a URI)
nsXPIDLCString path;
linkURI->GetPath(getter_Copies(path));
nsCAutoString path;
linkURI->GetPath(path);
// The path may have the "/" char in it - strip those
nsCAutoString fileName(path);
@ -991,8 +990,8 @@ void CBrowserView::OnFilePrint()
nsresult rv = mWebNav->GetCurrentURI(getter_AddRefs(currentURI));
if(NS_SUCCEEDED(rv) || currentURI)
{
nsXPIDLCString path;
currentURI->GetPath(getter_Copies(path));
nsCAutoString path;
currentURI->GetPath(path);
dlg.SetURI(path.get());
}
m_bCurrentlyPrinting = TRUE;

Просмотреть файл

@ -161,6 +161,31 @@ void FormatAndPrintOutput(const char *theInput, const char *theVar, int outputMo
}
}
void FormatAndPrintOutput(const char *theInput, nsCAutoString theVar, int outputMode)
{
nsCString outStr;
CString strMsg;
outStr = theInput;
outStr += theVar;
strMsg = outStr.get();
switch (outputMode)
{
case 0:
AfxMessageBox(strMsg);
break;
case 1:
WriteToOutputFile(outStr.get());
break;
case 2:
WriteToOutputFile(outStr.get());
AfxMessageBox(strMsg);
break;
}
}
void FormatAndPrintOutput(const char *theInput, int theVar, int outputMode)
{
nsCString outStr;
@ -227,11 +252,11 @@ void WebProgDOMWindowTest(nsIWebProgress *progress, const char *inString,
void GetTheUri(nsIURI *theUri, int displayMethod)
{
nsresult rv;
char *uriSpec;
nsCAutoString uriString;
rv = theUri->GetSpec(&uriSpec);
rv = theUri->GetSpec(uriString);
RvTestResult(rv, "nsIURI::GetSpec() test", displayMethod);
FormatAndPrintOutput("the uri = ", uriSpec, displayMethod);
FormatAndPrintOutput("the uri = ", uriString, displayMethod);
}
// used for web progress listener in BrowserImplWebPrgrsLstnr.cpp

Просмотреть файл

@ -57,6 +57,7 @@ extern void RvTestResult(nsresult, const char *, int displayMethod=1);
extern void WriteToOutputFile(const char *);
extern void QAOutput(const char *pLine, int displayMethod=1);
extern void FormatAndPrintOutput(const char *, const char *, int);
extern void FormatAndPrintOutput(const char *, nsCAutoString, int);
extern void FormatAndPrintOutput(const char *, int, int);
extern void RequestName(nsIRequest *, nsCString &, int displayMethod=1);
extern void WebProgDOMWindowTest(nsIWebProgress *, const char *,int displayMethod=1);

Просмотреть файл

@ -237,7 +237,7 @@ void CTests::OnTestsChangeUrl()
FormatAndPrintOutput("The url = ", theUrl, 2);
/*
char *uriSpec;
nsCAutoString uriString;
nsCOMPtr<nsIURI> pURI;
// GetcurrentURI() declared in nsIP3PUI.idl
// used with webNav obj in nsP3PObserverHTML.cpp, line 239
@ -246,12 +246,12 @@ void CTests::OnTestsChangeUrl()
if(NS_FAILED(rv) || !pURI)
AfxMessageBox("Bad result for GetCurrentURI().");
rv = pURI->GetSpec(&uriSpec);
rv = pURI->GetSpec(uriString);
if (NS_FAILED(rv))
AfxMessageBox("Bad result for GetSpec().");
AfxMessageBox("Start URL validation test().");
if (strcmp(uriSpec, theUrl) == 0)
if (strcmp(uriString, theUrl) == 0)
{
QAOutput("Url loaded successfully. Test Passed.", 2);
}

Просмотреть файл

@ -415,11 +415,11 @@ void CNsIWebNav::GetCurrentURITest()
else
RvTestResult(rv, "GetCurrentURI() test", 2);
char *uriSpec;
rv = theUri->GetSpec(&uriSpec);
nsCAutoString uriString;
rv = theUri->GetSpec(uriString);
RvTestResult(rv, "nsIURI::GetSpec() for nsIWebNav test", 1);
FormatAndPrintOutput("the nsIWebNav uri = ", uriSpec, 2);
FormatAndPrintOutput("the nsIWebNav uri = ", uriString, 2);
}
void CNsIWebNav::GetSHTest()

Просмотреть файл

@ -361,11 +361,12 @@ void CNsIHistory::GetURIHistTest(nsIHistoryEntry* theHistoryEntry)
else
{
RvTestResult(rv, "GetURI() (URI attribute) test", 1);
rv = theUri->GetSpec(&uriSpec);
nsCAutoString uriString;
rv = theUri->GetSpec(uriString);
if (NS_FAILED(rv))
QAOutput("We didn't get the uriSpec.", 1);
QAOutput("We didn't get the uriString.", 1);
else
FormatAndPrintOutput("The SH Url = ", uriSpec, 2);
FormatAndPrintOutput("The SH Url = ", uriString, 2);
}
}
@ -423,11 +424,12 @@ void CNsIHistory::SimpleEnumTest(nsISimpleEnumerator *theSimpleEnum)
if (!nextHistoryEntry)
continue;
rv = nextHistoryEntry->GetURI(getter_AddRefs(theUri));
rv = theUri->GetSpec(&uriSpec);
if (!uriSpec)
QAOutput("uriSpec for GetSpec() invalid. Test failed.", 1);
nsCAutoString uriString;
rv = theUri->GetSpec(uriString);
if (NS_FAILED(rv))
QAOutput("uriString for GetSpec() invalid. Test failed.", 1);
else
FormatAndPrintOutput("The SimpleEnum URL = ", uriSpec, 2);
FormatAndPrintOutput("The SimpleEnum URL = ", uriString, 2);
}
}

Просмотреть файл

@ -115,6 +115,7 @@ void CNsIRequest::RunIndividualTests(UINT nMenuID)
FormatAndPrintOutput("the uri spec = ", theSpec.get(), 2);
rv = NS_NewURI(getter_AddRefs(theURI), theSpec.get());
if (!theURI)
{
QAOutput("We didn't get the URI. Test failed.", 1);
@ -123,7 +124,7 @@ void CNsIRequest::RunIndividualTests(UINT nMenuID)
else
RvTestResult(rv, "NS_NewURI", 1);
rv = NS_OpenURI(getter_AddRefs(theChannel), theURI, nsnull, theLoadGroup);
rv = NS_NewChannel(getter_AddRefs(theChannel), theURI, nsnull, theLoadGroup);
if (!theChannel)
{
QAOutput("We didn't get the Channel. Test failed.", 1);
@ -218,7 +219,7 @@ void CNsIRequest::RunAllTests()
else
RvTestResult(rv, "NS_NewURI", 1);
rv = NS_OpenURI(getter_AddRefs(theChannel), theURI, nsnull, theLoadGroup);
rv = NS_NewChannel(getter_AddRefs(theChannel), theURI, nsnull, theLoadGroup);
if (!theChannel)
{
QAOutput("We didn't get the Channel. Test failed.", 1);