diff --git a/mozilla/extensions/wallet/editor/nsWalletEditor.cpp b/mozilla/extensions/wallet/editor/nsWalletEditor.cpp index 3daaa79c7da..5f293f8043d 100644 --- a/mozilla/extensions/wallet/editor/nsWalletEditor.cpp +++ b/mozilla/extensions/wallet/editor/nsWalletEditor.cpp @@ -67,6 +67,7 @@ WalletEditorImpl::GetValue(PRUnichar** aValue) return res; } +#if 0 static void DOMWindowToWebShellWindow( nsIDOMWindow *DOMWindow, nsCOMPtr *webWindow) @@ -87,6 +88,7 @@ static void DOMWindowToWebShellWindow( webshell->GetTopLevelWindow(getter_AddRefs(topLevelWindow)); *webWindow = do_QueryInterface(topLevelWindow); } +#endif /* 0 */ NS_IMETHODIMP WalletEditorImpl::SetValue(const PRUnichar* aValue, nsIDOMWindow* win) diff --git a/mozilla/extensions/wallet/public/nsIWalletService.idl b/mozilla/extensions/wallet/public/nsIWalletService.idl index 4bbf2d4f35b..e50c8487de9 100644 --- a/mozilla/extensions/wallet/public/nsIWalletService.idl +++ b/mozilla/extensions/wallet/public/nsIWalletService.idl @@ -59,6 +59,7 @@ interface nsIWalletService : nsISupports { boolean PromptPasswordURL(in wstring text, out wstring pwd, in string urlname, in boolean stripUrl, in nsIPrompt dialog); boolean PromptURL(in wstring text, in wstring defaultText, out wstring result, in string urlname, in boolean stripUrl, in nsIPrompt dialog); void SI_RemoveUser(in string URLName, in boolean stripUrl, in wstring userName); + boolean haveData(in string url, in wstring userName, in boolean stripUrl); [noscript] void WALLET_GetNopreviewListForViewer(in nsAutoStringRef aNopreviewList); [noscript] void WALLET_GetNocaptureListForViewer(in nsAutoStringRef aNocaptureList); diff --git a/mozilla/extensions/wallet/src/nsWalletService.cpp b/mozilla/extensions/wallet/src/nsWalletService.cpp index 1918f677e76..39ad50b8db2 100644 --- a/mozilla/extensions/wallet/src/nsWalletService.cpp +++ b/mozilla/extensions/wallet/src/nsWalletService.cpp @@ -374,3 +374,9 @@ nsWalletlibService::GetPassword(PRUnichar **password) { return Wallet_GetMasterPassword(password); } + +NS_IMETHODIMP +nsWalletlibService::HaveData(const char *url, const PRUnichar *userName, PRBool stripUrl, PRBool *_retval) +{ + return ::SINGSIGN_HaveData(url, userName, stripUrl, _retval); +} diff --git a/mozilla/extensions/wallet/src/nsWalletService.h b/mozilla/extensions/wallet/src/nsWalletService.h index 69d414deabc..f4f2319d5c0 100644 --- a/mozilla/extensions/wallet/src/nsWalletService.h +++ b/mozilla/extensions/wallet/src/nsWalletService.h @@ -61,6 +61,7 @@ public: const char *urlname, PRBool stripUrl, nsIPrompt* dialog, PRBool *_retval); NS_IMETHOD SI_RemoveUser(const char *URLName, PRBool stripUrl, const PRUnichar *userName); + NS_IMETHOD HaveData(const char *url, const PRUnichar *userName, PRBool stripUrl, PRBool *_retval); NS_IMETHOD WALLET_GetNopreviewListForViewer(nsAutoString& aNopreviewList); NS_IMETHOD WALLET_GetNocaptureListForViewer(nsAutoString& aNocaptureList); diff --git a/mozilla/extensions/wallet/src/singsign.cpp b/mozilla/extensions/wallet/src/singsign.cpp index cf75850dea1..b80aa9c9619 100644 --- a/mozilla/extensions/wallet/src/singsign.cpp +++ b/mozilla/extensions/wallet/src/singsign.cpp @@ -2866,6 +2866,54 @@ SINGSIGN_GetRejectListForViewer(nsAutoString& aRejectList) aRejectList = buffer; } +PUBLIC nsresult +SINGSIGN_HaveData(const char *url, const PRUnichar *userName, PRBool strip, PRBool *retval) +{ + nsresult res; + nsAutoString data, usernameForLookup; + + *retval = PR_FALSE; + + if (!si_GetSignonRememberingPref()) { + return NS_OK; + } + + NS_ASSERTION(strip == PR_FALSE, "this code needs to be finished for the strip case"); + + /* convert to a uri so we can parse out the username and hostname */ + nsCOMPtr uri; + nsComponentManager::CreateInstance(kStandardUrlCID, nsnull, NS_GET_IID(nsIURL), (void **) getter_AddRefs(uri)); + res = uri->SetSpec(url); + if (NS_FAILED(res)) return res; + + /* get host part of the uri */ + nsXPIDLCString host; + if (strip) { + res = uri->GetHost(getter_Copies(host)); + if (NS_FAILED(res)) { + return res; + } + } else { + res = MangleUrl(url, getter_Copies(host)); + if (NS_FAILED(res)) return res; + } + + if (strip) { + /* convert url to a uri so we can parse out the username and hostname */ + /* if no username given, extract it from uri -- note: prehost is : */ + return NS_ERROR_NOT_IMPLEMENTED; + } + + /* get previous data used with this username, pick first user if no username found */ + si_RestoreOldSignonDataFromBrowser((const char *)host, (usernameForLookup.Length() == 0), usernameForLookup, data); + + if (data.Length()) { + *retval = PR_TRUE; + } + + return NS_OK; +} + #ifdef APPLE_KEYCHAIN /************************************ diff --git a/mozilla/extensions/wallet/src/singsign.h b/mozilla/extensions/wallet/src/singsign.h index 982997b1f26..3af622fbe03 100644 --- a/mozilla/extensions/wallet/src/singsign.h +++ b/mozilla/extensions/wallet/src/singsign.h @@ -65,6 +65,10 @@ extern PRBool SINGSIGN_RemoveUser (const char *URLName, const PRUnichar *userName, PRBool strip); +extern nsresult +SINGSIGN_HaveData(const char *url, const PRUnichar *userName, PRBool strip, PRBool *retval); + + XP_END_PROTOS #endif /* !_SINGSIGN_H */ diff --git a/mozilla/extensions/wallet/src/wallet.cpp b/mozilla/extensions/wallet/src/wallet.cpp index d0689553a99..281a3bcf854 100644 --- a/mozilla/extensions/wallet/src/wallet.cpp +++ b/mozilla/extensions/wallet/src/wallet.cpp @@ -529,8 +529,9 @@ SI_GetCharPref(const char * prefname, char** aPrefvalue); #ifdef AutoCapture static const char *pref_captureForms = "wallet.captureForms"; -#endif +#else static const char *pref_WalletNotified = "wallet.Notified"; +#endif /* AutoCapture */ static const char *pref_WalletKeyFileName = "wallet.KeyFileName"; static const char *pref_WalletSchemaValueFileName = "wallet.SchemaValueFileName"; static const char *pref_WalletServer = "wallet.Server"; @@ -539,8 +540,9 @@ static const char *pref_WalletVersion = "wallet.version"; #ifdef AutoCapture PRIVATE PRBool wallet_captureForms = PR_FALSE; -#endif +#else PRIVATE PRBool wallet_Notified = PR_FALSE; +#endif PRIVATE char * wallet_Server = nsnull; #ifdef AutoCapture @@ -588,6 +590,7 @@ wallet_GetFormsCapturingPref(void) } #endif +#ifndef AutoCapture PRIVATE void wallet_SetWalletNotificationPref(PRBool x) { SI_SetBoolPref(pref_WalletNotified, x); @@ -603,6 +606,7 @@ wallet_GetWalletNotificationPref(void) { } return wallet_Notified; } +#endif /* ! AutoCapture */ /*************************************************************************/