зеркало из https://github.com/mozilla/gecko-dev.git
take advantage of vcard attribute when submitting forms
This commit is contained in:
Родитель
f515159591
Коммит
75ce053f91
|
@ -47,7 +47,8 @@ struct nsIWalletService : public nsISupports
|
|||
NS_IMETHOD WALLET_PreEdit(nsIURL* url) = 0;
|
||||
NS_IMETHOD WALLET_ChangePassword() = 0;
|
||||
NS_IMETHOD WALLET_Prefill(nsIPresShell* shell, PRBool quick) = 0;
|
||||
NS_IMETHOD WALLET_Capture(nsIDocument* doc, nsString name, nsString value) = 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 SI_DisplaySignonInfoAsHTML()=0;
|
||||
|
|
|
@ -77,8 +77,9 @@ NS_IMETHODIMP nsWalletlibService::WALLET_OKToCapture
|
|||
NS_IMETHODIMP nsWalletlibService::WALLET_Capture(
|
||||
nsIDocument* doc,
|
||||
nsString name,
|
||||
nsString value) {
|
||||
::WLLT_Capture(doc, name, value);
|
||||
nsString value,
|
||||
nsString vcard) {
|
||||
::WLLT_Capture(doc, name, value, vcard);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,8 @@ public:
|
|||
NS_IMETHOD WALLET_ChangePassword();
|
||||
NS_IMETHOD WALLET_PreEdit(nsIURL* url);
|
||||
NS_IMETHOD WALLET_Prefill(nsIPresShell* shell, PRBool quick);
|
||||
NS_IMETHOD WALLET_Capture(nsIDocument* doc, nsString name, nsString value);
|
||||
NS_IMETHOD WALLET_Capture
|
||||
(nsIDocument* doc, nsString name, nsString value, nsString vcard);
|
||||
NS_IMETHOD WALLET_OKToCapture(PRBool* result, PRInt32 count, char* URLName);
|
||||
|
||||
NS_IMETHOD SI_DisplaySignonInfoAsHTML();
|
||||
|
|
|
@ -2204,7 +2204,7 @@ WLLT_OKToCapture(PRBool * result, PRInt32 count, char* URLName) {
|
|||
* capture the value of a form element
|
||||
*/
|
||||
PUBLIC void
|
||||
WLLT_Capture(nsIDocument* doc, nsString field, nsString value) {
|
||||
WLLT_Capture(nsIDocument* doc, nsString field, nsString value, nsString vcard) {
|
||||
|
||||
/* do nothing if there is no value */
|
||||
if (!value.Length()) {
|
||||
|
@ -2212,22 +2212,25 @@ WLLT_Capture(nsIDocument* doc, nsString field, nsString value) {
|
|||
}
|
||||
|
||||
/* read in the mappings if they are not already present */
|
||||
wallet_Initialize();
|
||||
wallet_InitializeCurrentURL(doc);
|
||||
if (Wallet_BadKey()) {
|
||||
return;
|
||||
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;
|
||||
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 ((wallet_ReadFromList(field, schema, dummy, URLFieldToSchema_list) != -1) ||
|
||||
if (schema.Length() ||
|
||||
(wallet_ReadFromList(field, schema, dummy, URLFieldToSchema_list) != -1) ||
|
||||
(wallet_ReadFromList(field, schema, dummy, FieldToSchema_list) != -1)) {
|
||||
|
||||
/* field to schema mapping already exists */
|
||||
|
@ -2278,7 +2281,7 @@ WLLT_Capture(nsIDocument* doc, nsString field, nsString value) {
|
|||
//}
|
||||
|
||||
//PUBLIC void
|
||||
//WLLT_Capture(nsIDocument* doc, nsString field, nsString value) {
|
||||
//WLLT_Capture(nsIDocument* doc, nsString field, nsString value, nsString vcard) {
|
||||
//}
|
||||
|
||||
//}
|
||||
|
|
|
@ -46,7 +46,7 @@ extern void
|
|||
WLLT_OKToCapture(PRBool * result, PRInt32 count, char* URLName);
|
||||
|
||||
extern void
|
||||
WLLT_Capture(nsIDocument* doc, nsString name, nsString value);
|
||||
WLLT_Capture(nsIDocument* doc, nsString name, nsString value, nsString vcard);
|
||||
|
||||
XP_END_PROTOS
|
||||
|
||||
|
|
|
@ -812,12 +812,15 @@ void nsFormFrame::ProcessAsURLEncoded(PRBool isPost, nsString& aData, nsIFormCon
|
|||
#endif
|
||||
#ifdef ClientWallet
|
||||
if (OKToCapture && (NS_FORM_INPUT_TEXT == type)) {
|
||||
nsString vcard("");
|
||||
/* following line is awaiting karneze to implement GetAttrib */
|
||||
// child->GetAttrib(NS_NewAtom("VCARD_NAME"), &vcard);
|
||||
nsIWalletService *service;
|
||||
nsresult res = nsServiceManager::GetService(kWalletServiceCID,
|
||||
kIWalletServiceIID,
|
||||
(nsISupports **)&service);
|
||||
if ((NS_OK == res) && (nsnull != service)) {
|
||||
res = service->WALLET_Capture(doc, *names, *values);
|
||||
res = service->WALLET_Capture(doc, *names, *values, vcard);
|
||||
NS_RELEASE(service);
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче