mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-16 23:42:39 +01:00
Fix for race condition adding double context menu entries
This commit is contained in:
parent
d9b23d4f10
commit
ed6064912e
@ -1969,11 +1969,18 @@ vAPI.contextMenu.register = function(doc) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (doc.getElementById(this.menuItemId)) {
|
||||||
|
// Context menu already registered for this window
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var contextMenu = doc.getElementById('contentAreaContextMenu');
|
var contextMenu = doc.getElementById('contentAreaContextMenu');
|
||||||
|
if (contextMenu) {
|
||||||
var menuitem = this.createContextMenuItem(doc);
|
var menuitem = this.createContextMenuItem(doc);
|
||||||
menuitem.addEventListener('command', this.onCommand);
|
menuitem.addEventListener('command', this.onCommand);
|
||||||
contextMenu.addEventListener('popupshowing', this.displayMenuItem);
|
contextMenu.addEventListener('popupshowing', this.displayMenuItem);
|
||||||
contextMenu.insertBefore(menuitem, doc.getElementById('inspect-separator'));
|
contextMenu.insertBefore(menuitem, doc.getElementById('inspect-separator'));
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
Loading…
Reference in New Issue
Block a user