aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgorhill <rhill@raymondhill.net>2015-10-09 10:37:02 -0400
committergorhill <rhill@raymondhill.net>2015-10-09 10:37:02 -0400
commit300968ac3420fe568ede9fd771c9898d53656c70 (patch)
tree5e089cdb6b181b5015b4997a3980e8646e9e0a2b
parentb885352724fe590669b46d514276cd01901d37d5 (diff)
downloaduBlock-300968ac3420fe568ede9fd771c9898d53656c70.zip
uBlock-300968ac3420fe568ede9fd771c9898d53656c70.tar.gz
uBlock-300968ac3420fe568ede9fd771c9898d53656c70.tar.bz2
this fixes more Thunderbird errors in console
-rw-r--r--platform/firefox/vapi-background.js15
1 files changed, 13 insertions, 2 deletions
diff --git a/platform/firefox/vapi-background.js b/platform/firefox/vapi-background.js
index 7038afb..ccbbcd8 100644
--- a/platform/firefox/vapi-background.js
+++ b/platform/firefox/vapi-background.js
@@ -1188,14 +1188,19 @@ var tabWatcher = (function() {
// Initialize map with existing active tabs
var start = function() {
- var tabBrowser, tab;
+ var tabBrowser, tabs, tab;
for ( var win of vAPI.tabs.getWindows() ) {
onWindowLoad.call(win);
tabBrowser = getTabBrowser(win);
if ( tabBrowser === null ) {
continue;
}
- for ( tab of tabBrowser.tabs ) {
+ // `tabBrowser.tabs` may not exist (Thunderbird).
+ tabs = tabBrowser.tabs;
+ if ( !tabs ) {
+ continue;
+ }
+ for ( tab of tabs ) {
if ( vAPI.fennec || !tab.hasAttribute('pending') ) {
tabIdFromTarget(tab);
}
@@ -2879,6 +2884,12 @@ vAPI.contextMenu.register = function(doc) {
}
var contextMenu = doc.getElementById('contentAreaContextMenu');
+
+ // This can happen (Thunderbird).
+ if ( contextMenu === null ) {
+ return;
+ }
+
var menuitem = doc.createElement('menuitem');
menuitem.setAttribute('id', this.menuItemId);
menuitem.setAttribute('label', this.menuLabel);