mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-04 02:57:38 +00:00
general spring cleaning
This commit is contained in:
parent
c0ab6533f4
commit
c137afdfed
@ -44,28 +44,27 @@
|
||||
*/
|
||||
struct nsIWalletService : public nsISupports
|
||||
{
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IWALLETSERVICE_IID; return iid; }
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IWALLETSERVICE_IID; return iid; }
|
||||
|
||||
NS_IMETHOD WALLET_PreEdit(nsAutoString& walletList) = 0;
|
||||
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_PrefillReturn(nsAutoString results)=0;
|
||||
NS_IMETHOD WALLET_PreEdit(nsAutoString& walletList) = 0;
|
||||
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_PrefillReturn(nsAutoString results)=0;
|
||||
|
||||
NS_IMETHOD SI_DisplaySignonInfoAsHTML()=0;
|
||||
NS_IMETHOD SI_SignonViewerReturn(nsAutoString results)=0;
|
||||
NS_IMETHOD SI_GetSignonListForViewer(nsString& aSignonList)=0;
|
||||
NS_IMETHOD SI_GetRejectListForViewer(nsString& aRejectList)=0;
|
||||
NS_IMETHOD WALLET_GetNopreviewListForViewer(nsString& aNopreviewList)=0;
|
||||
NS_IMETHOD WALLET_GetNocaptureListForViewer(nsString& aNocaptureList)=0;
|
||||
NS_IMETHOD WALLET_GetPrefillListForViewer(nsString& aPrefillList)=0;
|
||||
NS_IMETHOD SI_PromptUsernameAndPassword
|
||||
(char *prompt, char **username, char **password, char *URLName, PRBool &status)=0;
|
||||
NS_IMETHOD SI_PromptPassword
|
||||
(char *prompt, char **password, char *URLName, PRBool pickFirstUser)=0;
|
||||
NS_IMETHOD SI_Prompt
|
||||
(char *prompt, char **username, char *URLName)=0;
|
||||
|
||||
NS_IMETHOD SI_PromptUsernameAndPassword
|
||||
(char *prompt, char **username, char **password, char *URLName, PRBool &status)=0;
|
||||
NS_IMETHOD SI_PromptPassword
|
||||
(char *prompt, char **password, char *URLName, PRBool pickFirstUser)=0;
|
||||
NS_IMETHOD SI_Prompt
|
||||
(char *prompt, char **username, char *URLName)=0;
|
||||
NS_IMETHOD WALLET_GetNopreviewListForViewer(nsString& aNopreviewList)=0;
|
||||
NS_IMETHOD WALLET_GetNocaptureListForViewer(nsString& aNocaptureList)=0;
|
||||
NS_IMETHOD WALLET_GetPrefillListForViewer(nsString& aPrefillList)=0;
|
||||
NS_IMETHOD SI_GetSignonListForViewer(nsString& aSignonList)=0;
|
||||
NS_IMETHOD SI_GetRejectListForViewer(nsString& aRejectList)=0;
|
||||
NS_IMETHOD SI_SignonViewerReturn(nsAutoString results)=0;
|
||||
};
|
||||
|
||||
#endif /* nsIWalletService_h___ */
|
||||
|
@ -44,134 +44,126 @@ static NS_DEFINE_IID(kIDocumentLoaderIID, NS_IDOCUMENTLOADER_IID);
|
||||
|
||||
nsWalletlibService::nsWalletlibService()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
Init();
|
||||
NS_INIT_REFCNT();
|
||||
Init();
|
||||
}
|
||||
|
||||
nsWalletlibService::~nsWalletlibService()
|
||||
{
|
||||
nsIObserverService *svc = 0;
|
||||
nsresult rv = nsServiceManager::GetService( NS_OBSERVERSERVICE_PROGID,
|
||||
nsIObserverService::GetIID(),
|
||||
(nsISupports**)&svc );
|
||||
if ( NS_SUCCEEDED( rv ) && svc ) {
|
||||
nsString topic(NS_FORMSUBMIT_SUBJECT);
|
||||
rv = svc->RemoveObserver( this, topic.GetUnicode());
|
||||
nsServiceManager::ReleaseService( NS_OBSERVERSERVICE_PROGID, svc );
|
||||
}
|
||||
nsIObserverService *svc = 0;
|
||||
nsresult rv = nsServiceManager::GetService( NS_OBSERVERSERVICE_PROGID,
|
||||
nsIObserverService::GetIID(),
|
||||
(nsISupports**)&svc );
|
||||
if ( NS_SUCCEEDED( rv ) && svc ) {
|
||||
nsString topic(NS_FORMSUBMIT_SUBJECT);
|
||||
rv = svc->RemoveObserver( this, topic.GetUnicode());
|
||||
nsServiceManager::ReleaseService( NS_OBSERVERSERVICE_PROGID, svc );
|
||||
}
|
||||
}
|
||||
|
||||
/* calls into the wallet module */
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWalletlibService::QueryInterface(REFNSIID iid, void** result)
|
||||
{
|
||||
if (! result)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
*result = nsnull;
|
||||
if (iid.Equals(kIWalletServiceIID)) {
|
||||
*result = NS_STATIC_CAST(nsIWalletService*, this);
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
if (iid.Equals(kIFormSubmitObserverIID)) {
|
||||
*result = NS_STATIC_CAST(nsIFormSubmitObserver*, this);
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
if (iid.Equals(nsIDocumentLoaderObserver::GetIID())) {
|
||||
if (! result) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
*result = nsnull;
|
||||
if (iid.Equals(kIWalletServiceIID)) {
|
||||
*result = NS_STATIC_CAST(nsIWalletService*, this);
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
if (iid.Equals(kIFormSubmitObserverIID)) {
|
||||
*result = NS_STATIC_CAST(nsIFormSubmitObserver*, this);
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
if (iid.Equals(nsIDocumentLoaderObserver::GetIID())) {
|
||||
*result = (void*) ((nsIDocumentLoaderObserver*)this);
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_NOINTERFACE;
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF(nsWalletlibService);
|
||||
NS_IMPL_RELEASE(nsWalletlibService);
|
||||
|
||||
NS_IMETHODIMP nsWalletlibService::WALLET_PreEdit(nsAutoString& walletList) {
|
||||
::WLLT_PreEdit(walletList);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWalletlibService::WALLET_PostEdit(nsAutoString walletList) {
|
||||
::WLLT_PostEdit(walletList);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWalletlibService::WALLET_ChangePassword() {
|
||||
::WLLT_ChangePassword();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWalletlibService::WALLET_PreEdit(nsAutoString& walletList) {
|
||||
::WLLT_PreEdit(walletList);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWalletlibService::WALLET_PostEdit(nsAutoString walletList) {
|
||||
::WLLT_PostEdit(walletList);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWalletlibService::WALLET_Prefill
|
||||
(nsIPresShell* shell, nsString url, PRBool quick) {
|
||||
return ::WLLT_Prefill(shell, url, quick);
|
||||
NS_IMETHODIMP nsWalletlibService::WALLET_Prefill(nsIPresShell* shell, nsString url, PRBool quick) {
|
||||
return ::WLLT_Prefill(shell, url, quick);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWalletlibService::WALLET_PrefillReturn(nsAutoString results){
|
||||
::WLLT_PrefillReturn(results);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWalletlibService::SI_DisplaySignonInfoAsHTML(){
|
||||
::SINGSIGN_DisplaySignonInfoAsHTML();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWalletlibService::SI_SignonViewerReturn(nsAutoString results){
|
||||
::SINGSIGN_SignonViewerReturn(results);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWalletlibService::SI_GetSignonListForViewer(nsString& aSignonList){
|
||||
::SINGSIGN_GetSignonListForViewer(aSignonList);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWalletlibService::SI_GetRejectListForViewer(nsString& aRejectList){
|
||||
::SINGSIGN_GetRejectListForViewer(aRejectList);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWalletlibService::WALLET_GetNopreviewListForViewer(nsString& aNopreviewList){
|
||||
::WLLT_GetNopreviewListForViewer(aNopreviewList);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWalletlibService::WALLET_GetNocaptureListForViewer(nsString& aNocaptureList){
|
||||
::WLLT_GetNocaptureListForViewer(aNocaptureList);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWalletlibService::WALLET_GetPrefillListForViewer(nsString& aPrefillList){
|
||||
::WLLT_GetPrefillListForViewer(aPrefillList);
|
||||
return NS_OK;
|
||||
::WLLT_PrefillReturn(results);
|
||||
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);
|
||||
return NS_OK;
|
||||
(char *prompt, char **username, char **password, char *URLName, PRBool &status) {
|
||||
status = ::SINGSIGN_PromptUsernameAndPassword(prompt, username, password, URLName);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWalletlibService::SI_PromptPassword
|
||||
(char *prompt, char **password, char *URLName, PRBool pickFirstUser) {
|
||||
*password = ::SINGSIGN_PromptPassword(prompt, URLName, pickFirstUser);
|
||||
return NS_OK;
|
||||
(char *prompt, char **password, char *URLName, PRBool pickFirstUser) {
|
||||
*password = ::SINGSIGN_PromptPassword(prompt, URLName, pickFirstUser);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWalletlibService::SI_Prompt
|
||||
(char *prompt, char **username, char *URLName) {
|
||||
*username = ::SINGSIGN_Prompt(prompt, *username, URLName);
|
||||
return NS_OK;
|
||||
(char *prompt, char **username, char *URLName) {
|
||||
*username = ::SINGSIGN_Prompt(prompt, *username, URLName);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWalletlibService::WALLET_GetNopreviewListForViewer(nsString& aNopreviewList){
|
||||
::WLLT_GetNopreviewListForViewer(aNopreviewList);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWalletlibService::WALLET_GetNocaptureListForViewer(nsString& aNocaptureList){
|
||||
::WLLT_GetNocaptureListForViewer(aNocaptureList);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWalletlibService::WALLET_GetPrefillListForViewer(nsString& aPrefillList){
|
||||
::WLLT_GetPrefillListForViewer(aPrefillList);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWalletlibService::SI_GetSignonListForViewer(nsString& aSignonList){
|
||||
::SINGSIGN_GetSignonListForViewer(aSignonList);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWalletlibService::SI_GetRejectListForViewer(nsString& aRejectList){
|
||||
::SINGSIGN_GetRejectListForViewer(aRejectList);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWalletlibService::SI_SignonViewerReturn(nsAutoString results){
|
||||
::SINGSIGN_SignonViewerReturn(results);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWalletlibService::Observe(nsISupports*, const PRUnichar*, const PRUnichar*)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
#define CRLF "\015\012"
|
||||
@ -186,31 +178,27 @@ NS_IMETHODIMP nsWalletlibService::Notify(nsIContent* formNode)
|
||||
|
||||
void nsWalletlibService::Init()
|
||||
{
|
||||
nsIObserverService *svc = 0;
|
||||
nsIDocumentLoader *docLoaderService;
|
||||
nsIObserverService *svc = 0;
|
||||
nsIDocumentLoader *docLoaderService;
|
||||
|
||||
nsresult rv = nsServiceManager::GetService( NS_OBSERVERSERVICE_PROGID,
|
||||
nsIObserverService::GetIID(),
|
||||
(nsISupports**)&svc );
|
||||
if ( NS_SUCCEEDED( rv ) && svc ) {
|
||||
nsString topic(NS_FORMSUBMIT_SUBJECT);
|
||||
rv = svc->AddObserver( this, topic.GetUnicode());
|
||||
nsServiceManager::ReleaseService( NS_OBSERVERSERVICE_PROGID, svc );
|
||||
}
|
||||
nsresult rv = nsServiceManager::GetService
|
||||
(NS_OBSERVERSERVICE_PROGID, nsIObserverService::GetIID(), (nsISupports**)&svc );
|
||||
if ( NS_SUCCEEDED( rv ) && svc ) {
|
||||
nsString topic(NS_FORMSUBMIT_SUBJECT);
|
||||
rv = svc->AddObserver( this, topic.GetUnicode());
|
||||
nsServiceManager::ReleaseService( NS_OBSERVERSERVICE_PROGID, svc );
|
||||
}
|
||||
|
||||
// Get the global document loader service...
|
||||
rv = nsServiceManager::GetService(kDocLoaderServiceCID,
|
||||
kIDocumentLoaderIID,
|
||||
(nsISupports **)&docLoaderService);
|
||||
if (NS_SUCCEEDED(rv) && docLoaderService) {
|
||||
//Register ourselves as an observer for the new doc loader
|
||||
docLoaderService->AddObserver((nsIDocumentLoaderObserver*)this);
|
||||
nsServiceManager::ReleaseService(kDocLoaderServiceCID, docLoaderService );
|
||||
}
|
||||
// Get the global document loader service...
|
||||
rv = nsServiceManager::GetService
|
||||
(kDocLoaderServiceCID, kIDocumentLoaderIID, (nsISupports **)&docLoaderService);
|
||||
if (NS_SUCCEEDED(rv) && docLoaderService) {
|
||||
//Register ourselves as an observer for the new doc loader
|
||||
docLoaderService->AddObserver((nsIDocumentLoaderObserver*)this);
|
||||
nsServiceManager::ReleaseService(kDocLoaderServiceCID, docLoaderService );
|
||||
}
|
||||
}
|
||||
|
||||
// nsIDocumentLoaderObserver methods
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWalletlibService::OnStartDocumentLoad(nsIDocumentLoader* aLoader, nsIURI* aURL, const char* aCommand)
|
||||
{
|
||||
@ -228,181 +216,174 @@ nsWalletlibService::OnEndDocumentLoad(nsIDocumentLoader* aLoader, nsIURI *aUrl,
|
||||
nsIDocumentLoaderObserver * aObserver)
|
||||
#endif
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
nsIContentViewerContainer *cont = nsnull;
|
||||
nsIWebShell *ws = nsnull;
|
||||
nsresult rv = NS_OK;
|
||||
nsIContentViewerContainer *cont = nsnull;
|
||||
nsIWebShell *ws = nsnull;
|
||||
|
||||
if (aLoader == nsnull) {
|
||||
return rv;
|
||||
}
|
||||
rv = aLoader->GetContainer(&cont);
|
||||
if (NS_FAILED(rv) || (cont == nsnull)) {
|
||||
return rv;
|
||||
}
|
||||
rv = cont->QueryInterface(nsIWebShell::GetIID(), (void **)&ws);
|
||||
if (NS_FAILED(rv) || (ws == nsnull)) {
|
||||
NS_RELEASE(cont);
|
||||
return rv;
|
||||
}
|
||||
nsIContentViewer* cv = nsnull;
|
||||
rv = ws->GetContentViewer(&cv);
|
||||
if (NS_FAILED(rv) || (cv == nsnull)) {
|
||||
NS_RELEASE(ws);
|
||||
NS_RELEASE(cont);
|
||||
return rv;
|
||||
}
|
||||
nsIDocumentViewer* docViewer = nsnull;
|
||||
rv = cv->QueryInterface(nsIDocumentViewer::GetIID(), (void**) &docViewer);
|
||||
if (NS_FAILED(rv) || (docViewer == nsnull)) {
|
||||
NS_RELEASE(cv);
|
||||
NS_RELEASE(ws);
|
||||
NS_RELEASE(cont);
|
||||
return rv;
|
||||
}
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
rv = docViewer->GetDocument(*getter_AddRefs(doc));
|
||||
if (NS_FAILED(rv) || (doc == nsnull)) {
|
||||
NS_RELEASE(docViewer);
|
||||
NS_RELEASE(cv);
|
||||
NS_RELEASE(ws);
|
||||
NS_RELEASE(cont);
|
||||
return rv;
|
||||
}
|
||||
if (aLoader == nsnull) {
|
||||
return rv;
|
||||
}
|
||||
rv = aLoader->GetContainer(&cont);
|
||||
if (NS_FAILED(rv) || (cont == nsnull)) {
|
||||
return rv;
|
||||
}
|
||||
rv = cont->QueryInterface(nsIWebShell::GetIID(), (void **)&ws);
|
||||
if (NS_FAILED(rv) || (ws == nsnull)) {
|
||||
NS_RELEASE(cont);
|
||||
return rv;
|
||||
}
|
||||
nsIContentViewer* cv = nsnull;
|
||||
rv = ws->GetContentViewer(&cv);
|
||||
if (NS_FAILED(rv) || (cv == nsnull)) {
|
||||
NS_RELEASE(ws);
|
||||
NS_RELEASE(cont);
|
||||
return rv;
|
||||
}
|
||||
nsIDocumentViewer* docViewer = nsnull;
|
||||
rv = cv->QueryInterface(nsIDocumentViewer::GetIID(), (void**) &docViewer);
|
||||
if (NS_FAILED(rv) || (docViewer == nsnull)) {
|
||||
NS_RELEASE(cv);
|
||||
NS_RELEASE(ws);
|
||||
NS_RELEASE(cont);
|
||||
return rv;
|
||||
}
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
rv = docViewer->GetDocument(*getter_AddRefs(doc));
|
||||
if (NS_FAILED(rv) || (doc == nsnull)) {
|
||||
NS_RELEASE(docViewer);
|
||||
NS_RELEASE(cv);
|
||||
NS_RELEASE(ws);
|
||||
NS_RELEASE(cont);
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* get url name as ascii string */
|
||||
char *URLName = nsnull;
|
||||
nsIURI* docURL = nsnull;
|
||||
/* get url name as ascii string */
|
||||
char *URLName = nsnull;
|
||||
nsIURI* docURL = nsnull;
|
||||
#ifdef NECKO
|
||||
char* spec;
|
||||
char* spec;
|
||||
#else
|
||||
const char* spec;
|
||||
const char* spec;
|
||||
#endif
|
||||
if (!doc) {
|
||||
return NS_OK;
|
||||
}
|
||||
docURL = doc->GetDocumentURL();
|
||||
if (!docURL) {
|
||||
return NS_OK;
|
||||
}
|
||||
(void)docURL->GetSpec(&spec);
|
||||
URLName = (char*)PR_Malloc(PL_strlen(spec)+1);
|
||||
PL_strcpy(URLName, spec);
|
||||
NS_IF_RELEASE(docURL);
|
||||
if (!doc) {
|
||||
return NS_OK;
|
||||
}
|
||||
docURL = doc->GetDocumentURL();
|
||||
if (!docURL) {
|
||||
return NS_OK;
|
||||
}
|
||||
(void)docURL->GetSpec(&spec);
|
||||
URLName = (char*)PR_Malloc(PL_strlen(spec)+1);
|
||||
PL_strcpy(URLName, spec);
|
||||
NS_IF_RELEASE(docURL);
|
||||
#ifdef NECKO
|
||||
nsCRT::free(spec);
|
||||
nsCRT::free(spec);
|
||||
#endif
|
||||
|
||||
nsIDOMHTMLDocument *htmldoc = nsnull;
|
||||
rv = doc->QueryInterface(kIDOMHTMLDocumentIID, (void**)&htmldoc);
|
||||
if (NS_FAILED(rv) || (htmldoc == nsnull)) {
|
||||
NS_RELEASE(docViewer);
|
||||
NS_RELEASE(cv);
|
||||
NS_RELEASE(ws);
|
||||
NS_RELEASE(cont);
|
||||
return rv;
|
||||
}
|
||||
nsIDOMHTMLDocument *htmldoc = nsnull;
|
||||
rv = doc->QueryInterface(kIDOMHTMLDocumentIID, (void**)&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);
|
||||
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);
|
||||
NS_RELEASE(cont);
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
#ifdef NECKO
|
||||
nsWalletlibService::OnStartURLLoad(nsIDocumentLoader* loader,
|
||||
nsIChannel* channel,
|
||||
nsIContentViewer* aViewer)
|
||||
nsWalletlibService::OnStartURLLoad
|
||||
(nsIDocumentLoader* loader, nsIChannel* channel, nsIContentViewer* aViewer)
|
||||
#else
|
||||
nsWalletlibService::OnStartURLLoad(nsIDocumentLoader* loader,
|
||||
nsIURI* aURL, const char* aContentType,
|
||||
nsIContentViewer* aViewer)
|
||||
nsWalletlibService::OnStartURLLoad
|
||||
(nsIDocumentLoader* loader, nsIURI* aURL, const char* aContentType, nsIContentViewer* aViewer)
|
||||
#endif
|
||||
{
|
||||
|
||||
return NS_OK;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
#ifdef NECKO
|
||||
nsWalletlibService::OnProgressURLLoad(nsIDocumentLoader* loader,
|
||||
nsIChannel* channel, PRUint32 aProgress,
|
||||
PRUint32 aProgressMax)
|
||||
nsWalletlibService::OnProgressURLLoad
|
||||
(nsIDocumentLoader* loader, nsIChannel* channel, PRUint32 aProgress, PRUint32 aProgressMax)
|
||||
#else
|
||||
nsWalletlibService::OnProgressURLLoad(nsIDocumentLoader* loader,
|
||||
nsIURI* aURL, PRUint32 aProgress,
|
||||
PRUint32 aProgressMax)
|
||||
nsWalletlibService::OnProgressURLLoad
|
||||
(nsIDocumentLoader* loader, nsIURI* aURL, PRUint32 aProgress, PRUint32 aProgressMax)
|
||||
#endif
|
||||
{
|
||||
return NS_OK;
|
||||
@ -410,44 +391,38 @@ nsWalletlibService::OnProgressURLLoad(nsIDocumentLoader* loader,
|
||||
|
||||
NS_IMETHODIMP
|
||||
#ifdef NECKO
|
||||
nsWalletlibService::OnStatusURLLoad(nsIDocumentLoader* loader,
|
||||
nsIChannel* channel, nsString& aMsg)
|
||||
nsWalletlibService::OnStatusURLLoad
|
||||
(nsIDocumentLoader* loader, nsIChannel* channel, nsString& aMsg)
|
||||
#else
|
||||
nsWalletlibService::OnStatusURLLoad(nsIDocumentLoader* loader,
|
||||
nsIURI* aURL, nsString& aMsg)
|
||||
nsWalletlibService::OnStatusURLLoad(nsIDocumentLoader* loader, nsIURI* aURL, nsString& aMsg)
|
||||
#endif
|
||||
{
|
||||
return NS_OK;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
#ifdef NECKO
|
||||
nsWalletlibService::OnEndURLLoad(nsIDocumentLoader* loader,
|
||||
nsIChannel* channel, nsresult aStatus)
|
||||
nsWalletlibService::OnEndURLLoad
|
||||
(nsIDocumentLoader* loader, nsIChannel* channel, nsresult aStatus)
|
||||
#else
|
||||
nsWalletlibService::OnEndURLLoad(nsIDocumentLoader* loader,
|
||||
nsIURI* aURL, PRInt32 aStatus)
|
||||
nsWalletlibService::OnEndURLLoad
|
||||
(nsIDocumentLoader* loader, nsIURI* aURL, PRInt32 aStatus)
|
||||
#endif
|
||||
{
|
||||
|
||||
return NS_OK;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
#ifdef NECKO
|
||||
nsWalletlibService::HandleUnknownContentType(nsIDocumentLoader* loader,
|
||||
nsIChannel* channel,
|
||||
const char *aContentType,
|
||||
const char *aCommand )
|
||||
nsWalletlibService::HandleUnknownContentType
|
||||
(nsIDocumentLoader* loader, nsIChannel* channel, const char *aContentType, const char *aCommand )
|
||||
#else
|
||||
nsWalletlibService::HandleUnknownContentType(nsIDocumentLoader* loader,
|
||||
nsIURI *aURL,
|
||||
const char *aContentType,
|
||||
const char *aCommand )
|
||||
nsWalletlibService::HandleUnknownContentType
|
||||
(nsIDocumentLoader* loader, nsIURI *aURL, const char *aContentType, const char *aCommand )
|
||||
#endif
|
||||
{
|
||||
return NS_OK;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* call to create the wallet object */
|
||||
@ -455,11 +430,11 @@ nsWalletlibService::HandleUnknownContentType(nsIDocumentLoader* loader,
|
||||
nsresult
|
||||
NS_NewWalletService(nsIWalletService** result)
|
||||
{
|
||||
nsIWalletService* wallet = new nsWalletlibService();
|
||||
if (! wallet)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
*result = wallet;
|
||||
NS_ADDREF(*result);
|
||||
return NS_OK;
|
||||
nsIWalletService* wallet = new nsWalletlibService();
|
||||
if (! wallet) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
*result = wallet;
|
||||
NS_ADDREF(*result);
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -31,69 +31,77 @@ class nsWalletlibService : public nsIWalletService,
|
||||
public nsIDocumentLoaderObserver {
|
||||
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
nsWalletlibService();
|
||||
NS_DECL_ISUPPORTS
|
||||
nsWalletlibService();
|
||||
|
||||
/* Implementation of the nsIWalletService interface */
|
||||
NS_IMETHOD WALLET_ChangePassword();
|
||||
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_PrefillReturn(nsAutoString results);
|
||||
/* Implementation of the nsIWalletService interface */
|
||||
NS_IMETHOD WALLET_PreEdit(nsAutoString& walletList);
|
||||
NS_IMETHOD WALLET_PostEdit(nsAutoString walletList);
|
||||
NS_IMETHOD WALLET_ChangePassword();
|
||||
NS_IMETHOD WALLET_Prefill(nsIPresShell* shell, nsString url, PRBool quick);
|
||||
NS_IMETHOD WALLET_PrefillReturn(nsAutoString results);
|
||||
|
||||
NS_IMETHOD SI_DisplaySignonInfoAsHTML();
|
||||
NS_IMETHOD SI_SignonViewerReturn(nsAutoString results);
|
||||
NS_IMETHOD SI_GetSignonListForViewer(nsString& aSignonList);
|
||||
NS_IMETHOD SI_GetRejectListForViewer(nsString& aRejectList);
|
||||
NS_IMETHOD WALLET_GetNopreviewListForViewer(nsString& aNopreviewList);
|
||||
NS_IMETHOD WALLET_GetNocaptureListForViewer(nsString& aNocaptureList);
|
||||
NS_IMETHOD WALLET_GetPrefillListForViewer(nsString& aPrefillList);
|
||||
NS_IMETHOD SI_PromptUsernameAndPassword
|
||||
(char *prompt, char **username, char **password, char *URLName, PRBool &status);
|
||||
NS_IMETHOD SI_PromptPassword
|
||||
(char *prompt, char **password, char *URLName, PRBool pickFirstUser);
|
||||
NS_IMETHOD SI_Prompt
|
||||
(char *prompt, char **username, char *URLName);
|
||||
|
||||
NS_IMETHOD SI_PromptUsernameAndPassword
|
||||
(char *prompt, char **username, char **password, char *URLName, PRBool &status);
|
||||
NS_IMETHOD SI_PromptPassword
|
||||
(char *prompt, char **password, char *URLName, PRBool pickFirstUser);
|
||||
NS_IMETHOD SI_Prompt
|
||||
(char *prompt, char **username, char *URLName);
|
||||
NS_IMETHOD WALLET_GetNopreviewListForViewer(nsString& aNopreviewList);
|
||||
NS_IMETHOD WALLET_GetNocaptureListForViewer(nsString& aNocaptureList);
|
||||
NS_IMETHOD WALLET_GetPrefillListForViewer(nsString& aPrefillList);
|
||||
NS_IMETHOD SI_GetSignonListForViewer(nsString& aSignonList);
|
||||
NS_IMETHOD SI_GetRejectListForViewer(nsString& aRejectList);
|
||||
NS_IMETHOD SI_SignonViewerReturn(nsAutoString results);
|
||||
|
||||
// nsIObserver
|
||||
NS_DECL_IOBSERVER
|
||||
// nsIObserver
|
||||
NS_DECL_IOBSERVER
|
||||
NS_IMETHOD Notify(nsIContent* formNode);
|
||||
|
||||
NS_IMETHOD Notify(nsIContent* formNode);
|
||||
|
||||
|
||||
// nsIDocumentLoaderObserver
|
||||
// nsIDocumentLoaderObserver
|
||||
#ifdef NECKO
|
||||
NS_IMETHOD OnStartDocumentLoad(nsIDocumentLoader* loader, nsIURI* aURL, const char* aCommand);
|
||||
NS_IMETHOD OnEndDocumentLoad(nsIDocumentLoader* loader, nsIChannel* channel, nsresult aStatus, nsIDocumentLoaderObserver* aObserver);
|
||||
NS_IMETHOD OnStartURLLoad(nsIDocumentLoader* loader, nsIChannel* channel, nsIContentViewer* aViewer);
|
||||
NS_IMETHOD OnProgressURLLoad(nsIDocumentLoader* loader, nsIChannel* channel, PRUint32 aProgress, PRUint32 aProgressMax);
|
||||
NS_IMETHOD OnStatusURLLoad(nsIDocumentLoader* loader, nsIChannel* channel, nsString& aMsg);
|
||||
NS_IMETHOD OnEndURLLoad(nsIDocumentLoader* loader, nsIChannel* channel, nsresult aStatus);
|
||||
NS_IMETHOD HandleUnknownContentType(nsIDocumentLoader* loader, nsIChannel* channel, const char *aContentType,const char *aCommand );
|
||||
NS_IMETHOD OnStartDocumentLoad
|
||||
(nsIDocumentLoader* loader, nsIURI* aURL, const char* aCommand);
|
||||
NS_IMETHOD OnEndDocumentLoad
|
||||
(nsIDocumentLoader* loader, nsIChannel* channel, nsresult aStatus,
|
||||
nsIDocumentLoaderObserver* aObserver);
|
||||
NS_IMETHOD OnStartURLLoad
|
||||
(nsIDocumentLoader* loader, nsIChannel* channel, nsIContentViewer* aViewer);
|
||||
NS_IMETHOD OnProgressURLLoad
|
||||
(nsIDocumentLoader* loader, nsIChannel* channel, PRUint32 aProgress,
|
||||
PRUint32 aProgressMax);
|
||||
NS_IMETHOD OnStatusURLLoad
|
||||
(nsIDocumentLoader* loader, nsIChannel* channel, nsString& aMsg);
|
||||
NS_IMETHOD OnEndURLLoad
|
||||
(nsIDocumentLoader* loader, nsIChannel* channel, nsresult aStatus);
|
||||
NS_IMETHOD HandleUnknownContentType
|
||||
(nsIDocumentLoader* loader, nsIChannel* channel, const char *aContentType,
|
||||
const char *aCommand );
|
||||
#else
|
||||
NS_IMETHOD OnStartDocumentLoad(nsIDocumentLoader* loader, nsIURI* aURL, const char* aCommand);
|
||||
NS_IMETHOD OnEndDocumentLoad(nsIDocumentLoader* loader, nsIURI *aUrl, PRInt32 aStatus,
|
||||
nsIDocumentLoaderObserver * aObserver);
|
||||
|
||||
NS_IMETHOD OnStartURLLoad(nsIDocumentLoader* loader, nsIURI* aURL, const char* aContentType,
|
||||
nsIContentViewer* aViewer);
|
||||
NS_IMETHOD OnProgressURLLoad(nsIDocumentLoader* loader, nsIURI* aURL, PRUint32 aProgress,
|
||||
PRUint32 aProgressMax);
|
||||
NS_IMETHOD OnStatusURLLoad(nsIDocumentLoader* loader, nsIURI* aURL, nsString& aMsg);
|
||||
NS_IMETHOD OnEndURLLoad(nsIDocumentLoader* loader, nsIURI* aURL, PRInt32 aStatus);
|
||||
NS_IMETHOD HandleUnknownContentType(nsIDocumentLoader* loader,
|
||||
NS_IMETHOD OnStartDocumentLoad
|
||||
(nsIDocumentLoader* loader, nsIURI* aURL, const char* aCommand);
|
||||
NS_IMETHOD OnEndDocumentLoad
|
||||
(nsIDocumentLoader* loader, nsIURI *aUrl, PRInt32 aStatus,
|
||||
nsIDocumentLoaderObserver * aObserver);
|
||||
NS_IMETHOD OnStartURLLoad
|
||||
(nsIDocumentLoader* loader, nsIURI* aURL, const char* aContentType,
|
||||
nsIContentViewer* aViewer);
|
||||
NS_IMETHOD OnProgressURLLoad
|
||||
(nsIDocumentLoader* loader, nsIURI* aURL, PRUint32 aProgress, PRUint32 aProgressMax);
|
||||
NS_IMETHOD OnStatusURLLoad(nsIDocumentLoader* loader, nsIURI* aURL, nsString& aMsg);
|
||||
NS_IMETHOD OnEndURLLoad(nsIDocumentLoader* loader, nsIURI* aURL, PRInt32 aStatus);
|
||||
NS_IMETHOD HandleUnknownContentType(nsIDocumentLoader* loader,
|
||||
nsIURI *aURL,
|
||||
const char *aContentType,
|
||||
const char *aCommand );
|
||||
#endif
|
||||
|
||||
|
||||
protected:
|
||||
virtual ~nsWalletlibService();
|
||||
virtual ~nsWalletlibService();
|
||||
|
||||
private:
|
||||
void Init();
|
||||
void Init();
|
||||
};
|
||||
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -31,9 +31,6 @@
|
||||
|
||||
XP_BEGIN_PROTOS
|
||||
|
||||
extern void
|
||||
SINGSIGN_DisplaySignonInfoAsHTML();
|
||||
|
||||
extern void
|
||||
SINGSIGN_GetSignonListForViewer (nsString& aSignonList);
|
||||
|
||||
|
@ -391,10 +391,6 @@ SI_RegisterCallback(const char* domain, PrefChangedFunc callback, void* instance
|
||||
extern PRBool
|
||||
SI_GetBoolPref(const char * prefname, PRBool defaultvalue);
|
||||
|
||||
extern void
|
||||
SI_SetBoolPref(char * prefname, PRBool prefvalue);
|
||||
|
||||
|
||||
static const char *pref_captureForms =
|
||||
"wallet.captureForms";
|
||||
PRIVATE Bool wallet_captureForms = PR_FALSE;
|
||||
@ -2708,7 +2704,7 @@ wallet_ClearStopwatch();
|
||||
#define MAX_ARRAY_SIZE 500
|
||||
|
||||
extern void
|
||||
SI_RememberSignonDat2
|
||||
SINGSIGN_RememberSignonData
|
||||
(char* URLName, char** name_array, char** value_array, char** type_array, PRInt32 value_cnt);
|
||||
|
||||
PUBLIC void
|
||||
@ -2800,7 +2796,7 @@ WLLT_OnSubmit(nsIContent* formNode) {
|
||||
}
|
||||
|
||||
/* save login if appropriate */
|
||||
SI_RememberSignonDat2
|
||||
SINGSIGN_RememberSignonData
|
||||
(URLName, (char**)name_array, (char**)value_array, (char**)type_array, value_cnt);
|
||||
|
||||
/* save form if it meets all necessary conditions */
|
||||
|
Loading…
Reference in New Issue
Block a user