mirror of
https://github.com/gorhill/uBlock.git
synced 2024-09-29 06:07:11 +02: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;
|
||||
}
|
||||
|
||||
if (doc.getElementById(this.menuItemId)) {
|
||||
// Context menu already registered for this window
|
||||
return;
|
||||
}
|
||||
|
||||
var contextMenu = doc.getElementById('contentAreaContextMenu');
|
||||
if (contextMenu) {
|
||||
var menuitem = this.createContextMenuItem(doc);
|
||||
menuitem.addEventListener('command', this.onCommand);
|
||||
contextMenu.addEventListener('popupshowing', this.displayMenuItem);
|
||||
contextMenu.insertBefore(menuitem, doc.getElementById('inspect-separator'));
|
||||
}
|
||||
};
|
||||
|
||||
/******************************************************************************/
|
||||
|
Loading…
Reference in New Issue
Block a user