//同一ホストのタブを閉じる
{
var uri = gBrowser.currentURI;
var hostA, hostB;
try {
hostA = uri.host;
} catch(e) {
hostA = null;
}
if (!hostA)
return;
var tabs = Array.slice(gBrowser.mTabs);
tabs.reverse();
Array.forEach(tabs, function (tab) {
if (!tab.linkedBrowser.docShell.busyFlags &&
!tab.linkedBrowser.docShell.restoringDocument) {
try {
hostB = gBrowser.getBrowserForTab(tab).currentURI.host;
} catch(e) {
hostB = null;
}
if (hostA == hostB) {
gBrowser.removeTab(tab);
}
}
});
}
break;