backing out changes that keep mozilla mailnews from working without psm.

This commit is contained in:
leaf%mozilla.org 2000-04-25 22:47:44 +00:00
Родитель 8c8e19f7a2
Коммит 609eff55b8
9 изменённых файлов: 1292 добавлений и 502 удалений

Просмотреть файл

@ -24,7 +24,6 @@
/* universal global variables */
var walleteditor = null; // walleteditor interface
var walletservice = null; // walletservices interface
var walletList = []; // input stream
var bundle = null; // string bundle
var JS_STRINGS_FILE = "chrome://communicator/locale/wallet/WalletEditor.properties";
@ -50,49 +49,13 @@ function ViewSynonymsFromXul(){
/*** =================== STARTING AND STOPPING =================== ***/
/* decrypt a value */
function Decrypt(crypt) {
try {
return walletservice.WALLET_Decrypt(crypt);
} catch (ex) {
return bundle.GetStringFromName("EncryptionFailure");
}
}
/* encrypt a value */
function Encrypt(text) {
try {
return walletservice.WALLET_Encrypt(text);
} catch (ex) {
alert(bundle.GetStringFromName("UnableToUnlockDatabase"));
return "";
}
}
/* see if user was able to unlock the database */
function EncryptionTest() {
try {
walletservice.WALLET_Encrypt("dummy");
} catch (ex) {
alert(bundle.GetStringFromName("UnableToUnlockDatabase"));
window.close();
}
}
/* initializes the wallet editor dialog */
function Startup()
{
walleteditor = Components.classes["component://netscape/walleteditor/walleteditor-world"].createInstance();
walleteditor = walleteditor.QueryInterface(Components.interfaces.nsIWalletEditor);
walletservice = Components.classes['component://netscape/wallet'];
walletservice = walletservice.getService();
walletservice = walletservice.QueryInterface(Components.interfaces.nsIWalletService);
bundle = srGetStrBundle(JS_STRINGS_FILE); /* initialize string bundle */
EncryptionTest(); /* abort if user failed to unlock the database */
if (!FetchInput()) {
return; /* user failed to unlock the database */
}
@ -158,7 +121,7 @@ function FetchInput()
}
}
}
entries[j] = stringsLength-1;
entries[j] = stringsLength;
j = 0;
for (i=0; i<entriesLength; i++) {
if (i == 0 || (strings[entries[i]] != strings[entries[i-1]])) {
@ -418,8 +381,7 @@ function ViewEntries()
var lastPlusOne = schemas[FirstSelectedSchema()+1];
for (i=first; i<lastPlusOne; i++) {
if (strings[entries[i]+1] != "") {
var text = Decrypt(strings[entries[i]+1]);
AddItem("entrieslist", [text], "tree_", i-first);
AddItem("entrieslist", [strings[entries[i]+1]], "tree_", i-first);
}
}
SchemaSelected();
@ -439,8 +401,7 @@ function ViewSynonyms()
var first = entries[schemas[FirstSelectedSchema()]+FirstSelectedEntry()]+2;
var lastPlusOne = entries[schemas[FirstSelectedSchema()]+FirstSelectedEntry()+1]-1;
for (i=first; i<lastPlusOne; i++) {
var text = Decrypt(strings[i]);
AddItem("synonymslist", [text], "tree_", i-first);
AddItem("synonymslist", [strings[i]], "tree_", i-first);
}
EntrySelected();
}
@ -571,19 +532,14 @@ function AddEntry0() {
if (text == "") {
return;
}
var crypt = Encrypt(text);
if (crypt == "") {
/* user failed to unlock the database */
return;
}
stringIndex = entries[schemas[FirstSelectedSchema()]+FirstSelectedEntry()];
if(strings[entries[schemas[FirstSelectedSchema()]+FirstSelectedEntry()]+1]=="") {
addString(entries[schemas[FirstSelectedSchema()]+FirstSelectedEntry()]+1, crypt);
addString(entries[schemas[FirstSelectedSchema()]+FirstSelectedEntry()]+1, text);
return;
}
addString(stringIndex, strings[entries[schemas[FirstSelectedSchema()]]]);
addString(stringIndex+1, crypt);
addString(stringIndex+1, text);
addString(stringIndex+2, "");
entriesLength++;
@ -603,12 +559,7 @@ function AddSynonym0() {
if (text == "") {
return;
}
var crypt = Encrypt(text);
if (crypt == "") {
/* user failed to unlock the database */
return;
}
addString(entries[schemas[FirstSelectedSchema()]+FirstSelectedEntry()]+2, crypt);
addString(entries[schemas[FirstSelectedSchema()]+FirstSelectedEntry()]+2, text);
}
function deleteString(stringToDelete) {

Просмотреть файл

@ -21,5 +21,3 @@
EnterNewSchema=Enter a new field name
EnterNewEntry=Enter a new value for the field
EnterNewSynonym=Enter another value that means the same thing
EncryptionFailure=Encryption Failure
UnableToUnlockDatabase=Unable to unlock database

Просмотреть файл

@ -70,7 +70,4 @@ interface nsIWalletService : nsISupports {
[noscript] void SI_GetSignonListForViewer(in nsAutoStringRef aSignonList);
[noscript] void SI_GetRejectListForViewer(in nsAutoStringRef aRejectList);
[noscript] void SI_SignonViewerReturn(in nsAutoString results);
string WALLET_Encrypt(in wstring text);
wstring WALLET_Decrypt(in string crypt);
};

Просмотреть файл

@ -25,15 +25,19 @@
#include "nsIModule.h"
#include "nsIGenericFactory.h"
#include "nsWalletService.h"
#include "nsBasicStreamGenerator.h"
// Define the constructor function for the nsWalletlibService
NS_GENERIC_FACTORY_CONSTRUCTOR(nsWalletlibService)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsBasicStreamGenerator)
// The list of components we register
static nsModuleComponentInfo components[] = {
{ NS_WALLETSERVICE_CLASSNAME, NS_WALLETSERVICE_CID,
NS_WALLETSERVICE_PROGID, nsWalletlibServiceConstructor },
{ NS_BASIC_STREAM_GENERATOR_CLASSNAME, NS_BASIC_STREAM_GENERATOR_CID,
NS_BASIC_STREAM_GENERATOR_PROGID, nsBasicStreamGeneratorConstructor },
};
NS_IMPL_NSGETMODULE("nsWalletModule", components)

Просмотреть файл

@ -43,6 +43,9 @@
static NS_DEFINE_IID(kDocLoaderServiceCID, NS_DOCUMENTLOADER_SERVICE_CID);
// Defined and used in wallet.cpp
extern nsIKeyedStreamGenerator *gKeyedStreamGenerator;
nsWalletlibService::nsWalletlibService()
{
NS_INIT_REFCNT();
@ -56,13 +59,16 @@ nsWalletlibService::~nsWalletlibService()
#ifdef DEBUG_dp
printf("Wallet Service destroyed successfully.\n");
#endif /* DEBUG_dp */
// Release the keyed stream generator that we might have acquired
NS_IF_RELEASE(gKeyedStreamGenerator);
}
NS_IMPL_THREADSAFE_ISUPPORTS5(nsWalletlibService,
NS_IMPL_THREADSAFE_ISUPPORTS6(nsWalletlibService,
nsIWalletService,
nsIObserver,
nsIFormSubmitObserver,
nsIDocumentLoaderObserver,
nsIPasswordSink,
nsISupportsWeakReference)
NS_IMETHODIMP nsWalletlibService::WALLET_PreEdit(nsAutoString& walletList) {
@ -385,7 +391,7 @@ nsWalletlibService::OnEndURLLoad
NS_IMETHODIMP
nsWalletlibService::GetPassword(PRUnichar **password)
{
return NS_ERROR_FAILURE;
return Wallet_GetMasterPassword(password);
}
NS_IMETHODIMP
@ -393,21 +399,3 @@ nsWalletlibService::HaveData(const char *url, const PRUnichar *userName, PRBool
{
return ::SINGSIGN_HaveData(url, userName, stripUrl, _retval);
}
NS_IMETHODIMP
nsWalletlibService::WALLET_Encrypt (const PRUnichar *text, char **crypt) {
nsAutoString textAutoString = text;
nsAutoString cryptAutoString;
PRBool rv = ::Wallet_Encrypt(textAutoString, cryptAutoString);
*crypt = cryptAutoString.ToNewCString();
return rv;
}
NS_IMETHODIMP
nsWalletlibService::WALLET_Decrypt (const char *crypt, PRUnichar **text) {
nsAutoString cryptAutoString = crypt;
nsAutoString textAutoString;
PRBool rv = ::Wallet_Decrypt(cryptAutoString, textAutoString);
*text = textAutoString.ToNewUnicode();
return rv;
}

Просмотреть файл

@ -75,9 +75,6 @@ public:
NS_IMETHOD SI_GetRejectListForViewer(nsAutoString& aRejectList);
NS_IMETHOD SI_SignonViewerReturn(nsAutoString results);
NS_IMETHOD WALLET_Encrypt (const PRUnichar *text, char **crypt);
NS_IMETHOD WALLET_Decrypt (const char *crypt, PRUnichar **text);
// nsIObserver
NS_DECL_NSIOBSERVER
NS_IMETHOD Notify(nsIContent* formNode, nsIDOMWindow* window, nsIURI* actionURL);

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -73,11 +73,8 @@ WLLT_FetchFromNetCenter();
extern void
WLLT_ExpirePassword();
extern nsresult
Wallet_Encrypt (nsAutoString text, nsAutoString& crypt);
extern nsresult
Wallet_Decrypt (nsAutoString crypt, nsAutoString& text);
extern NS_METHOD
Wallet_GetMasterPassword(PRUnichar **password);
XP_END_PROTOS