aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaymond Hill <gorhill@users.noreply.github.com>2015-10-11 08:51:53 -0400
committerRaymond Hill <gorhill@users.noreply.github.com>2015-10-11 08:51:53 -0400
commit557f6611b50c4416c422a1224c259ed994346e68 (patch)
treefc8c449b9ab2979966f9339750171a6446f45800
parent80fe05dbc18d8a5db6cccfb194c57ba2e3039f7d (diff)
parent0eb42fdf4b949593e83d1d59f23c9de467913bfa (diff)
downloaduBlock-557f6611b50c4416c422a1224c259ed994346e68.zip
uBlock-557f6611b50c4416c422a1224c259ed994346e68.tar.gz
uBlock-557f6611b50c4416c422a1224c259ed994346e68.tar.bz2
Merge pull request #811 from M-Reimer/master
Thunderbird: Fix closing extension tabs
-rw-r--r--platform/firefox/vapi-background.js16
1 files changed, 13 insertions, 3 deletions
diff --git a/platform/firefox/vapi-background.js b/platform/firefox/vapi-background.js
index ccbbcd8..cff89ba 100644
--- a/platform/firefox/vapi-background.js
+++ b/platform/firefox/vapi-background.js
@@ -818,7 +818,7 @@ vAPI.tabs.replace = function(tabId, url) {
/******************************************************************************/
vAPI.tabs._remove = (function() {
- if ( vAPI.fennec ) {
+ if ( vAPI.fennec || vAPI.thunderbird ) {
return function(tab, tabBrowser) {
tabBrowser.closeTab(tab);
};
@@ -972,6 +972,13 @@ var tabWatcher = (function() {
if ( target.browser ) { // target is a tab
target = target.browser;
}
+ } else if ( vAPI.thunderbird ) {
+ if ( target.mode ) { // target is object with tab info
+ var browserFunc = target.mode.getBrowser || target.mode.tabType.getBrowser;
+ if (browserFunc) {
+ return browserFunc.call(target.mode.tabType, target);
+ }
+ }
} else if ( target.linkedPanel ) { // target is a tab
target = target.linkedBrowser;
}
@@ -1143,7 +1150,9 @@ var tabWatcher = (function() {
// To keep in mind: not all windows are tab containers,
// sometimes the window IS the tab.
var tabs;
- if ( tabBrowser.tabs ) {
+ if ( vAPI.thunderbird ) {
+ tabs = tabBrowser.tabInfo;
+ } else if ( tabBrowser.tabs ) {
tabs = tabBrowser.tabs;
} else if ( tabBrowser.localName === 'browser' ) {
tabs = [tabBrowser];
@@ -1152,7 +1161,8 @@ var tabWatcher = (function() {
}
var browser, URI, tabId;
- for ( var tab of tabs ) {
+ for ( var tabindex = tabs.length - 1; tabindex >= 0; tabindex-- ) {
+ var tab = tabs[tabindex];
browser = tabWatcher.browserFromTarget(tab);
if ( browser === null ) {
continue;