mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-02 07:05:24 +00:00
making string conversions explicit
This commit is contained in:
parent
8c1a332162
commit
b93b044066
@ -193,7 +193,7 @@ void nsWalletlibService::Init()
|
|||||||
nsresult rv = nsServiceManager::GetService
|
nsresult rv = nsServiceManager::GetService
|
||||||
(NS_OBSERVERSERVICE_PROGID, NS_GET_IID(nsIObserverService), (nsISupports**)&svc );
|
(NS_OBSERVERSERVICE_PROGID, NS_GET_IID(nsIObserverService), (nsISupports**)&svc );
|
||||||
if ( NS_SUCCEEDED( rv ) && svc ) {
|
if ( NS_SUCCEEDED( rv ) && svc ) {
|
||||||
nsString topic(NS_FORMSUBMIT_SUBJECT);
|
nsString topic; topic.AssignWithConversion(NS_FORMSUBMIT_SUBJECT);
|
||||||
rv = svc->AddObserver( this, topic.GetUnicode());
|
rv = svc->AddObserver( this, topic.GetUnicode());
|
||||||
nsServiceManager::ReleaseService( NS_OBSERVERSERVICE_PROGID, svc );
|
nsServiceManager::ReleaseService( NS_OBSERVERSERVICE_PROGID, svc );
|
||||||
}
|
}
|
||||||
@ -299,10 +299,10 @@ nsWalletlibService::OnEndDocumentLoad(nsIDocumentLoader* aLoader, nsIChannel* ch
|
|||||||
if (nsnull != elementNode) {
|
if (nsnull != elementNode) {
|
||||||
nsCOMPtr<nsIDOMHTMLInputElement> inputElement(do_QueryInterface(elementNode));
|
nsCOMPtr<nsIDOMHTMLInputElement> inputElement(do_QueryInterface(elementNode));
|
||||||
if ((NS_SUCCEEDED(rv)) && (nsnull != inputElement)) {
|
if ((NS_SUCCEEDED(rv)) && (nsnull != inputElement)) {
|
||||||
nsAutoString type("");
|
nsAutoString type;
|
||||||
rv = inputElement->GetType(type);
|
rv = inputElement->GetType(type);
|
||||||
if (NS_SUCCEEDED(rv)) {
|
if (NS_SUCCEEDED(rv)) {
|
||||||
if (type.Compare("password", PR_TRUE) == 0) {
|
if (type.CompareWithConversion("password", PR_TRUE) == 0) {
|
||||||
passwordCount++;
|
passwordCount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -319,11 +319,11 @@ nsWalletlibService::OnEndDocumentLoad(nsIDocumentLoader* aLoader, nsIChannel* ch
|
|||||||
if (nsnull != elementNode) {
|
if (nsnull != elementNode) {
|
||||||
nsCOMPtr<nsIDOMHTMLInputElement> inputElement(do_QueryInterface(elementNode));
|
nsCOMPtr<nsIDOMHTMLInputElement> inputElement(do_QueryInterface(elementNode));
|
||||||
if ((NS_SUCCEEDED(rv)) && (nsnull != inputElement)) {
|
if ((NS_SUCCEEDED(rv)) && (nsnull != inputElement)) {
|
||||||
nsAutoString type("");
|
nsAutoString type;
|
||||||
rv = inputElement->GetType(type);
|
rv = inputElement->GetType(type);
|
||||||
if (NS_SUCCEEDED(rv)) {
|
if (NS_SUCCEEDED(rv)) {
|
||||||
if ((type.IsEmpty()) || (type.Compare("text", PR_TRUE) == 0) ||
|
if ((type.IsEmpty()) || (type.CompareWithConversion("text", PR_TRUE) == 0) ||
|
||||||
(type.Compare("password", PR_TRUE) == 0)) {
|
(type.CompareWithConversion("password", PR_TRUE) == 0)) {
|
||||||
nsAutoString field;
|
nsAutoString field;
|
||||||
rv = inputElement->GetName(field);
|
rv = inputElement->GetName(field);
|
||||||
if (NS_SUCCEEDED(rv)) {
|
if (NS_SUCCEEDED(rv)) {
|
||||||
|
@ -681,7 +681,7 @@ si_Randomize(nsAutoString& password) {
|
|||||||
PRIntervalTime randomNumber;
|
PRIntervalTime randomNumber;
|
||||||
int i;
|
int i;
|
||||||
const char * hexDigits = "0123456789AbCdEf";
|
const char * hexDigits = "0123456789AbCdEf";
|
||||||
if (password == nsAutoString("********")) {
|
if (password == NS_ConvertToString("********")) {
|
||||||
randomNumber = PR_IntervalNow();
|
randomNumber = PR_IntervalNow();
|
||||||
for (i=0; i<8; i++) {
|
for (i=0; i<8; i++) {
|
||||||
password.SetCharAt(hexDigits[randomNumber%16], i);
|
password.SetCharAt(hexDigits[randomNumber%16], i);
|
||||||
@ -697,7 +697,7 @@ si_Randomize(nsAutoString& password) {
|
|||||||
|
|
||||||
class si_SignonDataStruct {
|
class si_SignonDataStruct {
|
||||||
public:
|
public:
|
||||||
si_SignonDataStruct() : name(""), value(""), isPassword(PR_FALSE) {}
|
si_SignonDataStruct() : isPassword(PR_FALSE) {}
|
||||||
nsAutoString name;
|
nsAutoString name;
|
||||||
nsAutoString value;
|
nsAutoString value;
|
||||||
PRBool isPassword;
|
PRBool isPassword;
|
||||||
@ -720,7 +720,7 @@ public:
|
|||||||
|
|
||||||
class si_Reject {
|
class si_Reject {
|
||||||
public:
|
public:
|
||||||
si_Reject() : URLName(NULL), userName("") {}
|
si_Reject() : URLName(NULL) {}
|
||||||
char * URLName;
|
char * URLName;
|
||||||
nsAutoString userName;
|
nsAutoString userName;
|
||||||
};
|
};
|
||||||
@ -840,7 +840,7 @@ si_RemoveUser(const char *URLName, nsAutoString userName, PRBool save, PRBool st
|
|||||||
return PR_FALSE;
|
return PR_FALSE;
|
||||||
}
|
}
|
||||||
if ((const char *)userName2 && (PL_strlen((const char *)userName2))) {
|
if ((const char *)userName2 && (PL_strlen((const char *)userName2))) {
|
||||||
userName = nsAutoString((const char *)userName2);
|
userName = NS_ConvertToString((const char *)userName2);
|
||||||
PRInt32 colon = userName.FindChar(':');
|
PRInt32 colon = userName.FindChar(':');
|
||||||
if (colon != -1) {
|
if (colon != -1) {
|
||||||
userName.Truncate(colon);
|
userName.Truncate(colon);
|
||||||
@ -1207,8 +1207,8 @@ si_GetURLAndUserForChangeForm(nsAutoString password)
|
|||||||
/* consider first data node to be the identifying item */
|
/* consider first data node to be the identifying item */
|
||||||
data = (si_SignonDataStruct *) (user->signonData_list->ElementAt(0));
|
data = (si_SignonDataStruct *) (user->signonData_list->ElementAt(0));
|
||||||
|
|
||||||
nsAutoString temp = nsAutoString(url->URLName);
|
nsAutoString temp; temp.AssignWithConversion(url->URLName);
|
||||||
temp.Append(":");
|
temp.AppendWithConversion(":");
|
||||||
temp.Append(data->value);
|
temp.Append(data->value);
|
||||||
|
|
||||||
*list2 = temp.ToNewUnicode();
|
*list2 = temp.ToNewUnicode();
|
||||||
@ -1262,7 +1262,7 @@ PUBLIC void
|
|||||||
SI_RemoveAllSignonData() {
|
SI_RemoveAllSignonData() {
|
||||||
if (si_PartiallyLoaded) {
|
if (si_PartiallyLoaded) {
|
||||||
/* repeatedly remove first user node of first URL node */
|
/* repeatedly remove first user node of first URL node */
|
||||||
while (si_RemoveUser(NULL, nsAutoString(""), PR_FALSE, PR_TRUE)) {
|
while (si_RemoveUser(NULL, nsAutoString(), PR_FALSE, PR_TRUE)) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
si_PartiallyLoaded = PR_FALSE;
|
si_PartiallyLoaded = PR_FALSE;
|
||||||
@ -1658,7 +1658,7 @@ si_ReadLine
|
|||||||
(nsInputFileStream strmu, nsInputFileStream strmp, nsAutoString& lineBuffer,PRBool obscure,
|
(nsInputFileStream strmu, nsInputFileStream strmp, nsAutoString& lineBuffer,PRBool obscure,
|
||||||
nsKeyType saveCount = 0, nsKeyType * readCount = 0, PRBool inHeader = PR_FALSE) {
|
nsKeyType saveCount = 0, nsKeyType * readCount = 0, PRBool inHeader = PR_FALSE) {
|
||||||
|
|
||||||
lineBuffer = nsAutoString("");
|
lineBuffer.SetLength(0);
|
||||||
|
|
||||||
/* read the line */
|
/* read the line */
|
||||||
PRUnichar c, c2;
|
PRUnichar c, c2;
|
||||||
@ -1796,7 +1796,7 @@ SI_LoadSignonData(PRBool fullLoad) {
|
|||||||
if (NS_FAILED(si_ReadLine(strmu, strmp, format, fullLoad, 0, 0, PR_TRUE))) {
|
if (NS_FAILED(si_ReadLine(strmu, strmp, format, fullLoad, 0, 0, PR_TRUE))) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (!format.Equals(HEADER_VERSION_1)) {
|
if (!format.EqualsWithConversion(HEADER_VERSION_1)) {
|
||||||
/* something's wrong */
|
/* something's wrong */
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -2034,23 +2034,22 @@ si_SaveSignonDataLocked(PRBool fullSave) {
|
|||||||
|
|
||||||
/* format revision number */
|
/* format revision number */
|
||||||
|
|
||||||
si_WriteLine(strmu, strmp, nsAutoString(HEADER_VERSION_1), PR_FALSE, fullSave, 0, 0, PR_TRUE);
|
si_WriteLine(strmu, strmp, NS_ConvertToString(HEADER_VERSION_1), PR_FALSE, fullSave, 0, 0, PR_TRUE);
|
||||||
|
|
||||||
/* saveCount */
|
/* saveCount */
|
||||||
|
|
||||||
nsAutoString buffer;
|
nsAutoString buffer;
|
||||||
buffer = "";
|
|
||||||
if (fullSave) {
|
if (fullSave) {
|
||||||
saveCountP += 16; /* preserve low order four bits which designate the file type */
|
saveCountP += 16; /* preserve low order four bits which designate the file type */
|
||||||
}
|
}
|
||||||
buffer.Append(PRInt32(saveCountP),10);
|
buffer.AppendWithConversion(PRInt32(saveCountP),10);
|
||||||
si_WriteLine(strmu, strmp, buffer, PR_FALSE, fullSave, 0, 0, PR_TRUE);
|
si_WriteLine(strmu, strmp, buffer, PR_FALSE, fullSave, 0, 0, PR_TRUE);
|
||||||
si_WriteLine(strmu, strmp, buffer, PR_FALSE, fullSave, 0, 0, PR_TRUE);
|
si_WriteLine(strmu, strmp, buffer, PR_FALSE, fullSave, 0, 0, PR_TRUE);
|
||||||
|
|
||||||
/* writeCount */
|
/* writeCount */
|
||||||
|
|
||||||
buffer = "";
|
buffer.SetLength(0);
|
||||||
buffer.Append(PRInt32(writeCount),10);
|
buffer.AppendWithConversion(PRInt32(writeCount),10);
|
||||||
si_WriteLine(strmu, strmp, buffer, PR_FALSE, fullSave, 0, 0, PR_TRUE);
|
si_WriteLine(strmu, strmp, buffer, PR_FALSE, fullSave, 0, 0, PR_TRUE);
|
||||||
si_WriteLine(strmu, strmp, buffer, PR_FALSE, fullSave, 0, 0, PR_TRUE);
|
si_WriteLine(strmu, strmp, buffer, PR_FALSE, fullSave, 0, 0, PR_TRUE);
|
||||||
|
|
||||||
@ -2070,10 +2069,10 @@ si_SaveSignonDataLocked(PRBool fullSave) {
|
|||||||
PRInt32 rejectCount = LIST_COUNT(si_reject_list);
|
PRInt32 rejectCount = LIST_COUNT(si_reject_list);
|
||||||
for (PRInt32 i=0; i<rejectCount; i++) {
|
for (PRInt32 i=0; i<rejectCount; i++) {
|
||||||
reject = NS_STATIC_CAST(si_Reject*, si_reject_list->ElementAt(i));
|
reject = NS_STATIC_CAST(si_Reject*, si_reject_list->ElementAt(i));
|
||||||
si_WriteLine(strmu, strmp, nsAutoString(reject->URLName), PR_FALSE, fullSave);
|
si_WriteLine(strmu, strmp, NS_ConvertToString(reject->URLName), PR_FALSE, fullSave);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
si_WriteLine(strmu, strmp, nsAutoString("."), PR_FALSE, fullSave);
|
si_WriteLine(strmu, strmp, NS_ConvertToString("."), PR_FALSE, fullSave);
|
||||||
|
|
||||||
/* format for cached logins shall be:
|
/* format for cached logins shall be:
|
||||||
* url LINEBREAK {name LINEBREAK value LINEBREAK}* . LINEBREAK
|
* url LINEBREAK {name LINEBREAK value LINEBREAK}* . LINEBREAK
|
||||||
@ -2091,7 +2090,7 @@ si_SaveSignonDataLocked(PRBool fullSave) {
|
|||||||
for (PRInt32 i3=0; i3<userCount; i3++) {
|
for (PRInt32 i3=0; i3<userCount; i3++) {
|
||||||
user = NS_STATIC_CAST(si_SignonUserStruct*, url->signonUser_list->ElementAt(i3));
|
user = NS_STATIC_CAST(si_SignonUserStruct*, url->signonUser_list->ElementAt(i3));
|
||||||
si_WriteLine
|
si_WriteLine
|
||||||
(strmu, strmp, nsAutoString(url->URLName), PR_FALSE, fullSave);
|
(strmu, strmp, NS_ConvertToString(url->URLName), PR_FALSE, fullSave);
|
||||||
|
|
||||||
/* write out each data node of the user node */
|
/* write out each data node of the user node */
|
||||||
PRInt32 dataCount = LIST_COUNT(user->signonData_list);
|
PRInt32 dataCount = LIST_COUNT(user->signonData_list);
|
||||||
@ -2104,7 +2103,7 @@ si_SaveSignonDataLocked(PRBool fullSave) {
|
|||||||
si_WriteLine(strmu, strmp, nsAutoString(data->value), PR_TRUE,
|
si_WriteLine(strmu, strmp, nsAutoString(data->value), PR_TRUE,
|
||||||
fullSave, saveCountP, &writeCount);
|
fullSave, saveCountP, &writeCount);
|
||||||
}
|
}
|
||||||
si_WriteLine(strmu, strmp, nsAutoString("."), PR_FALSE, fullSave);
|
si_WriteLine(strmu, strmp, NS_ConvertToString("."), PR_FALSE, fullSave);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2419,12 +2418,12 @@ si_RememberSignonDataFromBrowser(const char* URLName, nsAutoString username, nsA
|
|||||||
|
|
||||||
nsVoidArray * signonData = new nsVoidArray();
|
nsVoidArray * signonData = new nsVoidArray();
|
||||||
si_SignonDataStruct * data1 = new si_SignonDataStruct;
|
si_SignonDataStruct * data1 = new si_SignonDataStruct;
|
||||||
data1 -> name = nsAutoString(USERNAMEFIELD);
|
data1 -> name.AssignWithConversion(USERNAMEFIELD);
|
||||||
data1 -> value = nsAutoString(username);
|
data1 -> value = nsAutoString(username);
|
||||||
data1 -> isPassword = PR_FALSE;
|
data1 -> isPassword = PR_FALSE;
|
||||||
signonData->AppendElement(data1);
|
signonData->AppendElement(data1);
|
||||||
si_SignonDataStruct * data2 = new si_SignonDataStruct;
|
si_SignonDataStruct * data2 = new si_SignonDataStruct;
|
||||||
data2 -> name = nsAutoString(PASSWORDFIELD);
|
data2 -> name.AssignWithConversion(PASSWORDFIELD);
|
||||||
data2 -> value = nsAutoString(password);
|
data2 -> value = nsAutoString(password);
|
||||||
data2 -> isPassword = PR_TRUE;
|
data2 -> isPassword = PR_TRUE;
|
||||||
signonData->AppendElement(data2);
|
signonData->AppendElement(data2);
|
||||||
@ -2454,9 +2453,9 @@ si_RestoreOldSignonDataFromBrowser
|
|||||||
/* get the data from previous time this URL was visited */
|
/* get the data from previous time this URL was visited */
|
||||||
si_lock_signon_list();
|
si_lock_signon_list();
|
||||||
if (username.Length() != 0) {
|
if (username.Length() != 0) {
|
||||||
user = si_GetSpecificUser(URLName, username, nsAutoString(USERNAMEFIELD));
|
user = si_GetSpecificUser(URLName, username, NS_ConvertToString(USERNAMEFIELD));
|
||||||
} else {
|
} else {
|
||||||
user = si_GetUser(URLName, pickFirstUser, nsAutoString(USERNAMEFIELD));
|
user = si_GetUser(URLName, pickFirstUser, NS_ConvertToString(USERNAMEFIELD));
|
||||||
}
|
}
|
||||||
if (!user) {
|
if (!user) {
|
||||||
/* leave original username and password from caller unchanged */
|
/* leave original username and password from caller unchanged */
|
||||||
@ -2467,9 +2466,9 @@ si_RestoreOldSignonDataFromBrowser
|
|||||||
}
|
}
|
||||||
SI_LoadSignonData(PR_TRUE); /* this destroys "user" so need to recalculate it */
|
SI_LoadSignonData(PR_TRUE); /* this destroys "user" so need to recalculate it */
|
||||||
if (username.Length() != 0) {
|
if (username.Length() != 0) {
|
||||||
user = si_GetSpecificUser(URLName, username, nsAutoString(USERNAMEFIELD));
|
user = si_GetSpecificUser(URLName, username, NS_ConvertToString(USERNAMEFIELD));
|
||||||
} else {
|
} else {
|
||||||
user = si_GetUser(URLName, pickFirstUser, nsAutoString(USERNAMEFIELD));
|
user = si_GetUser(URLName, pickFirstUser, NS_ConvertToString(USERNAMEFIELD));
|
||||||
}
|
}
|
||||||
if (!user) {
|
if (!user) {
|
||||||
/* user failed to unlock the database in SI_LoadSignonData above */
|
/* user failed to unlock the database in SI_LoadSignonData above */
|
||||||
@ -2481,9 +2480,9 @@ si_RestoreOldSignonDataFromBrowser
|
|||||||
PRInt32 dataCount = LIST_COUNT(user->signonData_list);
|
PRInt32 dataCount = LIST_COUNT(user->signonData_list);
|
||||||
for (PRInt32 i=0; i<dataCount; i++) {
|
for (PRInt32 i=0; i<dataCount; i++) {
|
||||||
data = NS_STATIC_CAST(si_SignonDataStruct*, user->signonData_list->ElementAt(i));
|
data = NS_STATIC_CAST(si_SignonDataStruct*, user->signonData_list->ElementAt(i));
|
||||||
if(data->name.Equals(USERNAMEFIELD)) {
|
if(data->name.EqualsWithConversion(USERNAMEFIELD)) {
|
||||||
username = data->value;
|
username = data->value;
|
||||||
} else if(data->name.Equals(PASSWORDFIELD)) {
|
} else if(data->name.EqualsWithConversion(PASSWORDFIELD)) {
|
||||||
password = data->value;
|
password = data->value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2521,7 +2520,7 @@ SINGSIGN_StorePassword(const char *URLName, const PRUnichar *user, const PRUnich
|
|||||||
return PR_FALSE;
|
return PR_FALSE;
|
||||||
}
|
}
|
||||||
if ((const char *)userName2 && (PL_strlen((const char *)userName2))) {
|
if ((const char *)userName2 && (PL_strlen((const char *)userName2))) {
|
||||||
userName = nsAutoString((const char *)userName2);
|
userName.AssignWithConversion(userName2);
|
||||||
PRInt32 colon = userName.FindChar(':');
|
PRInt32 colon = userName.FindChar(':');
|
||||||
if (colon != -1) {
|
if (colon != -1) {
|
||||||
userName.Truncate(colon);
|
userName.Truncate(colon);
|
||||||
@ -2661,7 +2660,7 @@ SINGSIGN_PromptPassword
|
|||||||
if (NS_FAILED(res)) {
|
if (NS_FAILED(res)) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
nsAutoString prehost = nsAutoString((const char *)prehostCString);
|
nsAutoString prehost; prehost.AssignWithConversion((const char *)prehostCString);
|
||||||
PRInt32 colon = prehost.FindChar(':');
|
PRInt32 colon = prehost.FindChar(':');
|
||||||
if (colon == -1) {
|
if (colon == -1) {
|
||||||
username = prehost;
|
username = prehost;
|
||||||
@ -2705,7 +2704,7 @@ SINGSIGN_Prompt
|
|||||||
const char *urlname, nsIPrompt* dialog, PRBool *pressedOK, PRBool strip)
|
const char *urlname, nsIPrompt* dialog, PRBool *pressedOK, PRBool strip)
|
||||||
{
|
{
|
||||||
nsresult res;
|
nsresult res;
|
||||||
nsAutoString data, emptyUsername("");
|
nsAutoString data, emptyUsername;
|
||||||
|
|
||||||
/* do only the dialog if signon preference is not enabled */
|
/* do only the dialog if signon preference is not enabled */
|
||||||
if (!si_GetSignonRememberingPref()){
|
if (!si_GetSignonRememberingPref()){
|
||||||
@ -2804,7 +2803,7 @@ SI_FindValueInArgs(nsAutoString results, nsAutoString name) {
|
|||||||
start = results.Find(name);
|
start = results.Find(name);
|
||||||
PR_ASSERT(start >= 0);
|
PR_ASSERT(start >= 0);
|
||||||
if (start < 0) {
|
if (start < 0) {
|
||||||
return nsAutoString("").ToNewUnicode();
|
return nsAutoString().ToNewUnicode();
|
||||||
}
|
}
|
||||||
start += name.Length(); /* get passed the |name| part */
|
start += name.Length(); /* get passed the |name| part */
|
||||||
length = results.FindChar('|', PR_FALSE,start) - start;
|
length = results.FindChar('|', PR_FALSE,start) - start;
|
||||||
@ -2834,7 +2833,7 @@ SINGSIGN_SignonViewerReturn (nsAutoString results) {
|
|||||||
/*
|
/*
|
||||||
* step backwards through all users and delete those that are in the sequence */
|
* step backwards through all users and delete those that are in the sequence */
|
||||||
nsAutoString gone;
|
nsAutoString gone;
|
||||||
gone = SI_FindValueInArgs(results, nsAutoString("|goneS|"));
|
gone = SI_FindValueInArgs(results, NS_ConvertToString("|goneS|"));
|
||||||
PRInt32 urlCount = LIST_COUNT(si_signon_list);
|
PRInt32 urlCount = LIST_COUNT(si_signon_list);
|
||||||
while (urlCount>0) {
|
while (urlCount>0) {
|
||||||
urlCount--;
|
urlCount--;
|
||||||
@ -2856,7 +2855,7 @@ SINGSIGN_SignonViewerReturn (nsAutoString results) {
|
|||||||
si_SaveSignonDataLocked(PR_TRUE);
|
si_SaveSignonDataLocked(PR_TRUE);
|
||||||
|
|
||||||
/* step backwards through all rejects and delete those that are in the sequence */
|
/* step backwards through all rejects and delete those that are in the sequence */
|
||||||
gone = SI_FindValueInArgs(results, nsAutoString("|goneR|"));
|
gone = SI_FindValueInArgs(results, NS_ConvertToString("|goneR|"));
|
||||||
si_lock_signon_list();
|
si_lock_signon_list();
|
||||||
PRInt32 rejectCount = LIST_COUNT(si_reject_list);
|
PRInt32 rejectCount = LIST_COUNT(si_reject_list);
|
||||||
while (rejectCount>0) {
|
while (rejectCount>0) {
|
||||||
@ -2890,11 +2889,11 @@ SINGSIGN_GetSignonListForViewer(nsAutoString& aSignonList)
|
|||||||
si_Alert(message);
|
si_Alert(message);
|
||||||
Recycle(message);
|
Recycle(message);
|
||||||
}
|
}
|
||||||
aSignonList = "."; /* a list of length 1 tells viewer that database was not unlocked */
|
aSignonList.AssignWithConversion("."); /* a list of length 1 tells viewer that database was not unlocked */
|
||||||
/* don't display saved signons if user couldn't unlock the database */
|
/* don't display saved signons if user couldn't unlock the database */
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
nsAutoString buffer = "";
|
nsAutoString buffer;
|
||||||
int signonNum = 0;
|
int signonNum = 0;
|
||||||
si_SignonURLStruct *url;
|
si_SignonURLStruct *url;
|
||||||
si_SignonUserStruct * user;
|
si_SignonUserStruct * user;
|
||||||
@ -2916,13 +2915,13 @@ SINGSIGN_GetSignonListForViewer(nsAutoString& aSignonList)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
buffer += BREAK;
|
buffer += BREAK;
|
||||||
buffer += "<OPTION value=";
|
buffer.AppendWithConversion("<OPTION value=");
|
||||||
buffer.Append(signonNum, 10);
|
buffer.AppendWithConversion(signonNum, 10);
|
||||||
buffer += ">";
|
buffer.AppendWithConversion(">");
|
||||||
buffer += url->URLName;
|
buffer.AppendWithConversion(url->URLName);
|
||||||
buffer += ":";
|
buffer.AppendWithConversion(":");
|
||||||
buffer += data->isPassword ? nsAutoString("") : data->value; // in case all fields are passwords
|
buffer += data->isPassword ? nsAutoString() : data->value; // in case all fields are passwords
|
||||||
buffer += "</OPTION>\n";
|
buffer.AppendWithConversion("</OPTION>\n");
|
||||||
signonNum++;
|
signonNum++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2932,7 +2931,7 @@ SINGSIGN_GetSignonListForViewer(nsAutoString& aSignonList)
|
|||||||
PUBLIC void
|
PUBLIC void
|
||||||
SINGSIGN_GetRejectListForViewer(nsAutoString& aRejectList)
|
SINGSIGN_GetRejectListForViewer(nsAutoString& aRejectList)
|
||||||
{
|
{
|
||||||
nsAutoString buffer = "";
|
nsAutoString buffer;
|
||||||
int rejectNum = 0;
|
int rejectNum = 0;
|
||||||
si_Reject *reject;
|
si_Reject *reject;
|
||||||
|
|
||||||
@ -2943,13 +2942,13 @@ SINGSIGN_GetRejectListForViewer(nsAutoString& aRejectList)
|
|||||||
for (PRInt32 i=0; i<rejectCount; i++) {
|
for (PRInt32 i=0; i<rejectCount; i++) {
|
||||||
reject = NS_STATIC_CAST(si_Reject*, si_reject_list->ElementAt(i));
|
reject = NS_STATIC_CAST(si_Reject*, si_reject_list->ElementAt(i));
|
||||||
buffer += BREAK;
|
buffer += BREAK;
|
||||||
buffer += "<OPTION value=";
|
buffer.AppendWithConversion("<OPTION value=");
|
||||||
buffer.Append(rejectNum, 10);
|
buffer.AppendWithConversion(rejectNum, 10);
|
||||||
buffer += ">";
|
buffer.AppendWithConversion(">");
|
||||||
buffer += reject->URLName;
|
buffer.AppendWithConversion(reject->URLName);
|
||||||
buffer += ":";
|
buffer.AppendWithConversion(":");
|
||||||
buffer += reject->userName;
|
buffer += reject->userName;
|
||||||
buffer += "</OPTION>\n";
|
buffer.AppendWithConversion("</OPTION>\n");
|
||||||
rejectNum++;
|
rejectNum++;
|
||||||
}
|
}
|
||||||
aRejectList = buffer;
|
aRejectList = buffer;
|
||||||
|
@ -472,7 +472,7 @@ enum PlacementType {DUP_IGNORE, DUP_OVERWRITE, DUP_BEFORE, DUP_AFTER, AT_END};
|
|||||||
|
|
||||||
class wallet_MapElement {
|
class wallet_MapElement {
|
||||||
public:
|
public:
|
||||||
wallet_MapElement() : item1(""), item2(""), itemList(nsnull) {}
|
wallet_MapElement() : itemList(nsnull) {}
|
||||||
nsAutoString item1;
|
nsAutoString item1;
|
||||||
nsAutoString item2;
|
nsAutoString item2;
|
||||||
nsVoidArray * itemList;
|
nsVoidArray * itemList;
|
||||||
@ -480,7 +480,7 @@ public:
|
|||||||
|
|
||||||
class wallet_Sublist {
|
class wallet_Sublist {
|
||||||
public:
|
public:
|
||||||
wallet_Sublist() : item("") {}
|
wallet_Sublist() {}
|
||||||
nsAutoString item;
|
nsAutoString item;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -673,7 +673,7 @@ wallet_DumpStopwatch() {
|
|||||||
PUBLIC PRUnichar *
|
PUBLIC PRUnichar *
|
||||||
Wallet_Localize(char* genericString) {
|
Wallet_Localize(char* genericString) {
|
||||||
nsresult ret;
|
nsresult ret;
|
||||||
nsAutoString v("");
|
nsAutoString v;
|
||||||
|
|
||||||
/* create a URL for the string resource file */
|
/* create a URL for the string resource file */
|
||||||
nsIIOService* pNetService = nsnull;
|
nsIIOService* pNetService = nsnull;
|
||||||
@ -733,7 +733,7 @@ Wallet_Localize(char* genericString) {
|
|||||||
nsServiceManager::ReleaseService(kStringBundleServiceCID, pStringService);
|
nsServiceManager::ReleaseService(kStringBundleServiceCID, pStringService);
|
||||||
|
|
||||||
/* localize the given string */
|
/* localize the given string */
|
||||||
nsAutoString strtmp(genericString);
|
nsAutoString strtmp; strtmp.AssignWithConversion(genericString);
|
||||||
const PRUnichar *ptrtmp = strtmp.GetUnicode();
|
const PRUnichar *ptrtmp = strtmp.GetUnicode();
|
||||||
PRUnichar *ptrv = nsnull;
|
PRUnichar *ptrv = nsnull;
|
||||||
ret = bundle->GetStringFromName(ptrtmp, &ptrv);
|
ret = bundle->GetStringFromName(ptrtmp, &ptrv);
|
||||||
@ -1621,7 +1621,7 @@ Wallet_KeySize() {
|
|||||||
if (wallet_IsOldKeyFormat()) {
|
if (wallet_IsOldKeyFormat()) {
|
||||||
return ((count == 0) ? 0 : 1);
|
return ((count == 0) ? 0 : 1);
|
||||||
}
|
}
|
||||||
nsAutoString temp(buffer);
|
nsAutoString temp; temp.AssignWithConversion(buffer);
|
||||||
PRInt32 start = 0;
|
PRInt32 start = 0;
|
||||||
for (PRInt32 i=0; i<5; i++) { /* skip over the five lines of the header */
|
for (PRInt32 i=0; i<5; i++) { /* skip over the five lines of the header */
|
||||||
start = temp.FindChar('\n', PR_FALSE, start);
|
start = temp.FindChar('\n', PR_FALSE, start);
|
||||||
@ -1689,7 +1689,7 @@ wallet_ReadKeyFile(PRBool useDefaultKey) {
|
|||||||
|| strm.eof()) {
|
|| strm.eof()) {
|
||||||
strm.close();
|
strm.close();
|
||||||
Wallet_InitKeySet(PR_FALSE);
|
Wallet_InitKeySet(PR_FALSE);
|
||||||
key = nsAutoString("");
|
key.SetLength(0);
|
||||||
keyCancel = PR_FALSE;
|
keyCancel = PR_FALSE;
|
||||||
return PR_FALSE;
|
return PR_FALSE;
|
||||||
}
|
}
|
||||||
@ -1699,7 +1699,7 @@ wallet_ReadKeyFile(PRBool useDefaultKey) {
|
|||||||
|| strm.eof()) {
|
|| strm.eof()) {
|
||||||
strm.close();
|
strm.close();
|
||||||
Wallet_InitKeySet(PR_FALSE);
|
Wallet_InitKeySet(PR_FALSE);
|
||||||
key = nsAutoString("");
|
key.SetLength(0);
|
||||||
keyCancel = PR_FALSE;
|
keyCancel = PR_FALSE;
|
||||||
return PR_FALSE;
|
return PR_FALSE;
|
||||||
}
|
}
|
||||||
@ -1714,7 +1714,7 @@ wallet_ReadKeyFile(PRBool useDefaultKey) {
|
|||||||
return PR_TRUE;
|
return PR_TRUE;
|
||||||
} else {
|
} else {
|
||||||
Wallet_InitKeySet(PR_FALSE);
|
Wallet_InitKeySet(PR_FALSE);
|
||||||
key = nsAutoString("");
|
key.SetLength(0);
|
||||||
keyCancel = PR_FALSE;
|
keyCancel = PR_FALSE;
|
||||||
return PR_FALSE;
|
return PR_FALSE;
|
||||||
}
|
}
|
||||||
@ -1739,7 +1739,7 @@ wallet_WriteKeyFile(PRBool useDefaultKey) {
|
|||||||
|
|
||||||
nsOutputFileStream strm2(dirSpec + keyFileName);
|
nsOutputFileStream strm2(dirSpec + keyFileName);
|
||||||
if (!strm2.is_open()) {
|
if (!strm2.is_open()) {
|
||||||
key = nsAutoString("");
|
key.SetLength(0);
|
||||||
keyCancel = PR_TRUE;
|
keyCancel = PR_TRUE;
|
||||||
return PR_FALSE;
|
return PR_FALSE;
|
||||||
}
|
}
|
||||||
@ -1814,7 +1814,7 @@ Wallet_SetKey(PRBool isNewkey) {
|
|||||||
}
|
}
|
||||||
if ((Wallet_KeySize() == 0) && !isNewkey) { /* prev-established key is default key */
|
if ((Wallet_KeySize() == 0) && !isNewkey) { /* prev-established key is default key */
|
||||||
useDefaultKey = PR_TRUE;
|
useDefaultKey = PR_TRUE;
|
||||||
newkey = nsAutoString("~");
|
newkey.AssignWithConversion("~");
|
||||||
} else { /* ask the user for his key */
|
} else { /* ask the user for his key */
|
||||||
if (isNewkey) { /* user is changing his password */
|
if (isNewkey) { /* user is changing his password */
|
||||||
for (;;) {
|
for (;;) {
|
||||||
@ -1854,7 +1854,7 @@ Wallet_SetKey(PRBool isNewkey) {
|
|||||||
if ((Wallet_KeySize() < 0) || isNewkey ){
|
if ((Wallet_KeySize() < 0) || isNewkey ){
|
||||||
/* no key file existed before or using is changing the key */
|
/* no key file existed before or using is changing the key */
|
||||||
useDefaultKey = PR_TRUE;
|
useDefaultKey = PR_TRUE;
|
||||||
newkey = nsAutoString("~"); /* use zero-length key */
|
newkey.AssignWithConversion("~"); /* use zero-length key */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Wallet_InitKeySet(PR_TRUE);
|
Wallet_InitKeySet(PR_TRUE);
|
||||||
@ -1895,7 +1895,7 @@ wallet_GetLine(nsInputFileStream strm, nsAutoString& line, PRBool obscure,
|
|||||||
nsKeyType saveCount = 0, nsKeyType *readCount = 0, PRBool inHeader = PR_FALSE) {
|
nsKeyType saveCount = 0, nsKeyType *readCount = 0, PRBool inHeader = PR_FALSE) {
|
||||||
|
|
||||||
/* read the line */
|
/* read the line */
|
||||||
line = "";
|
line.SetLength(0);
|
||||||
PRUnichar c;
|
PRUnichar c;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
if (inHeader) {
|
if (inHeader) {
|
||||||
@ -1932,7 +1932,7 @@ wallet_GetHeader(nsInputFileStream strm, nsKeyType& saveCount, nsKeyType& readCo
|
|||||||
if (NS_FAILED(wallet_GetLine(strm, format, PR_FALSE, 0, 0, PR_TRUE))) {
|
if (NS_FAILED(wallet_GetLine(strm, format, PR_FALSE, 0, 0, PR_TRUE))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!format.Equals(HEADER_VERSION_1)) {
|
if (!format.EqualsWithConversion(HEADER_VERSION_1)) {
|
||||||
/* something's wrong */
|
/* something's wrong */
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1987,18 +1987,21 @@ void
|
|||||||
wallet_PutHeader(nsOutputFileStream strm, nsKeyType saveCount, nsKeyType writeCount){
|
wallet_PutHeader(nsOutputFileStream strm, nsKeyType saveCount, nsKeyType writeCount){
|
||||||
|
|
||||||
/* format revision number */
|
/* format revision number */
|
||||||
wallet_PutLine(strm, nsAutoString(HEADER_VERSION_1), PR_FALSE, 0, 0, PR_TRUE);
|
{
|
||||||
|
nsAutoString temp1;
|
||||||
|
temp1.AssignWithConversion(HEADER_VERSION_1);
|
||||||
|
wallet_PutLine(strm, temp1, PR_FALSE, 0, 0, PR_TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
/* saveCount */
|
/* saveCount */
|
||||||
nsAutoString buffer;
|
nsAutoString buffer;
|
||||||
buffer = "";
|
buffer.AppendWithConversion(PRInt32(saveCount),10);
|
||||||
buffer.Append(PRInt32(saveCount),10);
|
|
||||||
wallet_PutLine(strm, buffer, PR_FALSE, 0, 0, PR_TRUE);
|
wallet_PutLine(strm, buffer, PR_FALSE, 0, 0, PR_TRUE);
|
||||||
wallet_PutLine(strm, buffer, PR_FALSE, 0, 0, PR_TRUE);
|
wallet_PutLine(strm, buffer, PR_FALSE, 0, 0, PR_TRUE);
|
||||||
|
|
||||||
/* writeCount */
|
/* writeCount */
|
||||||
buffer = "";
|
buffer.SetLength(0);
|
||||||
buffer.Append(PRInt32(writeCount),10);
|
buffer.AppendWithConversion(PRInt32(writeCount),10);
|
||||||
wallet_PutLine(strm, buffer, PR_FALSE, 0, 0, PR_TRUE);
|
wallet_PutLine(strm, buffer, PR_FALSE, 0, 0, PR_TRUE);
|
||||||
wallet_PutLine(strm, buffer, PR_FALSE, 0, 0, PR_TRUE);
|
wallet_PutLine(strm, buffer, PR_FALSE, 0, 0, PR_TRUE);
|
||||||
|
|
||||||
@ -2056,7 +2059,7 @@ wallet_WriteToFile(const char * filename, nsVoidArray* list, PRBool obscure) {
|
|||||||
wallet_PutLine(strm, (*ptr1).item, obscure, saveCountW, &writeCount);
|
wallet_PutLine(strm, (*ptr1).item, obscure, saveCountW, &writeCount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
wallet_PutLine(strm, "", obscure, saveCountW, &writeCount);
|
wallet_PutLine(strm, nsAutoString(), obscure, saveCountW, &writeCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* close the stream */
|
/* close the stream */
|
||||||
@ -2151,7 +2154,7 @@ wallet_ReadFromFile
|
|||||||
nsAutoString dummy2;
|
nsAutoString dummy2;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
/* get next item for sublist */
|
/* get next item for sublist */
|
||||||
item3 = "";
|
item3.SetLength(0);
|
||||||
if (NS_FAILED(wallet_GetLine(strm, item3, obscure, saveCountW, &readCount))) {
|
if (NS_FAILED(wallet_GetLine(strm, item3, obscure, saveCountW, &readCount))) {
|
||||||
/* end of file reached */
|
/* end of file reached */
|
||||||
wallet_WriteToList(item1, dummy2, itemList, list, placement);
|
wallet_WriteToList(item1, dummy2, itemList, list, placement);
|
||||||
@ -2221,7 +2224,7 @@ wallet_ReadFromURLFieldToSchemaFile
|
|||||||
if (!itemList) {
|
if (!itemList) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
nsAutoString dummyString = nsAutoString("");
|
nsAutoString dummyString;
|
||||||
wallet_WriteToList(item, dummyString, itemList, list, placement);
|
wallet_WriteToList(item, dummyString, itemList, list, placement);
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
@ -2267,20 +2270,20 @@ wallet_ReadFromURLFieldToSchemaFile
|
|||||||
|
|
||||||
nsAutoString
|
nsAutoString
|
||||||
wallet_GetHostFile(nsIURI * url) {
|
wallet_GetHostFile(nsIURI * url) {
|
||||||
nsAutoString urlName("");
|
nsAutoString urlName;
|
||||||
char* host;
|
char* host;
|
||||||
nsresult rv = url->GetHost(&host);
|
nsresult rv = url->GetHost(&host);
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
return nsAutoString("");
|
return nsAutoString();
|
||||||
}
|
}
|
||||||
urlName.Append(host);
|
urlName.AppendWithConversion(host);
|
||||||
nsCRT::free(host);
|
nsCRT::free(host);
|
||||||
char* file;
|
char* file;
|
||||||
rv = url->GetPath(&file);
|
rv = url->GetPath(&file);
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
return nsAutoString("");
|
return nsAutoString();
|
||||||
}
|
}
|
||||||
urlName.Append(file);
|
urlName.AppendWithConversion(file);
|
||||||
nsCRT::free(file);
|
nsCRT::free(file);
|
||||||
return urlName;
|
return urlName;
|
||||||
}
|
}
|
||||||
@ -2322,14 +2325,14 @@ PRInt32 FieldToValue(
|
|||||||
if (wallet_ReadFromList(schema, dummy2, itemList2, wallet_SchemaConcat_list)) {
|
if (wallet_ReadFromList(schema, dummy2, itemList2, wallet_SchemaConcat_list)) {
|
||||||
/* concatenation rules exist, generate value as a concatenation */
|
/* concatenation rules exist, generate value as a concatenation */
|
||||||
wallet_Sublist * ptr1;
|
wallet_Sublist * ptr1;
|
||||||
value = nsAutoString("");
|
value.SetLength(0);
|
||||||
nsAutoString value2;
|
nsAutoString value2;
|
||||||
PRInt32 count = LIST_COUNT(itemList2);
|
PRInt32 count = LIST_COUNT(itemList2);
|
||||||
for (PRInt32 i=0; i<count; i++) {
|
for (PRInt32 i=0; i<count; i++) {
|
||||||
ptr1 = NS_STATIC_CAST(wallet_Sublist*, itemList2->ElementAt(i));
|
ptr1 = NS_STATIC_CAST(wallet_Sublist*, itemList2->ElementAt(i));
|
||||||
if (wallet_ReadFromList(ptr1->item, value2, dummy, wallet_SchemaToValue_list)) {
|
if (wallet_ReadFromList(ptr1->item, value2, dummy, wallet_SchemaToValue_list)) {
|
||||||
if (value.Length()>0) {
|
if (value.Length()>0) {
|
||||||
value += " ";
|
value.AppendWithConversion(" ");
|
||||||
}
|
}
|
||||||
value += value2;
|
value += value2;
|
||||||
}
|
}
|
||||||
@ -2346,7 +2349,7 @@ PRInt32 FieldToValue(
|
|||||||
PRInt32 index2 = index;
|
PRInt32 index2 = index;
|
||||||
|
|
||||||
nsAutoString temp = wallet_GetHostFile(wallet_lastUrl);
|
nsAutoString temp = wallet_GetHostFile(wallet_lastUrl);
|
||||||
temp.Append(":");
|
temp.AppendWithConversion(":");
|
||||||
temp.Append(field);
|
temp.Append(field);
|
||||||
|
|
||||||
if (wallet_ReadFromList(temp, value, itemList, wallet_SchemaToValue_list, index2)) {
|
if (wallet_ReadFromList(temp, value, itemList, wallet_SchemaToValue_list, index2)) {
|
||||||
@ -2416,11 +2419,11 @@ wallet_GetPrefills(
|
|||||||
if ((NS_SUCCEEDED(result)) && (nsnull != inputElement)) {
|
if ((NS_SUCCEEDED(result)) && (nsnull != inputElement)) {
|
||||||
nsAutoString type;
|
nsAutoString type;
|
||||||
result = inputElement->GetType(type);
|
result = inputElement->GetType(type);
|
||||||
if ((NS_SUCCEEDED(result)) && ((type.IsEmpty()) || (type.Compare("text", PR_TRUE) == 0))) {
|
if ((NS_SUCCEEDED(result)) && ((type.IsEmpty()) || (type.CompareWithConversion("text", PR_TRUE) == 0))) {
|
||||||
nsAutoString field;
|
nsAutoString field;
|
||||||
result = inputElement->GetName(field);
|
result = inputElement->GetName(field);
|
||||||
if (NS_SUCCEEDED(result)) {
|
if (NS_SUCCEEDED(result)) {
|
||||||
nsAutoString schema("");
|
nsAutoString schema;
|
||||||
nsAutoString value;
|
nsAutoString value;
|
||||||
nsVoidArray* itemList;
|
nsVoidArray* itemList;
|
||||||
|
|
||||||
@ -2428,7 +2431,7 @@ wallet_GetPrefills(
|
|||||||
nsIDOMElement * element;
|
nsIDOMElement * element;
|
||||||
result = elementNode->QueryInterface(kIDOMElementIID, (void**)&element);
|
result = elementNode->QueryInterface(kIDOMElementIID, (void**)&element);
|
||||||
if ((NS_SUCCEEDED(result)) && (nsnull != element)) {
|
if ((NS_SUCCEEDED(result)) && (nsnull != element)) {
|
||||||
nsAutoString vcard("VCARD_NAME");
|
nsAutoString vcard; vcard.AssignWithConversion("VCARD_NAME");
|
||||||
result = element->GetAttribute(vcard, schema);
|
result = element->GetAttribute(vcard, schema);
|
||||||
NS_RELEASE(element);
|
NS_RELEASE(element);
|
||||||
}
|
}
|
||||||
@ -2469,7 +2472,7 @@ wallet_GetPrefills(
|
|||||||
nsAutoString field;
|
nsAutoString field;
|
||||||
result = selectElement->GetName(field);
|
result = selectElement->GetName(field);
|
||||||
if (NS_SUCCEEDED(result)) {
|
if (NS_SUCCEEDED(result)) {
|
||||||
nsAutoString schema("");
|
nsAutoString schema;
|
||||||
nsAutoString value;
|
nsAutoString value;
|
||||||
nsVoidArray* itemList;
|
nsVoidArray* itemList;
|
||||||
if (FieldToValue(field, schema, value, itemList, index) == 0) {
|
if (FieldToValue(field, schema, value, itemList, index) == 0) {
|
||||||
@ -2761,7 +2764,7 @@ wallet_FetchFromNetCenter() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
buffer.StripWhitespace();
|
buffer.StripWhitespace();
|
||||||
if (buffer.Equals(version)) {
|
if (buffer.EqualsWithConversion(version)) {
|
||||||
/* This is an optimization but we are skipping it for now. If the user's tables
|
/* This is an optimization but we are skipping it for now. If the user's tables
|
||||||
* become corrupt but his version number indicates that he is up to date, there
|
* become corrupt but his version number indicates that he is up to date, there
|
||||||
* would be no obvious way for him to restore the tables. If we did the optimization
|
* would be no obvious way for him to restore the tables. If we did the optimization
|
||||||
@ -3043,7 +3046,7 @@ PUBLIC void
|
|||||||
WLLT_GetPrefillListForViewer(nsAutoString& aPrefillList)
|
WLLT_GetPrefillListForViewer(nsAutoString& aPrefillList)
|
||||||
{
|
{
|
||||||
wallet_PrefillElement * ptr;
|
wallet_PrefillElement * ptr;
|
||||||
nsAutoString buffer = "";
|
nsAutoString buffer;
|
||||||
PRUnichar * schema;
|
PRUnichar * schema;
|
||||||
PRUnichar * value;
|
PRUnichar * value;
|
||||||
PRInt32 count = LIST_COUNT(wallet_list);
|
PRInt32 count = LIST_COUNT(wallet_list);
|
||||||
@ -3052,7 +3055,7 @@ WLLT_GetPrefillListForViewer(nsAutoString& aPrefillList)
|
|||||||
schema = ptr->schema->ToNewUnicode();
|
schema = ptr->schema->ToNewUnicode();
|
||||||
value = ptr->value->ToNewUnicode();
|
value = ptr->value->ToNewUnicode();
|
||||||
buffer += BREAK;
|
buffer += BREAK;
|
||||||
buffer.Append(ptr->count,10);
|
buffer.AppendWithConversion(ptr->count,10);
|
||||||
buffer += BREAK;
|
buffer += BREAK;
|
||||||
buffer += schema;
|
buffer += schema;
|
||||||
buffer += BREAK;
|
buffer += BREAK;
|
||||||
@ -3093,7 +3096,10 @@ Wallet_SignonViewerReturn (nsAutoString results) {
|
|||||||
nsAutoString gone;
|
nsAutoString gone;
|
||||||
|
|
||||||
/* step through all nopreviews and delete those that are in the sequence */
|
/* step through all nopreviews and delete those that are in the sequence */
|
||||||
gone = SI_FindValueInArgs(results, nsAutoString("|goneP|"));
|
{
|
||||||
|
nsAutoString temp1; temp1.AssignWithConversion("|goneP|");
|
||||||
|
gone = SI_FindValueInArgs(results, temp1);
|
||||||
|
}
|
||||||
PRInt32 count = LIST_COUNT(wallet_URL_list);
|
PRInt32 count = LIST_COUNT(wallet_URL_list);
|
||||||
while (count>0) {
|
while (count>0) {
|
||||||
count--;
|
count--;
|
||||||
@ -3108,7 +3114,10 @@ Wallet_SignonViewerReturn (nsAutoString results) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* step through all nocaptures and delete those that are in the sequence */
|
/* step through all nocaptures and delete those that are in the sequence */
|
||||||
gone = SI_FindValueInArgs(results, nsAutoString("|goneC|"));
|
{
|
||||||
|
nsAutoString temp2; temp2.AssignWithConversion("|goneC|");
|
||||||
|
gone = SI_FindValueInArgs(results, temp2);
|
||||||
|
}
|
||||||
PRInt32 count2 = LIST_COUNT(wallet_URL_list);
|
PRInt32 count2 = LIST_COUNT(wallet_URL_list);
|
||||||
while (count2>0) {
|
while (count2>0) {
|
||||||
count2--;
|
count2--;
|
||||||
@ -3129,7 +3138,7 @@ Wallet_SignonViewerReturn (nsAutoString results) {
|
|||||||
*/
|
*/
|
||||||
PRIVATE PRBool
|
PRIVATE PRBool
|
||||||
wallet_OKToCapture(char* urlName) {
|
wallet_OKToCapture(char* urlName) {
|
||||||
nsAutoString url = nsAutoString(urlName);
|
nsAutoString url; url.AssignWithConversion(urlName);
|
||||||
|
|
||||||
/* exit if pref is not set */
|
/* exit if pref is not set */
|
||||||
if (!wallet_GetFormsCapturingPref() || !wallet_GetEnabledPref()) {
|
if (!wallet_GetFormsCapturingPref() || !wallet_GetEnabledPref()) {
|
||||||
@ -3139,7 +3148,7 @@ wallet_OKToCapture(char* urlName) {
|
|||||||
/* see if this url is already on list of url's for which we don't want to capture */
|
/* see if this url is already on list of url's for which we don't want to capture */
|
||||||
wallet_InitializeURLList();
|
wallet_InitializeURLList();
|
||||||
nsVoidArray* dummy;
|
nsVoidArray* dummy;
|
||||||
nsAutoString value = nsAutoString("nn");
|
nsAutoString value; value.AssignWithConversion("nn");
|
||||||
if (wallet_ReadFromList(url, value, dummy, wallet_URL_list)) {
|
if (wallet_ReadFromList(url, value, dummy, wallet_URL_list)) {
|
||||||
if (value.CharAt(NO_CAPTURE) == 'y') {
|
if (value.CharAt(NO_CAPTURE) == 'y') {
|
||||||
return PR_FALSE;
|
return PR_FALSE;
|
||||||
@ -3232,7 +3241,7 @@ wallet_Capture(nsIDocument* doc, nsAutoString field, nsAutoString value, nsAutoS
|
|||||||
PRInt32 lastIndex = index;
|
PRInt32 lastIndex = index;
|
||||||
|
|
||||||
nsAutoString concat_param = wallet_GetHostFile(wallet_lastUrl);
|
nsAutoString concat_param = wallet_GetHostFile(wallet_lastUrl);
|
||||||
concat_param.Append(":");
|
concat_param.AppendWithConversion(":");
|
||||||
concat_param.Append(field);
|
concat_param.Append(field);
|
||||||
|
|
||||||
while(wallet_ReadFromList(concat_param, oldValue, dummy, wallet_SchemaToValue_list, index)) {
|
while(wallet_ReadFromList(concat_param, oldValue, dummy, wallet_SchemaToValue_list, index)) {
|
||||||
@ -3257,14 +3266,14 @@ wallet_Capture(nsIDocument* doc, nsAutoString field, nsAutoString value, nsAutoS
|
|||||||
lastIndex = index;
|
lastIndex = index;
|
||||||
|
|
||||||
concat_param = wallet_GetHostFile(wallet_lastUrl);
|
concat_param = wallet_GetHostFile(wallet_lastUrl);
|
||||||
concat_param.Append(":");
|
concat_param.AppendWithConversion(":");
|
||||||
concat_param.Append(field);
|
concat_param.Append(field);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* this is a new value so store it */
|
/* this is a new value so store it */
|
||||||
dummy = 0;
|
dummy = 0;
|
||||||
nsAutoString hostFileField = wallet_GetHostFile(wallet_lastUrl);
|
nsAutoString hostFileField = wallet_GetHostFile(wallet_lastUrl);
|
||||||
hostFileField.Append(":");
|
hostFileField.AppendWithConversion(":");
|
||||||
hostFileField.Append(field);
|
hostFileField.Append(field);
|
||||||
|
|
||||||
wallet_WriteToList(hostFileField, value, dummy, wallet_SchemaToValue_list);
|
wallet_WriteToList(hostFileField, value, dummy, wallet_SchemaToValue_list);
|
||||||
@ -3282,7 +3291,7 @@ wallet_Capture(nsIDocument* doc, nsAutoString field, nsAutoString value, nsAutoS
|
|||||||
PUBLIC void
|
PUBLIC void
|
||||||
WLLT_GetNopreviewListForViewer(nsAutoString& aNopreviewList)
|
WLLT_GetNopreviewListForViewer(nsAutoString& aNopreviewList)
|
||||||
{
|
{
|
||||||
nsAutoString buffer = "";
|
nsAutoString buffer;
|
||||||
int nopreviewNum = 0;
|
int nopreviewNum = 0;
|
||||||
wallet_MapElement *url;
|
wallet_MapElement *url;
|
||||||
|
|
||||||
@ -3292,11 +3301,11 @@ WLLT_GetNopreviewListForViewer(nsAutoString& aNopreviewList)
|
|||||||
url = NS_STATIC_CAST(wallet_MapElement*, wallet_URL_list->ElementAt(i));
|
url = NS_STATIC_CAST(wallet_MapElement*, wallet_URL_list->ElementAt(i));
|
||||||
if (url->item2.CharAt(NO_PREVIEW) == 'y') {
|
if (url->item2.CharAt(NO_PREVIEW) == 'y') {
|
||||||
buffer += BREAK;
|
buffer += BREAK;
|
||||||
buffer += "<OPTION value=";
|
buffer.AppendWithConversion("<OPTION value=");
|
||||||
buffer.Append(nopreviewNum, 10);
|
buffer.AppendWithConversion(nopreviewNum, 10);
|
||||||
buffer += ">";
|
buffer.AppendWithConversion(">");
|
||||||
buffer += url->item1;
|
buffer += url->item1;
|
||||||
buffer += "</OPTION>\n";
|
buffer.AppendWithConversion("</OPTION>\n");
|
||||||
nopreviewNum++;
|
nopreviewNum++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3306,7 +3315,7 @@ WLLT_GetNopreviewListForViewer(nsAutoString& aNopreviewList)
|
|||||||
PUBLIC void
|
PUBLIC void
|
||||||
WLLT_GetNocaptureListForViewer(nsAutoString& aNocaptureList)
|
WLLT_GetNocaptureListForViewer(nsAutoString& aNocaptureList)
|
||||||
{
|
{
|
||||||
nsAutoString buffer = "";
|
nsAutoString buffer;
|
||||||
int nocaptureNum = 0;
|
int nocaptureNum = 0;
|
||||||
wallet_MapElement *url;
|
wallet_MapElement *url;
|
||||||
|
|
||||||
@ -3316,11 +3325,11 @@ WLLT_GetNocaptureListForViewer(nsAutoString& aNocaptureList)
|
|||||||
url = NS_STATIC_CAST(wallet_MapElement*, wallet_URL_list->ElementAt(i));
|
url = NS_STATIC_CAST(wallet_MapElement*, wallet_URL_list->ElementAt(i));
|
||||||
if (url->item2.CharAt(NO_CAPTURE) == 'y') {
|
if (url->item2.CharAt(NO_CAPTURE) == 'y') {
|
||||||
buffer += BREAK;
|
buffer += BREAK;
|
||||||
buffer += "<OPTION value=";
|
buffer.AppendWithConversion("<OPTION value=");
|
||||||
buffer.Append(nocaptureNum, 10);
|
buffer.AppendWithConversion(nocaptureNum, 10);
|
||||||
buffer += ">";
|
buffer.AppendWithConversion(">");
|
||||||
buffer += url->item1;
|
buffer += url->item1;
|
||||||
buffer += "</OPTION>\n";
|
buffer.AppendWithConversion("</OPTION>\n");
|
||||||
nocaptureNum++;
|
nocaptureNum++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3353,7 +3362,7 @@ WLLT_PostEdit(nsAutoString walletList) {
|
|||||||
tail = temp;
|
tail = temp;
|
||||||
|
|
||||||
/* return if OK button was not pressed */
|
/* return if OK button was not pressed */
|
||||||
if (!head.Equals("OK")) {
|
if (!head.EqualsWithConversion("OK")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3426,16 +3435,16 @@ WLLT_PrefillReturn(nsAutoString results) {
|
|||||||
nsAutoString next;
|
nsAutoString next;
|
||||||
|
|
||||||
/* get values that are in environment variables */
|
/* get values that are in environment variables */
|
||||||
fillins = SI_FindValueInArgs(results, nsAutoString("|fillins|"));
|
fillins = SI_FindValueInArgs(results, NS_ConvertToString("|fillins|"));
|
||||||
listAsAscii = SI_FindValueInArgs(results, nsAutoString("|list|"));
|
listAsAscii = SI_FindValueInArgs(results, NS_ConvertToString("|list|"));
|
||||||
skip = SI_FindValueInArgs(results, nsAutoString("|skip|"));
|
skip = SI_FindValueInArgs(results, NS_ConvertToString("|skip|"));
|
||||||
urlName = SI_FindValueInArgs(results, nsAutoString("|url|"));
|
urlName = SI_FindValueInArgs(results, NS_ConvertToString("|url|"));
|
||||||
|
|
||||||
/* add url to url list if user doesn't want to preview this page in the future */
|
/* add url to url list if user doesn't want to preview this page in the future */
|
||||||
if (nsAutoString(skip).Equals("true")) {
|
if (nsAutoString(skip).EqualsWithConversion("true")) {
|
||||||
nsAutoString url = nsAutoString(urlName);
|
nsAutoString url = nsAutoString(urlName);
|
||||||
nsVoidArray* dummy;
|
nsVoidArray* dummy;
|
||||||
nsAutoString value = nsAutoString("nn");
|
nsAutoString value; value.AssignWithConversion("nn");
|
||||||
wallet_ReadFromList(url, value, dummy, wallet_URL_list);
|
wallet_ReadFromList(url, value, dummy, wallet_URL_list);
|
||||||
value.SetCharAt('y', NO_PREVIEW);
|
value.SetCharAt('y', NO_PREVIEW);
|
||||||
wallet_WriteToList(url, value, dummy, wallet_URL_list, DUP_OVERWRITE);
|
wallet_WriteToList(url, value, dummy, wallet_URL_list, DUP_OVERWRITE);
|
||||||
@ -3543,7 +3552,7 @@ WLLT_PrefillReturn(nsAutoString results) {
|
|||||||
*/
|
*/
|
||||||
PUBLIC nsresult
|
PUBLIC nsresult
|
||||||
WLLT_Prefill(nsIPresShell* shell, PRBool quick) {
|
WLLT_Prefill(nsIPresShell* shell, PRBool quick) {
|
||||||
nsAutoString urlName = nsAutoString("");
|
nsAutoString urlName;
|
||||||
|
|
||||||
/* create list of elements that can be prefilled */
|
/* create list of elements that can be prefilled */
|
||||||
nsVoidArray *wallet_PrefillElement_list=new nsVoidArray();
|
nsVoidArray *wallet_PrefillElement_list=new nsVoidArray();
|
||||||
@ -3668,7 +3677,7 @@ WLLT_Prefill(nsIPresShell* shell, PRBool quick) {
|
|||||||
if (!quick) {
|
if (!quick) {
|
||||||
wallet_InitializeURLList();
|
wallet_InitializeURLList();
|
||||||
nsVoidArray* dummy;
|
nsVoidArray* dummy;
|
||||||
nsAutoString value = nsAutoString("nn");
|
nsAutoString value; value.AssignWithConversion("nn");
|
||||||
if (urlName.Length() != 0) {
|
if (urlName.Length() != 0) {
|
||||||
wallet_ReadFromList(urlName, value, dummy, wallet_URL_list);
|
wallet_ReadFromList(urlName, value, dummy, wallet_URL_list);
|
||||||
noPreview = (value.CharAt(NO_PREVIEW) == 'y');
|
noPreview = (value.CharAt(NO_PREVIEW) == 'y');
|
||||||
@ -3760,7 +3769,7 @@ WLLT_RequestToCapture(nsIPresShell* shell) {
|
|||||||
nsAutoString type;
|
nsAutoString type;
|
||||||
result = inputElement->GetType(type);
|
result = inputElement->GetType(type);
|
||||||
if ((NS_SUCCEEDED(result)) &&
|
if ((NS_SUCCEEDED(result)) &&
|
||||||
(type.IsEmpty() || (type.Compare("text", PR_TRUE) == 0))) {
|
(type.IsEmpty() || (type.CompareWithConversion("text", PR_TRUE) == 0))) {
|
||||||
nsAutoString field;
|
nsAutoString field;
|
||||||
result = inputElement->GetName(field);
|
result = inputElement->GetName(field);
|
||||||
if (NS_SUCCEEDED(result)) {
|
if (NS_SUCCEEDED(result)) {
|
||||||
@ -3769,11 +3778,11 @@ WLLT_RequestToCapture(nsIPresShell* shell) {
|
|||||||
if (NS_SUCCEEDED(result)) {
|
if (NS_SUCCEEDED(result)) {
|
||||||
|
|
||||||
/* get schema name from vcard attribute if it exists */
|
/* get schema name from vcard attribute if it exists */
|
||||||
nsAutoString vcardValue("");
|
nsAutoString vcardValue;
|
||||||
nsIDOMElement * element;
|
nsIDOMElement * element;
|
||||||
result = elementNode->QueryInterface(kIDOMElementIID, (void**)&element);
|
result = elementNode->QueryInterface(kIDOMElementIID, (void**)&element);
|
||||||
if ((NS_SUCCEEDED(result)) && (nsnull != element)) {
|
if ((NS_SUCCEEDED(result)) && (nsnull != element)) {
|
||||||
nsAutoString vcardName("VCARD_NAME");
|
nsAutoString vcardName; vcardName.AssignWithConversion("VCARD_NAME");
|
||||||
result = element->GetAttribute(vcardName, vcardValue);
|
result = element->GetAttribute(vcardName, vcardValue);
|
||||||
NS_RELEASE(element);
|
NS_RELEASE(element);
|
||||||
}
|
}
|
||||||
@ -3805,7 +3814,7 @@ WLLT_RequestToCapture(nsIPresShell* shell) {
|
|||||||
/* should move this to an include file */
|
/* should move this to an include file */
|
||||||
class si_SignonDataStruct {
|
class si_SignonDataStruct {
|
||||||
public:
|
public:
|
||||||
si_SignonDataStruct() : name(""), value(""), isPassword(PR_FALSE) {}
|
si_SignonDataStruct() : isPassword(PR_FALSE) {}
|
||||||
nsAutoString name;
|
nsAutoString name;
|
||||||
nsAutoString value;
|
nsAutoString value;
|
||||||
PRBool isPassword;
|
PRBool isPassword;
|
||||||
@ -3872,12 +3881,12 @@ WLLT_OnSubmit(nsIContent* currentForm) {
|
|||||||
if (nsnull != elementNode) {
|
if (nsnull != elementNode) {
|
||||||
nsCOMPtr<nsIDOMHTMLInputElement> inputElement(do_QueryInterface(elementNode));
|
nsCOMPtr<nsIDOMHTMLInputElement> inputElement(do_QueryInterface(elementNode));
|
||||||
if ((NS_SUCCEEDED(rv)) && (nsnull != inputElement)) {
|
if ((NS_SUCCEEDED(rv)) && (nsnull != inputElement)) {
|
||||||
nsAutoString type("");
|
nsAutoString type;
|
||||||
rv = inputElement->GetType(type);
|
rv = inputElement->GetType(type);
|
||||||
if (NS_SUCCEEDED(rv)) {
|
if (NS_SUCCEEDED(rv)) {
|
||||||
|
|
||||||
PRBool isText = (type.IsEmpty() || (type.Compare("text", PR_TRUE)==0));
|
PRBool isText = (type.IsEmpty() || (type.CompareWithConversion("text", PR_TRUE)==0));
|
||||||
PRBool isPassword = (type.Compare("password", PR_TRUE)==0);
|
PRBool isPassword = (type.CompareWithConversion("password", PR_TRUE)==0);
|
||||||
#ifndef AutoCapture
|
#ifndef AutoCapture
|
||||||
if (isText) {
|
if (isText) {
|
||||||
fieldcount++;
|
fieldcount++;
|
||||||
@ -3981,7 +3990,7 @@ WLLT_OnSubmit(nsIContent* currentForm) {
|
|||||||
nsAutoString type;
|
nsAutoString type;
|
||||||
rv = inputElement->GetType(type);
|
rv = inputElement->GetType(type);
|
||||||
if ((NS_SUCCEEDED(rv)) &&
|
if ((NS_SUCCEEDED(rv)) &&
|
||||||
(type.IsEmpty() || (type.Compare("text", PR_TRUE) == 0))) {
|
(type.IsEmpty() || (type.CompareWithConversion("text", PR_TRUE) == 0))) {
|
||||||
nsAutoString field;
|
nsAutoString field;
|
||||||
rv = inputElement->GetName(field);
|
rv = inputElement->GetName(field);
|
||||||
if (NS_SUCCEEDED(rv)) {
|
if (NS_SUCCEEDED(rv)) {
|
||||||
@ -3990,11 +3999,11 @@ WLLT_OnSubmit(nsIContent* currentForm) {
|
|||||||
if (NS_SUCCEEDED(rv)) {
|
if (NS_SUCCEEDED(rv)) {
|
||||||
|
|
||||||
/* get schema name from vcard attribute if it exists */
|
/* get schema name from vcard attribute if it exists */
|
||||||
nsAutoString vcardValue("");
|
nsAutoString vcardValue;
|
||||||
nsIDOMElement * element;
|
nsIDOMElement * element;
|
||||||
rv = elementNode->QueryInterface(kIDOMElementIID, (void**)&element);
|
rv = elementNode->QueryInterface(kIDOMElementIID, (void**)&element);
|
||||||
if ((NS_SUCCEEDED(rv)) && (nsnull != element)) {
|
if ((NS_SUCCEEDED(rv)) && (nsnull != element)) {
|
||||||
nsAutoString vcardName("VCARD_NAME");
|
nsAutoString vcardName; vcardName.AssignWithConversion("VCARD_NAME");
|
||||||
rv = element->GetAttribute(vcardName, vcardValue);
|
rv = element->GetAttribute(vcardName, vcardValue);
|
||||||
NS_RELEASE(element);
|
NS_RELEASE(element);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user