Bug 839271: Use the inner window ID to cache workers so we get a new one if the outer window doesn't change.
(cherry picked from commit 15196a13eeb8f4c7096fa33b62dc98b27710bb95)
Bug 839271: Address review comments.
(cherry picked from commit f660caaf5759771189ee8787ec704e3766e3eff2)
Bug 839321: If a context-menu module's items are all hidden then it may hide the items from other add-ons.
(cherry picked from commit 1e8f44e52bd4efce28e81a11f25cc39113698f8c)