ドメイン抽出処理を修正

git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@4217 599a83e7-65a4-db11-8015-0010dcdd6dc2
This commit is contained in:
piro 2009-04-28 07:30:54 +00:00
parent 95d4fe8b9d
commit 711baa853d

View File

@ -326,13 +326,13 @@ var TreeStyleTabService = {
var b = this.getTabBrowserFromFrame(frame); var b = this.getTabBrowserFromFrame(frame);
var nextTab = b.treeStyleTab.getNextSiblingTab(currentTab); var nextTab = b.treeStyleTab.getNextSiblingTab(currentTab);
var targetHost = this._getDomainFromURI(info.uri); var targetHost = this._getDomainFromURI(this.makeURIFromSpec(info.uri));
var currentTab = this.getTabFromFrame(frame); var currentTab = this.getTabFromFrame(frame);
var currentURI = frame.location.href; var currentURI = frame.location.href;
var currentHost = this._getDomainFromURI(currentURI); var currentHost = this._getDomainFromURI(this.makeURIFromSpec(currentURI));
var parentTab = b.treeStyleTab.getParentTab(currentTab); var parentTab = b.treeStyleTab.getParentTab(currentTab);
var parentURI = parentTab ? parentTab.linkedBrowser.currentURI : null ; var parentURI = parentTab ? parentTab.linkedBrowser.currentURI : null ;
var parentHost = parentURI ? this._getDomainFromURI(parentURI.spec) : null ; var parentHost = this._getDomainFromURI(parentURI);
var openTab = false; var openTab = false;
var parent = null; var parent = null;
@ -388,15 +388,17 @@ var TreeStyleTabService = {
}, },
_getDomainFromURI : function(aURI) _getDomainFromURI : function(aURI)
{ {
var host = /^\w+:\/\/([^:\/]+)(\/|$)/.test(aURI) ? RegExp.$1 : null ; if (!aURI) return null;
if (host && this.getTreePref('useEffectiveTLD') && this.EffectiveTLD) { var domain;
if (this.getTreePref('useEffectiveTLD') && this.EffectiveTLD) {
try { try {
host = this.EffectiveTLD.getBaseDomainFromHost(host); domain = this.EffectiveTLD.getBaseDomain(aURI, 0);
} }
catch(e) { catch(e) {
} }
} }
return host; return domain ||
(/^\w+:\/\/([^:\/]+)/.test(aURI.spec) ? RegExp.$1 : null );
}, },
setTabbarWidth : function(aWidth, aForceExpanded) setTabbarWidth : function(aWidth, aForceExpanded)