mirror of https://github.com/gorhill/uBlock.git
this hopefully fixes #955
This commit is contained in:
parent
651c620226
commit
cb1a176e21
|
@ -2384,15 +2384,34 @@ vAPI.toolbarButton = {
|
|||
});
|
||||
};
|
||||
|
||||
// https://github.com/gorhill/uBlock/issues/955
|
||||
// Defer until `NativeWindow` is available.
|
||||
tbb.initOne = function(win, tryCount) {
|
||||
if ( typeof tryCount !== 'number' ) {
|
||||
tryCount = 0;
|
||||
}
|
||||
if ( !win.NativeWindow ) {
|
||||
tryCount += 1;
|
||||
if ( tryCount < 10 ) {
|
||||
vAPI.setTimeout(
|
||||
this.initOne.bind(this, win, tryCount),
|
||||
200
|
||||
);
|
||||
}
|
||||
return;
|
||||
}
|
||||
var label = this.getMenuItemLabel();
|
||||
var id = win.NativeWindow.menu.add({
|
||||
name: label,
|
||||
callback: this.onClick
|
||||
});
|
||||
menuItemIds.set(win, id);
|
||||
};
|
||||
|
||||
tbb.init = function() {
|
||||
// Only actually expecting one window under Fennec (note, not tabs, windows)
|
||||
for ( var win of winWatcher.getWindows() ) {
|
||||
var label = this.getMenuItemLabel();
|
||||
var id = win.NativeWindow.menu.add({
|
||||
name: label,
|
||||
callback: this.onClick
|
||||
});
|
||||
menuItemIds.set(win, id);
|
||||
this.initOne(win);
|
||||
}
|
||||
|
||||
cleanupTasks.push(shutdown);
|
||||
|
|
Loading…
Reference in New Issue