3.7a4pre対応準備:getTabBrowserFromChildの改修

git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@6384 599a83e7-65a4-db11-8015-0010dcdd6dc2
This commit is contained in:
piro 2010-03-23 14:21:13 +00:00
parent 6c05a625c1
commit 024332c8cd
2 changed files with 13 additions and 11 deletions

View File

@ -12,7 +12,7 @@
in JS files: in JS files:
window['piro.sakura.ne.jp'].bookmarkMultipleTabs.addBookmarkFor(tabsArray, folderName); window['piro.sakura.ne.jp'].bookmarkMultipleTabs.addBookmarkFor(tabsArray, folderName);
lisence: The MIT License, Copyright (c) 2009 SHIMODA "Piro" Hiroshi lisence: The MIT License, Copyright (c) 2009-2010 SHIMODA "Piro" Hiroshi
http://www.cozmixng.org/repos/piro/fx3-compatibility-lib/trunk/license.txt http://www.cozmixng.org/repos/piro/fx3-compatibility-lib/trunk/license.txt
original: original:
http://www.cozmixng.org/repos/piro/fx3-compatibility-lib/trunk/bookmarkMultipleTabs.xul http://www.cozmixng.org/repos/piro/fx3-compatibility-lib/trunk/bookmarkMultipleTabs.xul
@ -24,7 +24,7 @@
window.addEventListener('DOMContentLoaded', function() { window.addEventListener('DOMContentLoaded', function() {
window.removeEventListener('DOMContentLoaded', arguments.callee, true); window.removeEventListener('DOMContentLoaded', arguments.callee, true);
const currentRevision = 3; const currentRevision = 4;
if (!('piro.sakura.ne.jp' in window)) window['piro.sakura.ne.jp'] = {}; if (!('piro.sakura.ne.jp' in window)) window['piro.sakura.ne.jp'] = {};
@ -105,18 +105,18 @@ window.addEventListener('DOMContentLoaded', function() {
}, },
addBookmarkTabsFilter : addBookmarkTabsFilter, addBookmarkTabsFilter : addBookmarkTabsFilter,
Prefs : Components.classes['@mozilla.org/preferences;1'] Prefs : Components.classes['@mozilla.org/preferences-service;']
.getService(Components.interfaces.nsIPrefBranch), .getService(Components.interfaces.nsIPrefBranch),
getTabBrowserFromChild : function(aTab) getTabBrowserFromChild : function(aTab)
{ {
return aTab.ownerDocument.evaluate( var b = this.evaluateXPath(
'ancestor-or-self::*[local-name()="tabbrowser"]', 'ancestor-or-self::*[local-name()="tabbrowser"] | '+
aTab, 'ancestor-or-self::*[local-name()="tabs"][@tabbrowser]',
null, aNode,
XPathResult.FIRST_ORDERED_NODE_TYPE, XPathResult.FIRST_ORDERED_NODE_TYPE
null
).singleNodeValue; ).singleNodeValue;
return (b && b.tabbrowser) || b;
} }
}; };
}, true); }, true);

View File

@ -782,11 +782,13 @@ var TreeStyleTabUtils = {
if (aTabBrowserChild.localName == 'tabbrowser') if (aTabBrowserChild.localName == 'tabbrowser')
return aTabBrowserChild; return aTabBrowserChild;
return this.evaluateXPath( var b = this.evaluateXPath(
'ancestor::xul:tabbrowser[1]', 'ancestor::xul:tabbrowser | '+
'ancestor::xul:tabs[@tabbrowser]',
aTabBrowserChild, aTabBrowserChild,
Ci.nsIDOMXPathResult.FIRST_ORDERED_NODE_TYPE Ci.nsIDOMXPathResult.FIRST_ORDERED_NODE_TYPE
).singleNodeValue; ).singleNodeValue;
return (b && b.tabbrowser) || b;
}, },
getTabBrowserFromFrame : function TSTUtils_getTabBrowserFromFrame(aFrame) getTabBrowserFromFrame : function TSTUtils_getTabBrowserFromFrame(aFrame)