Partially reverts the changes from Bug 568234
by implementing Stefan's suggestion in Bug 626365 comment 20
, allowing middle-clicks on links in popups to open in a new tab in the popup itself rather than in the most recently used non-popup browser window.
Note that aRelatedToCurrent is still set to false for these tabs, so they will open at the end of the tabstrip regardless of the value of browser.tabs.insertRelatedAfterCurrent, and extensions which rely on that value may act strangely. This proved to be somewhat tricky to fix in a way that's also compatible with Tab Mix Plus. Also, left-clicks on links with target="_blank" will still open in the parent window -- middle-click or control-click instead.