Changeset 1034

Show
Ignore:
Timestamp:
08/03/08 15:43:31 (1 month ago)
Author:
MaierMan
Message:
  • Reflect changes in DTA_URL
  • Drop 1.8 compat
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • sandbox/serverswitcher/chrome/content/functions.js

    r956 r1034  
    3535 * ***** END LICENSE BLOCK ***** */ 
    3636  
    37  function SSW_getBaseDomain(uri) { 
    38                 try { 
    39                         if (!('nsIEffectiveTLDService' in Ci)) { 
    40                                 throw Exception("< 1.9"); 
    41                         } 
    42                         let eTLDsvc = Cc['@mozilla.org/network/effective-tld-service;1'].getService(Ci.nsIEffectiveTLDService); 
    43                         SSW_getBaseDomain = function(uri) { 
    44                                 try { 
    45                                         return eTLDsvc.getBaseDomain(uri); 
    46                                 } 
    47                                 catch (ex) { 
    48                                         return uri.host; 
    49                                 } 
    50                         } 
    51                 } 
    52                 catch (ex) { 
    53                         // no effective eTLDsvc 
    54                         // but we don't need much accuracy anyway. 
    55                         SSW_getBaseDomain = function(uri) { 
    56                 var m = uri.host.match(/([^.]+\.(?:[\w]{2,4}|museum)?(?:\.\w{2})?)$/); 
    57                 if (m) {  
    58                         return m[1]; 
    59                 } 
    60                 return uri.host; 
    61             } 
    62           } 
    63           return SSW_getBaseDomain(uri); 
     37const eTLDsvc = Cc['@mozilla.org/network/effective-tld-service;1'].getService(Ci.nsIEffectiveTLDService);  
     38  
     39function SSW_getBaseDomain(uri) { 
     40        try { 
     41                return eTLDsvc.getBaseDomain(uri); 
     42        } 
     43        catch (ex) { 
     44                return uri.host; 
     45        } 
    6446} 
  • sandbox/serverswitcher/chrome/content/manager.js

    r1033 r1034  
    216216        function() { 
    217217                if (!('_ssw_real_host' in this)) { 
    218                         this._ssw_real_host = SSW_getBaseDomain(this.urlManager.url.toURI()); 
     218                        this._ssw_real_host = SSW_getBaseDomain(this.urlManager.url); 
    219219                } 
    220220                return this._ssw_real_host;