Share code for generating WebWidget context menu