getParentTabで無限ループに陥る可能性があった?

git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@6411 599a83e7-65a4-db11-8015-0010dcdd6dc2
This commit is contained in:
piro 2010-03-23 18:09:55 +00:00
parent bf892a0b1d
commit dfc2edef09

View File

@ -725,7 +725,7 @@ var TreeStyleTabUtils = {
getTabbarFromEvent : function TSTUtils_getTabbarFromEvent(aEvent) getTabbarFromEvent : function TSTUtils_getTabbarFromEvent(aEvent)
{ {
return this.evaluateXPath( return this.evaluateXPath(
'ancestor-or-self::*[contains(concat(" ", normalize-space(@class), " "), " tabbrowser-strip ")]', 'ancestor-or-self::*[contains(concat(" ", normalize-space(@class), " "), " tabbrowser-strip ") or (local-name()="tabs" and @tabbrowser)]',
aEvent.originalTarget || aEvent.target, aEvent.originalTarget || aEvent.target,
Ci.nsIDOMXPathResult.FIRST_ORDERED_NODE_TYPE Ci.nsIDOMXPathResult.FIRST_ORDERED_NODE_TYPE
).singleNodeValue; ).singleNodeValue;
@ -1261,11 +1261,12 @@ var TreeStyleTabUtils = {
if (!aTab) return null; if (!aTab) return null;
var id = aTab.getAttribute(this.kID); var id = aTab.getAttribute(this.kID);
if (!id) return null; // not initialized yet if (!id) return null; // not initialized yet
return this.evaluateXPath( var tab = this.evaluateXPath(
'parent::*/child::xul:tab[contains(concat("|", @'+this.kCHILDREN+', "|"), "|'+id+'|")]', 'parent::*/child::xul:tab[contains(concat("|", @'+this.kCHILDREN+', "|"), "|'+id+'|")]',
aTab, aTab,
Ci.nsIDOMXPathResult.FIRST_ORDERED_NODE_TYPE Ci.nsIDOMXPathResult.FIRST_ORDERED_NODE_TYPE
).singleNodeValue; ).singleNodeValue;
return tab == aTab ? null : tab ;
}, },
getRootTab : function TSTUtils_getRootTab(aTab) /* PUBLIC API */ getRootTab : function TSTUtils_getRootTab(aTab) /* PUBLIC API */