mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-22 18:32:45 +01:00
attach to window even if a tab browser is not present
This commit is contained in:
parent
e152db7004
commit
7e89b7a161
@ -1112,9 +1112,14 @@ var tabWatcher = (function() {
|
||||
|
||||
// On some platforms, the tab browser isn't immediately available,
|
||||
// try waiting a bit if this happens.
|
||||
// https://github.com/gorhill/uBlock/issues/763
|
||||
// Not getting a tab browser should not prevent from attaching ourself
|
||||
// to the window.
|
||||
var tabBrowser = getTabBrowser(window);
|
||||
if ( tabBrowser === null ) {
|
||||
attachToTabBrowserLater({ window: window, tryCount: tryCount });
|
||||
if (
|
||||
tabBrowser === null &&
|
||||
attachToTabBrowserLater({ window: window, tryCount: tryCount })
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1122,6 +1127,10 @@ var tabWatcher = (function() {
|
||||
vAPI.toolbarButton.attachToNewWindow(window);
|
||||
}
|
||||
|
||||
if ( tabBrowser === null ) {
|
||||
return;
|
||||
}
|
||||
|
||||
var tabContainer;
|
||||
if ( tabBrowser.deck ) { // Fennec
|
||||
tabContainer = tabBrowser.deck;
|
||||
@ -1206,7 +1215,15 @@ var tabWatcher = (function() {
|
||||
|
||||
// https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIWindowWatcher
|
||||
var windowWatcher = {
|
||||
observe: function(win, topic) {
|
||||
observe: function(subject, topic) {
|
||||
var win;
|
||||
try {
|
||||
win = subject.QueryInterface(Ci.nsIDOMWindow);
|
||||
} catch (ex) {
|
||||
}
|
||||
if ( !win ) {
|
||||
return;
|
||||
}
|
||||
if ( topic === 'domwindowopened' ) {
|
||||
onWindowLoad.call(win);
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user