Listen for new windows openin then patch them

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