mirror of
https://github.com/gorhill/uBlock.git
synced 2024-10-06 09:37:12 +02:00
code review + fixes another potential error in browser console (re. popup blocking)
This commit is contained in:
parent
f8de57dd1a
commit
0bebc81369
@ -2717,13 +2717,10 @@ vAPI.toolbarButton = {
|
|||||||
// Pale Moon: `toolbox.externalToolbars` can be undefined. Seen while
|
// Pale Moon: `toolbox.externalToolbars` can be undefined. Seen while
|
||||||
// testing popup test number 3:
|
// testing popup test number 3:
|
||||||
// http://raymondhill.net/ublock/popup.html
|
// http://raymondhill.net/ublock/popup.html
|
||||||
var toolbars = [];
|
var toolbars = toolbox.externalToolbars ? toolbox.externalToolbars.slice() : [];
|
||||||
if ( toolbox.externalToolbars ) {
|
for ( var child of toolbox.children ) {
|
||||||
toolbars = toolbox.externalToolbars.slice();
|
if ( child.localName === 'toolbar' ) {
|
||||||
for ( var child of toolbox.children ) {
|
toolbars.push(child);
|
||||||
if ( child.localName === 'toolbar' ) {
|
|
||||||
toolbars.push(child);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2737,6 +2734,11 @@ vAPI.toolbarButton = {
|
|||||||
if ( index === -1 ) {
|
if ( index === -1 ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
// This can occur with Pale Moon:
|
||||||
|
// "TypeError: toolbar.insertItem is not a function"
|
||||||
|
if ( typeof toolbar.insertItem !== 'function' ) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
// Found our button on this toolbar - but where on it?
|
// Found our button on this toolbar - but where on it?
|
||||||
var before = null;
|
var before = null;
|
||||||
for ( var i = index + 1; i < currentset.length; i++ ) {
|
for ( var i = index + 1; i < currentset.length; i++ ) {
|
||||||
|
Loading…
Reference in New Issue
Block a user