mDocLoaderService->AddObserver((nsIDocumentLoaderObserver*)this);
nsCOMPtr<nsIWebProgress> progress(do_QueryInterface(mDocLoaderService, &rv)); if (NS_SUCCEEDED(rv)) { (void) process->AddProgressListener((nsIWebProgressListener*)this); }
nsPICS::Init(){	nsresult rv;    nsresult res;    nsIPref* aPrefs;    nsString  aTopic("htmlparser");    nsIObserverService *anObserverService = nsnull; //   nsFileSpec mySpec("C:\\Program Files\\Netscape\\Users\\neeti\\prefs.js");        static PRBool first_time=PR_TRUE;    res = nsServiceManager::GetService(kPrefCID,                                     NS_GET_IID(nsIPref),                                     (nsISupports **)&aPrefs);    if (NS_OK != res) {      return res;    }    mPrefs = aPrefs;    if(!mPrefs)      return NS_ERROR_NULL_POINTER;    if(!first_time) {      return NS_OK;    } else {	  /*  char *password=NULL; */      first_time = PR_FALSE;            //  mPrefs->StartUpWith(mySpec);          /* get the prefs */	    PrefChangedCallback(PICS_DOMAIN, (void*)this);      mPrefs->RegisterCallback(PICS_DOMAIN, PrefChangedCallback, (void*)this);           // Get the global document loader service...        rv = nsServiceManager::GetService(kDocLoaderServiceCID,                                        kIDocumentLoaderIID,                                        (nsISupports **)&mDocLoaderService);      if (NS_SUCCEEDED(rv)) {        //Register ourselves as an observer for the new doc loader        mDocLoaderService->AddObserver((nsIDocumentLoaderObserver*)this);      }      if(mPICSRatingsEnabled) {        if (NS_FAILED(rv = NS_NewPICSElementObserver(&mPICSElementObserver)))          return rv;          rv = nsServiceManager::GetService(NS_OBSERVERSERVICE_CONTRACTID,                                 NS_GET_IID(nsIObserverService),                                 (nsISupports **)&anObserverService);        if(rv == NS_OK) {          rv = anObserverService->AddObserver(mPICSElementObserver, aTopic.GetUnicode());          nsServiceManager::ReleaseService( NS_OBSERVERSERVICE_CONTRACTID, anObserverService );          if (NS_FAILED(rv))              return rv;        }      }        	   /*  check for security pref that password disables the enableing of	     java permissions */	    /*        if(prefs->CopyCharPref(JAVA_SECURITY_PASSWORD, &password))		    password = NULL;	    if(password && *password)	    {		    // get prompt string from registry		     		    char *prompt_string = XP_GetString(XP_ALERT_PROMPT_JAVA_CAPIBILITIES_PASSWORD);		    char *user_password;		    char *hashed_password;prompt_again:		    // prompt the user for the password		     		    user_password = FE_PromptPassword(context, prompt_string);		    // ### one-way hash password 		    if(user_password)		    {				hashed_password = pics_hash_password(user_password);		    }            else            {                hashed_password = NULL;            }		    if(!hashed_password)            {                mPICSJavaCapabilitiesEnabled = PR_FALSE;            }            else if(!PL_strcmp(hashed_password, password))		    {			    mPICSJavaCapabilitiesEnabled = PR_TRUE;		    }		    else		    {                PR_Free(user_password);                PR_Free(hashed_password);       		    prompt_string = XP_GetString(XP_ALERT_PROMPT_JAVA_CAPIBILITIES_PASSWORD_FAILED_ONCE);                goto prompt_again;		    }		    PR_FREEIF(user_password);		    PR_FREEIF(hashed_password);		    	    }	    	    PR_FREEIF(password);		*/    }	return rv;}