home *** CD-ROM | disk | FTP | other *** search
/ PC Advisor 2005 August / PCADVD_121.iso / internet / nsb-setup.exe / chrome / browser.jar / content / browser / sitecontrols / blacklistUtils.js < prev    next >
Encoding:
Text File  |  2005-02-11  |  1.9 KB  |  76 lines

  1. var blacklistUtils = {
  2.  
  3.     // Set this to false to disable debug output
  4.     DEBUG : false,
  5.  
  6.     // Globals
  7.     prefService : null,
  8.  
  9.  
  10.     Init : function() {
  11.         this.debug('Init()');
  12.  
  13.         // Pref Service
  14.         if (!this.prefService) {
  15.             this.prefService = Components.classes["@mozilla.org/preferences-service;1"]
  16.                                          .getService(Components.interfaces.nsIPrefBranch);
  17.         }
  18.     },
  19.  
  20.  
  21.     IsSiteInPhishList : function(uri) {
  22.         if (!uri) return false;
  23.         this.lastSite = uri.spec;
  24.         var trustLevel = sitecontrols.SCSVC.getSiteTrustLevel(uri.spec);
  25.         var rtval = (trustLevel == 2 || trustLevel == 6);
  26.         if (rtval)
  27.         { // 0 = whitelist, 1 = phishlist, 2 = spylist
  28.             var bitmask = sitecontrols.SCSVC.getSiteTrustLevelDetail(uri.spec, 1);
  29.             var providers = sitecontrols.SCSVC.getSiteTrustProviderName(bitmask);
  30.             this.lastSitePartners = providers.split("|");
  31.         } else {
  32.         //    this.lastSitePartners = null;            
  33.         }
  34.         this.debug('IsSiteInPhishList('+uri.spec+'): '+((rtval)?'Yes':'No'));
  35.         return rtval;
  36.     },
  37.  
  38.  
  39.     IsSiteInSpywareList : function(uri) {
  40.         if (!uri) return false;
  41.         this.lastSite = uri.spec;
  42.         var trustLevel = sitecontrols.SCSVC.getSiteTrustLevel(uri.spec);
  43.         var rtval = (trustLevel == 4 || trustLevel == 6);
  44.         if (rtval)
  45.         {
  46.             var bitmask = sitecontrols.SCSVC.getSiteTrustLevelDetail(uri.spec, 2);
  47.             var providers = sitecontrols.SCSVC.getSiteTrustProviderName(bitmask);
  48.             this.lastSitePartners = providers.split("|");
  49.         } else {
  50.             // this.lastSitePartners = null;            
  51.         }
  52.         this.debug('IsSiteInSpywareList('+uri.spec+'): '+((rtval)?'Yes':'No'));
  53.         return rtval;
  54.     },
  55.     
  56.     lastSite : null,
  57.     lastSitePartners : null,
  58.     
  59.     showTrustedPartners : function()
  60.     {
  61.                 window.openDialog("chrome://browser/content/trustPartners.xul", "_blank",
  62.         "modal,resizable,centerscreen", this.lastSitePartners);
  63.         
  64.     },
  65.  
  66.  
  67.     debug : function(msg) {
  68.         // set DEBUG at the top of this file to 'false'
  69.         // to disable debug output
  70.         if (this.DEBUG)
  71.             dump('blacklistUtils.js: '+msg+'\n');
  72.     }
  73.  
  74. };
  75. blacklistUtils.Init();
  76.