Use TabContextMenu.contextTab instead of gBrowser.mContextTab.
Use gBrowser.selectedTab instead of gBrowser.mCurrentTab.