Bug 850349 - Cleanup browser search tests while debugging intermittent failure in browser_contextmenu.js. r=gavin

* browser_426329.js - Fix exception in popupshowing event listener causing search history dropdown to remain open on subsequent tests.
* browser_contextmenu.js - Add some debug messages.
                         - Move |doOnloadOnce(checkSearchURL);| just before the search tab opens so there is less interference with later tests.
                         - Add nsISelectionListener to know when selection has finished.
* head.js - Consolidate duplicated doOnloadOnce function.
* test.html - Fix character set warning.