Remove wallet from layout
git-svn-id: svn://10.0.0.236/trunk@40944 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -48,9 +48,6 @@ struct nsIWalletService : public nsISupports
|
||||
NS_IMETHOD WALLET_PostEdit(nsAutoString walletList) = 0;
|
||||
NS_IMETHOD WALLET_ChangePassword() = 0;
|
||||
NS_IMETHOD WALLET_Prefill(nsIPresShell* shell, nsString url, PRBool quick) = 0;
|
||||
NS_IMETHOD WALLET_Capture
|
||||
(nsIDocument* doc, nsString name, nsString value, nsString vcard) = 0;
|
||||
NS_IMETHOD WALLET_OKToCapture(PRBool* result, PRInt32 count, char* URLName) = 0;
|
||||
NS_IMETHOD WALLET_PrefillReturn(nsAutoString results)=0;
|
||||
|
||||
NS_IMETHOD SI_DisplaySignonInfoAsHTML()=0;
|
||||
@@ -60,10 +57,6 @@ struct nsIWalletService : public nsISupports
|
||||
NS_IMETHOD WALLET_GetNopreviewListForViewer(nsString& aNopreviewList)=0;
|
||||
NS_IMETHOD WALLET_GetNocaptureListForViewer(nsString& aNocaptureList)=0;
|
||||
NS_IMETHOD WALLET_GetPrefillListForViewer(nsString& aPrefillList)=0;
|
||||
NS_IMETHOD SI_RememberSignonData
|
||||
(char* URLName, char** name_array, char** value_array, char** type_array, PRInt32 value_cnt) = 0;
|
||||
NS_IMETHOD SI_RestoreSignonData
|
||||
(char* URLNAME, char* name, char** value)=0;
|
||||
|
||||
NS_IMETHOD SI_PromptUsernameAndPassword
|
||||
(char *prompt, char **username, char **password, char *URLName, PRBool &status)=0;
|
||||
|
||||
@@ -110,22 +110,6 @@ NS_IMETHODIMP nsWalletlibService::WALLET_Prefill
|
||||
return ::WLLT_Prefill(shell, url, quick);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWalletlibService::WALLET_OKToCapture
|
||||
(PRBool* result, PRInt32 count, char* URLName) {
|
||||
// ::WLLT_OKToCapture(result, count, URLName);
|
||||
*result = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWalletlibService::WALLET_Capture(
|
||||
nsIDocument* doc,
|
||||
nsString name,
|
||||
nsString value,
|
||||
nsString vcard) {
|
||||
// ::WLLT_Capture(doc, name, value, vcard);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWalletlibService::WALLET_PrefillReturn(nsAutoString results){
|
||||
::WLLT_PrefillReturn(results);
|
||||
return NS_OK;
|
||||
@@ -166,18 +150,6 @@ NS_IMETHODIMP nsWalletlibService::WALLET_GetPrefillListForViewer(nsString& aPref
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWalletlibService::SI_RememberSignonData
|
||||
(char* URLName, char** name_array, char** value_array, char** type_array, PRInt32 value_cnt) {
|
||||
// ::SINGSIGN_RememberSignonData(URLName, name_array, value_array, type_array, value_cnt);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWalletlibService::SI_RestoreSignonData
|
||||
(char* URLName, char* name, char** value) {
|
||||
::SINGSIGN_RestoreSignonData(URLName, name, value);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWalletlibService::SI_PromptUsernameAndPassword
|
||||
(char *prompt, char **username, char **password, char *URLName, PRBool &status) {
|
||||
status = ::SINGSIGN_PromptUsernameAndPassword(prompt, username, password, URLName);
|
||||
@@ -244,6 +216,8 @@ nsWalletlibService::OnStartDocumentLoad(nsIDocumentLoader* aLoader, nsIURI* aURL
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
#include "prmem.h"
|
||||
|
||||
NS_IMETHODIMP
|
||||
#ifdef NECKO
|
||||
nsWalletlibService::OnEndDocumentLoad(nsIDocumentLoader* aLoader, nsIChannel* channel, PRInt32 aStatus,
|
||||
@@ -254,151 +228,156 @@ nsWalletlibService::OnEndDocumentLoad(nsIDocumentLoader* aLoader, nsIURI *aUrl,
|
||||
#endif
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
nsIContentViewerContainer *cont = nsnull;
|
||||
|
||||
nsIWebShell *ws = nsnull;
|
||||
|
||||
if (aLoader == nsnull) {
|
||||
return rv;
|
||||
return rv;
|
||||
}
|
||||
|
||||
rv = aLoader->GetContainer(&cont);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
if (NS_FAILED(rv) || (cont == nsnull)) {
|
||||
return rv;
|
||||
}
|
||||
if (cont == nsnull) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
rv = cont->QueryInterface(nsIWebShell::GetIID(), (void **)&ws);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_RELEASE(cont);
|
||||
return rv;
|
||||
if (NS_FAILED(rv) || (ws == nsnull)) {
|
||||
NS_RELEASE(cont);
|
||||
return rv;
|
||||
}
|
||||
if (ws == nsnull) {
|
||||
NS_RELEASE(cont);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
nsIContentViewer* cv = nsnull;
|
||||
rv = ws->GetContentViewer(&cv);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_RELEASE(ws);
|
||||
NS_RELEASE(cont);
|
||||
return rv;
|
||||
if (NS_FAILED(rv) || (cv == nsnull)) {
|
||||
NS_RELEASE(ws);
|
||||
NS_RELEASE(cont);
|
||||
return rv;
|
||||
}
|
||||
if (cv == nsnull) {
|
||||
NS_RELEASE(ws);
|
||||
NS_RELEASE(cont);
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsIDocumentViewer* docViewer = nsnull;
|
||||
rv = cv->QueryInterface(nsIDocumentViewer::GetIID(), (void**) &docViewer);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_RELEASE(cv);
|
||||
NS_RELEASE(ws);
|
||||
NS_RELEASE(cont);
|
||||
return rv;
|
||||
if (NS_FAILED(rv) || (docViewer == nsnull)) {
|
||||
NS_RELEASE(cv);
|
||||
NS_RELEASE(ws);
|
||||
NS_RELEASE(cont);
|
||||
return rv;
|
||||
}
|
||||
if (docViewer == nsnull) {
|
||||
NS_RELEASE(cv);
|
||||
NS_RELEASE(ws);
|
||||
NS_RELEASE(cont);
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsIDocument *doc = nsnull;
|
||||
rv = docViewer->GetDocument(doc);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_RELEASE(docViewer);
|
||||
NS_RELEASE(cv);
|
||||
NS_RELEASE(ws);
|
||||
NS_RELEASE(cont);
|
||||
return rv;
|
||||
}
|
||||
if (doc == nsnull) {
|
||||
NS_RELEASE(docViewer);
|
||||
NS_RELEASE(cv);
|
||||
NS_RELEASE(ws);
|
||||
NS_RELEASE(cont);
|
||||
return rv;
|
||||
if (NS_FAILED(rv) || (doc == nsnull)) {
|
||||
NS_RELEASE(docViewer);
|
||||
NS_RELEASE(cv);
|
||||
NS_RELEASE(ws);
|
||||
NS_RELEASE(cont);
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsIURI *docURL = nsnull;
|
||||
docURL = doc->GetDocumentURL();
|
||||
/* get url name as ascii string */
|
||||
char *URLName = nsnull;
|
||||
nsIURI* docURL = nsnull;
|
||||
#ifdef NECKO
|
||||
char* spec;
|
||||
#else
|
||||
const char* spec;
|
||||
#endif
|
||||
while (doc) {
|
||||
docURL = doc->GetDocumentURL();
|
||||
if (nsnull != docURL) {
|
||||
(void)docURL->GetSpec(&spec);
|
||||
if (PL_strcmp(spec, "about:blank")) {
|
||||
break;
|
||||
}
|
||||
#ifdef NECKO
|
||||
nsCRT::free(spec);
|
||||
#endif
|
||||
}
|
||||
//?? doc = nsFormFrame::GetParentHTMLFrameDocument(doc);
|
||||
}
|
||||
if (nsnull != docURL) {
|
||||
URLName = (char*)PR_Malloc(PL_strlen(spec)+1);
|
||||
PL_strcpy(URLName, spec);
|
||||
NS_IF_RELEASE(docURL);
|
||||
}
|
||||
#ifdef NECKO
|
||||
nsCRT::free(spec);
|
||||
#endif
|
||||
|
||||
nsIDOMHTMLDocument *htmldoc = nsnull;
|
||||
rv = doc->QueryInterface(kIDOMHTMLDocumentIID, (void**)&htmldoc);
|
||||
if ((NS_SUCCEEDED(rv)) && (nsnull != htmldoc)) {
|
||||
nsIDOMHTMLCollection* forms = nsnull;
|
||||
rv = htmldoc->GetForms(&forms);
|
||||
if (nsnull != forms) {
|
||||
PRUint32 numForms;
|
||||
forms->GetLength(&numForms);
|
||||
for (PRUint32 formX = 0; formX < numForms; formX++) {
|
||||
nsIDOMNode* formNode = nsnull;
|
||||
forms->Item(formX, &formNode);
|
||||
if (nsnull != formNode) {
|
||||
nsIDOMHTMLFormElement* formElement = nsnull;
|
||||
rv = formNode->QueryInterface(kIDOMHTMLFormElementIID,
|
||||
(void**)&formElement);
|
||||
if ((NS_SUCCEEDED(rv)) && (nsnull != formElement)) {
|
||||
nsIDOMHTMLCollection* elements = nsnull;
|
||||
rv = formElement->GetElements(&elements);
|
||||
if ((NS_SUCCEEDED(rv)) && (nsnull != elements)) {
|
||||
/* got to the form elements at long last */
|
||||
PRUint32 numElements;
|
||||
elements->GetLength(&numElements);
|
||||
for (PRUint32 elementX = 0; elementX < numElements; elementX++) {
|
||||
nsIDOMNode* elementNode = nsnull;
|
||||
elements->Item(elementX, &elementNode);
|
||||
if (nsnull != elementNode) {
|
||||
PRUint16 nodeType;
|
||||
nsIDOMHTMLInputElement *inputElement = nsnull;
|
||||
rv = elementNode->QueryInterface(
|
||||
nsIDOMHTMLInputElement::GetIID(),
|
||||
(void**)&inputElement);
|
||||
if ((NS_SUCCEEDED(rv)) && (nsnull != inputElement)) {
|
||||
nsAutoString type("");
|
||||
rv = inputElement->GetType(type);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
if ((type.Compare("text", PR_TRUE) == 0) ||
|
||||
(type.Compare("password", PR_TRUE) == 0)) {
|
||||
char* t = type.ToNewCString();
|
||||
if (t) {
|
||||
delete[] t;
|
||||
}
|
||||
|
||||
nsAutoString field;
|
||||
rv = inputElement->GetName(field);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
char* f = field.ToNewCString();
|
||||
if (f) {
|
||||
delete[] f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
NS_RELEASE(inputElement);
|
||||
}
|
||||
NS_RELEASE(elementNode);
|
||||
}
|
||||
}
|
||||
NS_RELEASE(elements);
|
||||
}
|
||||
NS_RELEASE(formElement);
|
||||
}
|
||||
NS_RELEASE(formNode);
|
||||
}
|
||||
}
|
||||
NS_RELEASE(forms);
|
||||
}
|
||||
NS_RELEASE(htmldoc);
|
||||
if (NS_FAILED(rv) || (htmldoc == nsnull)) {
|
||||
NS_RELEASE(docViewer);
|
||||
NS_RELEASE(cv);
|
||||
NS_RELEASE(ws);
|
||||
NS_RELEASE(cont);
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsIDOMHTMLCollection* forms = nsnull;
|
||||
rv = htmldoc->GetForms(&forms);
|
||||
if (NS_FAILED(rv) || (forms == nsnull)) {
|
||||
NS_RELEASE(htmldoc);
|
||||
NS_RELEASE(docViewer);
|
||||
NS_RELEASE(cv);
|
||||
NS_RELEASE(ws);
|
||||
NS_RELEASE(cont);
|
||||
return rv;
|
||||
}
|
||||
|
||||
PRUint32 numForms;
|
||||
forms->GetLength(&numForms);
|
||||
for (PRUint32 formX = 0; formX < numForms; formX++) {
|
||||
nsIDOMNode* formNode = nsnull;
|
||||
forms->Item(formX, &formNode);
|
||||
if (nsnull != formNode) {
|
||||
nsIDOMHTMLFormElement* formElement = nsnull;
|
||||
rv = formNode->QueryInterface(kIDOMHTMLFormElementIID,
|
||||
(void**)&formElement);
|
||||
if ((NS_SUCCEEDED(rv)) && (nsnull != formElement)) {
|
||||
nsIDOMHTMLCollection* elements = nsnull;
|
||||
rv = formElement->GetElements(&elements);
|
||||
if ((NS_SUCCEEDED(rv)) && (nsnull != elements)) {
|
||||
/* got to the form elements at long last */
|
||||
PRUint32 numElements;
|
||||
elements->GetLength(&numElements);
|
||||
for (PRUint32 elementX = 0; elementX < numElements; elementX++) {
|
||||
nsIDOMNode* elementNode = nsnull;
|
||||
elements->Item(elementX, &elementNode);
|
||||
if (nsnull != elementNode) {
|
||||
nsIDOMHTMLInputElement *inputElement = nsnull;
|
||||
rv = elementNode->QueryInterface(
|
||||
nsIDOMHTMLInputElement::GetIID(),
|
||||
(void**)&inputElement);
|
||||
if ((NS_SUCCEEDED(rv)) && (nsnull != inputElement)) {
|
||||
nsAutoString type("");
|
||||
rv = inputElement->GetType(type);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
if ((type == "") || (type.Compare("text", PR_TRUE) == 0) ||
|
||||
(type.Compare("password", PR_TRUE) == 0)) {
|
||||
nsAutoString field;
|
||||
rv = inputElement->GetName(field);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
char* nameString = field.ToNewCString();
|
||||
if (nameString) {
|
||||
char* valueString = NULL;
|
||||
SINGSIGN_RestoreSignonData(URLName, nameString, &valueString);
|
||||
nsAutoString value(valueString);
|
||||
rv = inputElement->SetValue(value);
|
||||
delete[] nameString;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
NS_RELEASE(inputElement);
|
||||
}
|
||||
NS_RELEASE(elementNode);
|
||||
}
|
||||
}
|
||||
NS_RELEASE(elements);
|
||||
}
|
||||
NS_RELEASE(formElement);
|
||||
}
|
||||
NS_RELEASE(formNode);
|
||||
}
|
||||
}
|
||||
|
||||
NS_RELEASE(forms);
|
||||
NS_RELEASE(htmldoc);
|
||||
NS_RELEASE(docViewer);
|
||||
NS_RELEASE(cv);
|
||||
NS_RELEASE(ws);
|
||||
|
||||
@@ -39,9 +39,6 @@ public:
|
||||
NS_IMETHOD WALLET_PreEdit(nsAutoString& walletList);
|
||||
NS_IMETHOD WALLET_PostEdit(nsAutoString walletList);
|
||||
NS_IMETHOD WALLET_Prefill(nsIPresShell* shell, nsString url, PRBool quick);
|
||||
NS_IMETHOD WALLET_Capture
|
||||
(nsIDocument* doc, nsString name, nsString value, nsString vcard);
|
||||
NS_IMETHOD WALLET_OKToCapture(PRBool* result, PRInt32 count, char* URLName);
|
||||
NS_IMETHOD WALLET_PrefillReturn(nsAutoString results);
|
||||
|
||||
NS_IMETHOD SI_DisplaySignonInfoAsHTML();
|
||||
@@ -52,10 +49,6 @@ public:
|
||||
NS_IMETHOD WALLET_GetNocaptureListForViewer(nsString& aNocaptureList);
|
||||
NS_IMETHOD WALLET_GetPrefillListForViewer(nsString& aPrefillList);
|
||||
|
||||
NS_IMETHOD SI_RememberSignonData
|
||||
(char* URLName, char** name_array, char** value_array, char** type_array, PRInt32 value_cnt);
|
||||
NS_IMETHOD SI_RestoreSignonData
|
||||
(char* URLNAME, char* name, char** value);
|
||||
NS_IMETHOD SI_PromptUsernameAndPassword
|
||||
(char *prompt, char **username, char **password, char *URLName, PRBool &status);
|
||||
NS_IMETHOD SI_PromptPassword
|
||||
|
||||
@@ -2304,17 +2304,11 @@ si_RemoveAllSignonData() {
|
||||
si_FullyLoaded = FALSE;
|
||||
}
|
||||
|
||||
PUBLIC void
|
||||
SI_RememberSignonData
|
||||
(char* URLName, char** name_array, char** value_array, char** type_array, PRInt32 value_cnt)
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
* Check for a signon submission and remember the data if so
|
||||
*/
|
||||
PUBLIC void
|
||||
SI_RememberSignonData2
|
||||
SI_RememberSignonDat2
|
||||
(char* URLName, char** name_array, char** value_array, char** type_array, PRInt32 value_cnt)
|
||||
{
|
||||
int i, j;
|
||||
|
||||
@@ -43,9 +43,6 @@ SINGSIGN_GetRejectListForViewer (nsString& aRejectList);
|
||||
extern void
|
||||
SINGSIGN_SignonViewerReturn(nsAutoString results);
|
||||
|
||||
extern void
|
||||
SINGSIGN_RememberSignonData(char* URLName, char** name_array, char** value_array, char** type_array, PRInt32 value_cnt);
|
||||
|
||||
extern void
|
||||
SINGSIGN_RestoreSignonData(char* URLName, char* name, char** value);
|
||||
|
||||
@@ -59,6 +56,7 @@ SINGSIGN_PromptPassword (char *prompt, char *URLName, PRBool pickFirstUser);
|
||||
extern char *
|
||||
SINGSIGN_Prompt (char *prompt, char* defaultUsername, char *URLName);
|
||||
|
||||
|
||||
XP_END_PROTOS
|
||||
|
||||
#endif /* !_SINGSIGN_H */
|
||||
|
||||
@@ -2472,135 +2472,12 @@ wallet_ClearStopwatch();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* see if user wants to capture data on current page
|
||||
*/
|
||||
|
||||
PUBLIC void
|
||||
WLLT_OKToCapture(PRBool * result, PRInt32 count, char* urlName) {
|
||||
*result = PR_FALSE;
|
||||
return;
|
||||
nsAutoString * url = new nsAutoString(urlName);
|
||||
// static int level = 0;
|
||||
|
||||
/* see if this url is already on list of url's for which we don't want to capture */
|
||||
wallet_InitializeURLList();
|
||||
XP_List* URL_list = wallet_URL_list;
|
||||
XP_List* dummy;
|
||||
nsAutoString * value = new nsAutoString("nn");
|
||||
if (!url || !value) {
|
||||
*result = PR_FALSE;
|
||||
return;
|
||||
}
|
||||
if (wallet_ReadFromList(*url, *value, dummy, URL_list)) {
|
||||
if (value->CharAt(NO_CAPTURE) == 'y') {
|
||||
*result = PR_FALSE;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// if (level > 0) {
|
||||
// *result = PR_FALSE;
|
||||
// return;
|
||||
// }
|
||||
// level++;
|
||||
|
||||
/* ask user if we should capture the values on this form */
|
||||
if (wallet_GetFormsCapturingPref() && (count>=3)) {
|
||||
char * message = Wallet_Localize("WantToCaptureForm?");
|
||||
char * checkMessage = Wallet_Localize("NeverSave");
|
||||
PRBool checkValue;
|
||||
// PRBool checkValue = PR_FALSE;
|
||||
// *result = Wallet_Confirm(message);
|
||||
*result = Wallet_CheckConfirm(message, checkMessage, &checkValue);
|
||||
if (!(*result)) {
|
||||
if (checkValue) {
|
||||
/* add URL to list with NO_CAPTURE indicator set */
|
||||
value->SetCharAt('y', NO_CAPTURE);
|
||||
wallet_WriteToList(*url, *value, dummy, wallet_URL_list, DUP_OVERWRITE);
|
||||
wallet_WriteToFile("URL.tbl", wallet_URL_list, PR_FALSE);
|
||||
} else {
|
||||
delete url;
|
||||
}
|
||||
}
|
||||
PR_FREEIF(checkMessage);
|
||||
PR_FREEIF(message);
|
||||
} else {
|
||||
*result = PR_FALSE;
|
||||
}
|
||||
// level--;
|
||||
}
|
||||
|
||||
/*
|
||||
* capture the value of a form element
|
||||
*/
|
||||
PUBLIC void
|
||||
WLLT_Capture(nsIDocument* doc, nsString field, nsString value, nsString vcard) {
|
||||
return;
|
||||
/* do nothing if there is no value */
|
||||
if (!value.Length()) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* read in the mappings if they are not already present */
|
||||
if (!vcard.Length()) {
|
||||
wallet_Initialize();
|
||||
wallet_InitializeCurrentURL(doc);
|
||||
if (Wallet_BadKey()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
nsAutoString oldValue;
|
||||
|
||||
/* is there a mapping from this field name to a schema name */
|
||||
nsAutoString schema(vcard);
|
||||
XP_List* FieldToSchema_list = wallet_FieldToSchema_list;
|
||||
XP_List* URLFieldToSchema_list = wallet_specificURLFieldToSchema_list;
|
||||
XP_List* SchemaToValue_list = wallet_SchemaToValue_list;
|
||||
XP_List* dummy;
|
||||
|
||||
if (schema.Length() ||
|
||||
(wallet_ReadFromList(field, schema, dummy, URLFieldToSchema_list)) ||
|
||||
(wallet_ReadFromList(field, schema, dummy, FieldToSchema_list))) {
|
||||
|
||||
/* field to schema mapping already exists */
|
||||
|
||||
/* is this a new value for the schema */
|
||||
if (!(wallet_ReadFromList(schema, oldValue, dummy, SchemaToValue_list)) ||
|
||||
(oldValue != value)) {
|
||||
|
||||
/* this is a new value so store it */
|
||||
nsAutoString * aValue = new nsAutoString(value);
|
||||
nsAutoString * aSchema = new nsAutoString(schema);
|
||||
dummy = 0;
|
||||
wallet_WriteToList(*aSchema, *aValue, dummy, wallet_SchemaToValue_list);
|
||||
wallet_WriteToFile("SchemaValue.tbl", wallet_SchemaToValue_list, PR_TRUE);
|
||||
}
|
||||
} else {
|
||||
|
||||
/* no field to schema mapping so assume schema name is same as field name */
|
||||
|
||||
/* is this a new value for the schema */
|
||||
if (!(wallet_ReadFromList(field, oldValue, dummy, SchemaToValue_list)) ||
|
||||
(oldValue != value)) {
|
||||
|
||||
/* this is a new value so store it */
|
||||
nsAutoString * aField = new nsAutoString(field);
|
||||
nsAutoString * aValue = new nsAutoString(value);
|
||||
dummy = 0;
|
||||
wallet_WriteToList(*aField, *aValue, dummy, wallet_SchemaToValue_list);
|
||||
wallet_WriteToFile("SchemaValue.tbl", wallet_SchemaToValue_list, PR_TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#define FORM_TYPE_TEXT 1
|
||||
#define FORM_TYPE_PASSWORD 7
|
||||
#define MAX_ARRAY_SIZE 500
|
||||
|
||||
extern void
|
||||
SI_RememberSignonData2
|
||||
SI_RememberSignonDat2
|
||||
(char* URLName, char** name_array, char** value_array, char** type_array, PRInt32 value_cnt);
|
||||
|
||||
PUBLIC void
|
||||
@@ -2699,7 +2576,7 @@ WLLT_OnSubmit(nsIContent* formNode) {
|
||||
}
|
||||
|
||||
/* save login if appropriate */
|
||||
SI_RememberSignonData2
|
||||
SI_RememberSignonDat2
|
||||
(URLName, (char**)name_array, (char**)value_array, (char**)type_array, value_cnt);
|
||||
|
||||
/* save form if it meets all necessary conditions */
|
||||
|
||||
@@ -48,12 +48,6 @@ WLLT_PrefillReturn(nsAutoString results);
|
||||
extern nsresult
|
||||
WLLT_Prefill(nsIPresShell* shell, nsString url, PRBool quick);
|
||||
|
||||
extern void
|
||||
WLLT_OKToCapture(PRBool * result, PRInt32 count, char* URLName);
|
||||
|
||||
extern void
|
||||
WLLT_Capture(nsIDocument* doc, nsString name, nsString value, nsString vcard);
|
||||
|
||||
extern void
|
||||
WLLT_GetNopreviewListForViewer (nsString& aNopreviewList);
|
||||
|
||||
|
||||
@@ -46,16 +46,6 @@
|
||||
#include "nsILookAndFeel.h"
|
||||
#include "nsIComponentManager.h"
|
||||
|
||||
#ifdef SingleSignon
|
||||
#include "nsIDocument.h"
|
||||
#include "prmem.h"
|
||||
#include "nsIURL.h"
|
||||
#include "nsIWalletService.h"
|
||||
#include "nsIServiceManager.h"
|
||||
static NS_DEFINE_IID(kIWalletServiceIID, NS_IWALLETSERVICE_IID);
|
||||
static NS_DEFINE_IID(kWalletServiceCID, NS_WALLETSERVICE_CID);
|
||||
#endif
|
||||
|
||||
static NS_DEFINE_IID(kIFormControlIID, NS_IFORMCONTROL_IID);
|
||||
static NS_DEFINE_IID(kTextCID, NS_TEXTFIELD_CID);
|
||||
static NS_DEFINE_IID(kTextAreaCID, NS_TEXTAREA_CID);
|
||||
|
||||
@@ -73,7 +73,6 @@ LINCS= -I$(PUBLIC)\xpcom \
|
||||
-I$(PUBLIC)\pref \
|
||||
-I$(PUBLIC)\editor \
|
||||
-I$(PUBLIC)\netlib \
|
||||
-I$(PUBLIC)\wallet \
|
||||
-I$(PUBLIC)\uconv \
|
||||
-I$(PUBLIC)\rdf \
|
||||
-I..\..\base\src \
|
||||
|
||||
@@ -87,10 +87,6 @@ static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
|
||||
#define SPECIFY_CHARSET_IN_CONTENT_TYPE
|
||||
#define FIX_NON_ASCII_MULTIPART
|
||||
|
||||
#if defined(ClientWallet) || defined(SingleSignon) || defined(CookieManagement)
|
||||
#include "nsIServiceManager.h"
|
||||
#endif
|
||||
|
||||
// GetParentHTMLFrameDocument
|
||||
static NS_DEFINE_IID(kIWebshellIID, NS_IWEB_SHELL_IID);
|
||||
static NS_DEFINE_IID(kIContentViewerContainerIID, NS_ICONTENT_VIEWER_CONTAINER_IID);
|
||||
@@ -98,30 +94,6 @@ static NS_DEFINE_IID(kIDocumentViewerIID, NS_IDOCUMENT_VIEWER_IID);
|
||||
|
||||
static NS_DEFINE_CID(kCharsetConverterManagerCID, NS_ICHARSETCONVERTERMANAGER_CID);
|
||||
|
||||
#ifdef SingleSignon
|
||||
#define FORM_TYPE_TEXT 1
|
||||
#define FORM_TYPE_PASSWORD 7
|
||||
#endif
|
||||
|
||||
#if defined(ClientWallet) || defined(SingleSignon)
|
||||
#include "nsIWalletService.h"
|
||||
static NS_DEFINE_IID(kIWalletServiceIID, NS_IWALLETSERVICE_IID);
|
||||
static NS_DEFINE_IID(kWalletServiceCID, NS_WALLETSERVICE_CID);
|
||||
#endif
|
||||
|
||||
#if defined(CookieManagement)
|
||||
|
||||
#ifndef NECKO
|
||||
#include "nsINetService.h"
|
||||
static NS_DEFINE_IID(kINetServiceIID, NS_INETSERVICE_IID);
|
||||
static NS_DEFINE_IID(kNetServiceCID, NS_NETSERVICE_CID);
|
||||
#else
|
||||
#include "nsIURL.h"
|
||||
#endif // NECKO
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
static NS_DEFINE_IID(kIFormManagerIID, NS_IFORMMANAGER_IID);
|
||||
@@ -708,34 +680,6 @@ NS_IMETHODIMP nsFormFrame::GetEncoder(nsIUnicodeEncoder** encoder)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
#ifdef ClientWallet
|
||||
void
|
||||
GetVcardName(nsIFormControlFrame& aFormControlFrame, nsString& aVCardName)
|
||||
{
|
||||
aVCardName = "";
|
||||
nsIFrame* frame = nsnull;
|
||||
nsresult rv = aFormControlFrame.QueryInterface(kIFrameIID, (void**)&frame);
|
||||
if (NS_SUCCEEDED(rv) && frame) {
|
||||
nsIContent* content = nsnull;
|
||||
rv = frame->GetContent(&content);
|
||||
if (NS_SUCCEEDED(rv) && content) {
|
||||
nsIHTMLContent* htmlContent = nsnull;
|
||||
rv = content->QueryInterface(kIHTMLContentIID, (void**)&htmlContent);
|
||||
if (NS_SUCCEEDED(rv) && htmlContent) {
|
||||
nsHTMLValue value;
|
||||
if (NS_CONTENT_ATTR_HAS_VALUE == htmlContent->GetHTMLAttribute(nsHTMLAtoms::vcard_name, value)) {
|
||||
if (eHTMLUnit_String == value.GetUnit()) {
|
||||
value.GetStringValue(aVCardName);
|
||||
}
|
||||
}
|
||||
NS_RELEASE(htmlContent);
|
||||
}
|
||||
NS_RELEASE(content);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#define CRLF "\015\012"
|
||||
void nsFormFrame::ProcessAsURLEncoded(PRBool isPost, nsString& aData, nsIFormControlFrame* aFrame)
|
||||
{
|
||||
@@ -743,75 +687,6 @@ void nsFormFrame::ProcessAsURLEncoded(PRBool isPost, nsString& aData, nsIFormCon
|
||||
PRBool firstTime = PR_TRUE;
|
||||
PRUint32 numChildren = mFormControls.Count();
|
||||
|
||||
|
||||
#if defined(ClientWallet) || defined(SingleSignon)
|
||||
/* get url name as ascii string */
|
||||
char *URLName = nsnull;
|
||||
nsIURI* docURL = nsnull;
|
||||
nsIDocument* doc = nsnull;
|
||||
mContent->GetDocument(doc);
|
||||
|
||||
#ifdef NECKO
|
||||
char* spec;
|
||||
#else
|
||||
const char* spec;
|
||||
#endif
|
||||
while (doc) {
|
||||
docURL = doc->GetDocumentURL();
|
||||
if (nsnull != docURL) {
|
||||
(void)docURL->GetSpec(&spec);
|
||||
if (PL_strcmp(spec, "about:blank")) {
|
||||
break;
|
||||
}
|
||||
#ifdef NECKO
|
||||
nsCRT::free(spec);
|
||||
#endif
|
||||
}
|
||||
doc = GetParentHTMLFrameDocument(doc);
|
||||
}
|
||||
if (nsnull != docURL) {
|
||||
URLName = (char*)PR_Malloc(PL_strlen(spec)+1);
|
||||
PL_strcpy(URLName, spec);
|
||||
NS_IF_RELEASE(docURL);
|
||||
}
|
||||
#ifdef NECKO
|
||||
nsCRT::free(spec);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef SingleSignon
|
||||
#define MAX_ARRAY_SIZE 500
|
||||
char* name_array[MAX_ARRAY_SIZE];
|
||||
char* value_array[MAX_ARRAY_SIZE];
|
||||
uint8 type_array[MAX_ARRAY_SIZE];
|
||||
PRInt32 value_cnt = 0;
|
||||
#endif
|
||||
|
||||
#ifdef ClientWallet
|
||||
/* determine if form is significant enough to capture data for */
|
||||
PRBool OKToCapture = FALSE;
|
||||
PRInt32 count = 0;
|
||||
PRUint32 numChildren2 = mFormControls.Count();
|
||||
for (PRUint32 childX2 = 0; childX2 < numChildren2; childX2++) {
|
||||
nsIFormControlFrame* child = (nsIFormControlFrame*) mFormControls.ElementAt(childX2);
|
||||
if (child && child->IsSuccessful(aFrame)) {
|
||||
PRInt32 type;
|
||||
child->GetType(&type);
|
||||
if (type == NS_FORM_INPUT_TEXT) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
nsIWalletService *service2;
|
||||
nsresult res2 = nsServiceManager::GetService(kWalletServiceCID,
|
||||
kIWalletServiceIID,
|
||||
(nsISupports **)&service2);
|
||||
if ((NS_OK == res2) && (nsnull != service2)) {
|
||||
service2->WALLET_OKToCapture(&OKToCapture, count, URLName);
|
||||
nsServiceManager::ReleaseService(kWalletServiceCID, service2);
|
||||
}
|
||||
#endif
|
||||
|
||||
nsIUnicodeEncoder *encoder = nsnull;
|
||||
if(NS_FAILED( GetEncoder(&encoder) ) )
|
||||
encoder = nsnull;
|
||||
@@ -828,40 +703,6 @@ void nsFormFrame::ProcessAsURLEncoded(PRBool isPost, nsString& aData, nsIFormCon
|
||||
nsString* names = new nsString[maxNumValues];
|
||||
nsString* values = new nsString[maxNumValues];
|
||||
if (PR_TRUE == child->GetNamesValues(maxNumValues, numValues, values, names)) {
|
||||
#if defined(ClientWallet) || defined(SingleSignon)
|
||||
PRInt32 type;
|
||||
child->GetType(&type);
|
||||
#endif
|
||||
#ifdef ClientWallet
|
||||
if (OKToCapture && (NS_FORM_INPUT_TEXT == type)) {
|
||||
nsString vcard("");
|
||||
GetVcardName(*child, vcard);
|
||||
nsIWalletService *service;
|
||||
nsresult res = nsServiceManager::GetService(kWalletServiceCID,
|
||||
kIWalletServiceIID,
|
||||
(nsISupports **)&service);
|
||||
if ((NS_OK == res) && (nsnull != service)) {
|
||||
res = service->WALLET_Capture(doc, *names, *values, vcard);
|
||||
nsServiceManager::ReleaseService(kWalletServiceCID, service);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#ifdef SingleSignon
|
||||
if ((type == NS_FORM_INPUT_PASSWORD) || (type == NS_FORM_INPUT_TEXT)) {
|
||||
if (value_cnt < MAX_ARRAY_SIZE) {
|
||||
if (type == NS_FORM_INPUT_PASSWORD) {
|
||||
type_array[value_cnt] = FORM_TYPE_PASSWORD;
|
||||
} else {
|
||||
type_array[value_cnt] = FORM_TYPE_TEXT;
|
||||
}
|
||||
value_array[value_cnt] =
|
||||
values[0].ToNewCString();
|
||||
name_array[value_cnt] =
|
||||
names[0].ToNewCString();
|
||||
value_cnt++;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
for (int valueX = 0; valueX < numValues; valueX++) {
|
||||
if (PR_TRUE == firstTime) {
|
||||
firstTime = PR_FALSE;
|
||||
@@ -883,30 +724,6 @@ void nsFormFrame::ProcessAsURLEncoded(PRBool isPost, nsString& aData, nsIFormCon
|
||||
}
|
||||
NS_IF_RELEASE(encoder);
|
||||
|
||||
#ifdef SingleSignon
|
||||
nsIWalletService *service;
|
||||
nsresult res = nsServiceManager::GetService(kWalletServiceCID,
|
||||
kIWalletServiceIID,
|
||||
(nsISupports **)&service);
|
||||
if ((NS_OK == res) && (nsnull != service)) {
|
||||
res = service->SI_RememberSignonData
|
||||
(URLName, (char**)name_array, (char**)value_array, (char**)type_array, value_cnt);
|
||||
nsServiceManager::ReleaseService(kWalletServiceCID, service);
|
||||
}
|
||||
while (value_cnt--) {
|
||||
PR_FREEIF(name_array[value_cnt]);
|
||||
PR_FREEIF(value_array[value_cnt]);
|
||||
}
|
||||
#endif
|
||||
#if defined(ClientWallet) || defined(SingleSignon)
|
||||
if (nsnull != doc) {
|
||||
NS_RELEASE(doc);
|
||||
}
|
||||
if (nsnull != URLName) {
|
||||
PR_FREEIF(URLName);
|
||||
}
|
||||
#endif
|
||||
|
||||
aData.SetLength(0);
|
||||
if (isPost) {
|
||||
char size[16];
|
||||
|
||||
@@ -65,15 +65,7 @@
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDOMEventReceiver.h"
|
||||
|
||||
#ifdef SingleSignon
|
||||
#include "prmem.h"
|
||||
#include "nsIURL.h"
|
||||
#include "nsIWalletService.h"
|
||||
#include "nsIServiceManager.h"
|
||||
static NS_DEFINE_IID(kIWalletServiceIID, NS_IWALLETSERVICE_IID);
|
||||
static NS_DEFINE_IID(kWalletServiceCID, NS_WALLETSERVICE_CID);
|
||||
#endif
|
||||
#include "nsIPresShell.h"
|
||||
|
||||
static NS_DEFINE_IID(kIFormControlIID, NS_IFORMCONTROL_IID);
|
||||
static NS_DEFINE_IID(kTextCID, NS_TEXTFIELD_CID);
|
||||
@@ -1111,69 +1103,7 @@ nsGfxTextControlFrame::InitializeTextControl(nsIPresShell *aPresShell, nsIDOMDoc
|
||||
|
||||
// now that the style context is initialized, initialize the content
|
||||
nsAutoString value;
|
||||
if (PR_TRUE == IsSingleLineTextControl())
|
||||
{
|
||||
#ifdef SingleSignon
|
||||
// get name of text
|
||||
PRBool failed = PR_TRUE;
|
||||
nsAutoString name;
|
||||
GetName(&name);
|
||||
|
||||
// get url name
|
||||
char *URLName = nsnull;
|
||||
nsIURI* docURL = nsnull;
|
||||
nsIDocument* doc = nsnull;
|
||||
mContent->GetDocument(doc);
|
||||
if (nsnull != doc) {
|
||||
docURL = doc->GetDocumentURL();
|
||||
NS_RELEASE(doc);
|
||||
if (nsnull != docURL) {
|
||||
#ifdef NECKO
|
||||
char* spec;
|
||||
#else
|
||||
const char* spec;
|
||||
#endif
|
||||
(void)docURL->GetSpec(&spec);
|
||||
if (nsnull != spec) {
|
||||
URLName = (char*)PR_Malloc(PL_strlen(spec)+1);
|
||||
PL_strcpy(URLName, spec);
|
||||
}
|
||||
#ifdef NECKO
|
||||
nsCRT::free(spec);
|
||||
#endif
|
||||
NS_RELEASE(docURL);
|
||||
}
|
||||
}
|
||||
|
||||
if (nsnull != URLName) {
|
||||
// invoke single-signon to get previously-used value of text
|
||||
nsIWalletService *service;
|
||||
nsresult res = nsServiceManager::GetService(kWalletServiceCID,
|
||||
kIWalletServiceIID,
|
||||
(nsISupports **)&service);
|
||||
if ((NS_OK == res) && (nsnull != service)) {
|
||||
char* valueString = NULL;
|
||||
char* nameString = name.ToNewCString();
|
||||
res = service->SI_RestoreSignonData(URLName, nameString, &valueString);
|
||||
delete[] nameString;
|
||||
nsServiceManager::ReleaseService(kWalletServiceCID, service);
|
||||
PR_FREEIF(URLName);
|
||||
if (valueString && *valueString) {
|
||||
value = valueString;
|
||||
failed = PR_FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (failed) {
|
||||
GetText(&value, PR_TRUE);
|
||||
}
|
||||
#else
|
||||
GetText(&value, PR_TRUE);
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
GetText(&value, PR_TRUE);
|
||||
}
|
||||
GetText(&value, PR_TRUE);
|
||||
mEditor->EnableUndo(PR_FALSE);
|
||||
|
||||
PRInt32 maxLength;
|
||||
|
||||
@@ -46,16 +46,6 @@
|
||||
#include "nsILookAndFeel.h"
|
||||
#include "nsIComponentManager.h"
|
||||
|
||||
#ifdef SingleSignon
|
||||
#include "nsIDocument.h"
|
||||
#include "prmem.h"
|
||||
#include "nsIURL.h"
|
||||
#include "nsIWalletService.h"
|
||||
#include "nsIServiceManager.h"
|
||||
static NS_DEFINE_IID(kIWalletServiceIID, NS_IWALLETSERVICE_IID);
|
||||
static NS_DEFINE_IID(kWalletServiceCID, NS_WALLETSERVICE_CID);
|
||||
#endif
|
||||
|
||||
static NS_DEFINE_IID(kIFormControlIID, NS_IFORMCONTROL_IID);
|
||||
static NS_DEFINE_IID(kTextCID, NS_TEXTFIELD_CID);
|
||||
static NS_DEFINE_IID(kTextAreaCID, NS_TEXTAREA_CID);
|
||||
@@ -252,62 +242,7 @@ nsNativeTextControlFrame::PostCreateWidget(nsIPresContext* aPresContext,
|
||||
nsITextAreaWidget* textArea = nsnull;
|
||||
nsITextWidget* text = nsnull;
|
||||
if (NS_OK == mWidget->QueryInterface(kITextWidgetIID,(void**)&text)) {
|
||||
|
||||
#ifdef SingleSignon
|
||||
/* get name of text */
|
||||
PRBool failed = PR_TRUE;
|
||||
nsAutoString name;
|
||||
GetName(&name);
|
||||
|
||||
/* get url name */
|
||||
char *URLName = nsnull;
|
||||
nsIURI* docURL = nsnull;
|
||||
nsIDocument* doc = nsnull;
|
||||
mContent->GetDocument(doc);
|
||||
if (nsnull != doc) {
|
||||
docURL = doc->GetDocumentURL();
|
||||
NS_RELEASE(doc);
|
||||
if (nsnull != docURL) {
|
||||
#ifdef NECKO
|
||||
char* spec;
|
||||
#else
|
||||
const char* spec;
|
||||
#endif
|
||||
(void)docURL->GetSpec(&spec);
|
||||
if (nsnull != spec) {
|
||||
URLName = (char*)PR_Malloc(PL_strlen(spec)+1);
|
||||
PL_strcpy(URLName, spec);
|
||||
}
|
||||
NS_RELEASE(docURL);
|
||||
}
|
||||
}
|
||||
|
||||
if (nsnull != URLName) {
|
||||
/* invoke single-signon to get previously-used value of text */
|
||||
nsIWalletService *service;
|
||||
nsresult res = nsServiceManager::GetService(kWalletServiceCID,
|
||||
kIWalletServiceIID,
|
||||
(nsISupports **)&service);
|
||||
if ((NS_OK == res) && (nsnull != service)) {
|
||||
char* valueString = NULL;
|
||||
char* nameString = name.ToNewCString();
|
||||
res = service->SI_RestoreSignonData(URLName, nameString, &valueString);
|
||||
delete[] nameString;
|
||||
nsServiceManager::ReleaseService(kWalletServiceCID, service);
|
||||
PR_FREEIF(URLName);
|
||||
if (valueString && *valueString) {
|
||||
value = valueString;
|
||||
failed = PR_FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (failed) {
|
||||
GetText(&value, PR_TRUE);
|
||||
}
|
||||
#else
|
||||
GetText(&value, PR_TRUE);
|
||||
#endif
|
||||
|
||||
GetText(&value, PR_TRUE);
|
||||
text->SetText(value, ignore);
|
||||
PRInt32 maxLength;
|
||||
nsresult result = GetMaxLength(&maxLength);
|
||||
|
||||
@@ -46,16 +46,6 @@
|
||||
#include "nsILookAndFeel.h"
|
||||
#include "nsIComponentManager.h"
|
||||
|
||||
#ifdef SingleSignon
|
||||
#include "nsIDocument.h"
|
||||
#include "prmem.h"
|
||||
#include "nsIURL.h"
|
||||
#include "nsIWalletService.h"
|
||||
#include "nsIServiceManager.h"
|
||||
static NS_DEFINE_IID(kIWalletServiceIID, NS_IWALLETSERVICE_IID);
|
||||
static NS_DEFINE_IID(kWalletServiceCID, NS_WALLETSERVICE_CID);
|
||||
#endif
|
||||
|
||||
static NS_DEFINE_IID(kIFormControlIID, NS_IFORMCONTROL_IID);
|
||||
static NS_DEFINE_IID(kTextCID, NS_TEXTFIELD_CID);
|
||||
static NS_DEFINE_IID(kTextAreaCID, NS_TEXTAREA_CID);
|
||||
|
||||
Reference in New Issue
Block a user