1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-10-04 16:47:15 +02:00

this fixes more Thunderbird errors in console

This commit is contained in:
gorhill 2015-10-09 10:37:02 -04:00
parent b885352724
commit 300968ac34

View File

@ -1188,14 +1188,19 @@ var tabWatcher = (function() {
// Initialize map with existing active tabs // Initialize map with existing active tabs
var start = function() { var start = function() {
var tabBrowser, tab; var tabBrowser, tabs, tab;
for ( var win of vAPI.tabs.getWindows() ) { for ( var win of vAPI.tabs.getWindows() ) {
onWindowLoad.call(win); onWindowLoad.call(win);
tabBrowser = getTabBrowser(win); tabBrowser = getTabBrowser(win);
if ( tabBrowser === null ) { if ( tabBrowser === null ) {
continue; 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') ) { if ( vAPI.fennec || !tab.hasAttribute('pending') ) {
tabIdFromTarget(tab); tabIdFromTarget(tab);
} }
@ -2879,6 +2884,12 @@ vAPI.contextMenu.register = function(doc) {
} }
var contextMenu = doc.getElementById('contentAreaContextMenu'); var contextMenu = doc.getElementById('contentAreaContextMenu');
// This can happen (Thunderbird).
if ( contextMenu === null ) {
return;
}
var menuitem = doc.createElement('menuitem'); var menuitem = doc.createElement('menuitem');
menuitem.setAttribute('id', this.menuItemId); menuitem.setAttribute('id', this.menuItemId);
menuitem.setAttribute('label', this.menuLabel); menuitem.setAttribute('label', this.menuLabel);