Bug 932271 - Reset context menu state at the correct moment

Displaying the context menu in the browser app is controlled by a
barrier. We have to make sure that this barrier is correctly reset at
the right time to ensure that the context menu will work more than once:
setting the state before doing the callback is safer than relying on the
callback to handle it by itself.