Reverted commits 5946 and 5952 since they seem to be breaking tests.
Added a TODO to call webClient.closeAllWindows() 



git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@5956 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/user/src/com/google/gwt/junit/RunStyleHtmlUnit.java b/user/src/com/google/gwt/junit/RunStyleHtmlUnit.java
index 96b133c..e48ef8e 100644
--- a/user/src/com/google/gwt/junit/RunStyleHtmlUnit.java
+++ b/user/src/com/google/gwt/junit/RunStyleHtmlUnit.java
@@ -82,27 +82,29 @@
     @Override
     public void run() {
       WebClient webClient = new WebClient(browser);
+      webClient.setAlertHandler(this);
+      webClient.setIncorrectnessListener(this);
+      webClient.setThrowExceptionOnFailingStatusCode(false);
+      webClient.setThrowExceptionOnScriptError(true);
+      webClient.setOnbeforeunloadHandler(this);
+      setupWebClient(webClient);
       try {
-        webClient.setAlertHandler(this);
-        webClient.setIncorrectnessListener(this);
-        webClient.setThrowExceptionOnFailingStatusCode(false);
-        webClient.setThrowExceptionOnScriptError(true);
-        webClient.setOnbeforeunloadHandler(this);
-        setupWebClient(webClient);
         Page page = webClient.getPage(url);
         // TODO(jat): is this necessary?
         webClient.waitForBackgroundJavaScriptStartingBefore(2000);
         page.getEnclosingWindow().getJobManager().waitForJobs(60000);
         treeLogger.log(TreeLogger.DEBUG, "getPage returned "
             + ((HtmlPage) page).asXml());
+        // TODO(amitmanjhi): call webClient.closeAllWindows()
       } catch (FailingHttpStatusCodeException e) {
         treeLogger.log(TreeLogger.ERROR, "HTTP request failed", e);
+        return;
       } catch (MalformedURLException e) {
         treeLogger.log(TreeLogger.ERROR, "Bad URL", e);
+        return;
       } catch (IOException e) {
         treeLogger.log(TreeLogger.ERROR, "I/O error on HTTP request", e);
-      } finally {
-        webClient.closeAllWindows();
+        return;
       }
     }