Seems it does not work on images with links (so far I have noticed this directly on AMO, when trying to rotate the Firefox logo in the header). The possible cause is here, when the variable may got assigned to null by a subsequent call for the link context menu. I will need to verify first.
Having a shared variable is not a nice pattern in any case, but I do not see any obvious way to encapsulate it e.g. in an object instance at this moment. Maybe keeping a table of context menus opened for the document + the clicked images, and sending some ID back with the message...
Seems it does not work on images with links (so far I have noticed this directly on AMO, when trying to rotate the Firefox logo in the header). The possible cause is here, when the variable may got assigned to null by a subsequent call for the link context menu. I will need to verify first.
Having a shared variable is not a nice pattern in any case, but I do not see any obvious way to encapsulate it e.g. in an object instance at this moment. Maybe keeping a table of context menus opened for the document + the clicked images, and sending some ID back with the message...