Listen for new window openings then patch them

Cleaned up a bit.
Todo:
 - set browser.search.openintab to true
 - clean up