This commit is contained in:
gorhill 2015-11-21 10:00:34 -05:00
parent c4e3e1e8e5
commit 50d7a5ebb7
3 changed files with 27 additions and 8 deletions

View file

@ -2,7 +2,7 @@
"manifest_version": 2,
"name": "uBlock Origin",
"version": "1.3.5",
"version": "1.3.6",
"default_locale": "en",
"description": "__MSG_extShortDesc__",

View file

@ -2384,15 +2384,34 @@ vAPI.toolbarButton = {
});
};
// https://github.com/gorhill/uBlock/issues/955
// Defer until `NativeWindow` is available.
tbb.initOne = function(win, tryCount) {
if ( !win.NativeWindow ) {
if ( typeof tryCount !== 'number' ) {
tryCount = 0;
}
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);

View file

@ -2,7 +2,7 @@
"manifest_version": 2,
"name": "uBlock Origin",
"version": "1.3.5",
"version": "1.3.6",
"default_locale": "en",
"description": "__MSG_extShortDesc__",