Isn't parentMenu read-only? So I've called addItem on the right menu (tab context menu or content context menu depending on what the context was specified to be), with the item in line 512.

Yes, isCurrent might as well simply return true since the item is added solely to the tab context menu. Is this what you're saying?