aboutsummaryrefslogtreecommitdiffstats
path: root/platform/firefox
diff options
context:
space:
mode:
Diffstat (limited to 'platform/firefox')
-rw-r--r--platform/firefox/install.rdf9
-rw-r--r--platform/firefox/vapi-background.js26
2 files changed, 31 insertions, 4 deletions
diff --git a/platform/firefox/install.rdf b/platform/firefox/install.rdf
index c0332ff..07b107f 100644
--- a/platform/firefox/install.rdf
+++ b/platform/firefox/install.rdf
@@ -59,5 +59,14 @@
<maxVersion>9.9</maxVersion>
</r:Description>
</targetApplication>
+
+ <!-- Thunderbird -->
+ <targetApplication>
+ <r:Description>
+ <id>{{3550f703-e582-4d05-9a08-453d09bdfdc6}}</id>
+ <minVersion>38.3</minVersion>
+ <maxVersion>45.0</maxVersion>
+ </r:Description>
+ </targetApplication>
</r:Description>
</r:RDF>
diff --git a/platform/firefox/vapi-background.js b/platform/firefox/vapi-background.js
index 8bc110b..d8a528d 100644
--- a/platform/firefox/vapi-background.js
+++ b/platform/firefox/vapi-background.js
@@ -40,6 +40,7 @@ const {Services} = Cu.import('resource://gre/modules/Services.jsm', null);
var vAPI = self.vAPI = self.vAPI || {};
vAPI.firefox = true;
vAPI.fennec = Services.appinfo.ID === '{aa3c5121-dab2-40e2-81ca-7ea25febc110}';
+vAPI.thunderbird = Services.appinfo.ID === '{3550f703-e582-4d05-9a08-453d09bdfdc6}';
/******************************************************************************/
@@ -524,7 +525,10 @@ vAPI.storage = (function() {
/******************************************************************************/
var getTabBrowser = function(win) {
- return vAPI.fennec && win.BrowserApp || win.gBrowser || null;
+ return vAPI.fennec && win.BrowserApp ||
+ vAPI.thunderbird && win.document.getElementById('tabmail') ||
+ win.gBrowser ||
+ null;
};
/******************************************************************************/
@@ -729,7 +733,7 @@ vAPI.tabs.open = function(details) {
}
}
- var win = Services.wm.getMostRecentWindow('navigator:browser');
+ var win = Services.wm.getMostRecentWindow(vAPI.thunderbird && 'mail:3pane' || 'navigator:browser');
var tabBrowser = getTabBrowser(win);
if ( vAPI.fennec ) {
@@ -750,6 +754,12 @@ vAPI.tabs.open = function(details) {
return;
}
+ if ( vAPI.thunderbird ) {
+ tabBrowser.openTab('contentTab', { contentPage: details.url, background: !details.active });
+ // TODO: Should be possible to move tabs on Thunderbird
+ return;
+ }
+
if ( details.index === -1 ) {
details.index = tabBrowser.browsers.indexOf(tabBrowser.selectedBrowser) + 1;
}
@@ -876,6 +886,9 @@ var tabWatcher = (function() {
var tabIdGenerator = 1;
var indexFromBrowser = function(browser) {
+ if (vAPI.thunderbird) // TODO: Add support for this
+ return -1;
+
var win = getOwnerWindow(browser);
if ( !win ) {
return -1;
@@ -966,13 +979,18 @@ var tabWatcher = (function() {
};
var currentBrowser = function() {
- var win = Services.wm.getMostRecentWindow('navigator:browser');
+ var win = Services.wm.getMostRecentWindow(vAPI.thunderbird && 'mail:3pane' || 'navigator:browser');
// https://github.com/gorhill/uBlock/issues/399
// getTabBrowser() can return null at browser launch time.
var tabBrowser = getTabBrowser(win);
if ( tabBrowser === null ) {
return null;
}
+ if (vAPI.thunderbird) {
+ // Directly at startup the first tab may not be initialized
+ if (tabBrowser.tabInfo.length == 0) return null;
+ return tabBrowser.getBrowserForSelectedTab();
+ }
return browserFromTarget(tabBrowser.selectedTab);
};
@@ -1186,7 +1204,7 @@ vAPI.setIcon = function(tabId, iconStatus, badge) {
// If badge is undefined, then setIcon was called from the TabSelect event
var win = badge === undefined
? iconStatus
- : Services.wm.getMostRecentWindow('navigator:browser');
+ : vAPI.thunderbird && Services.wm.getMostRecentWindow('mail:3pane') || Services.wm.getMostRecentWindow('navigator:browser');
var curTabId = tabWatcher.tabIdFromTarget(getTabBrowser(win).selectedTab);
var tb = vAPI.toolbarButton;