[benchmark] Do not abort() when readyState is DONE in destroyAllXHRs

This is to supress DevTools error messages, because on Chrome calling abort()
in an onreadystatechange handler in sync mode causes a NetworkError message,
even if it is after transition to DONE state.

R=tyoshino@chromium.org

Review URL: https://codereview.appspot.com/142550043

git-svn-id: https://pywebsocket.googlecode.com/svn/trunk/src@852 4ff78f4a-9131-11de-b045-6380ec9940d4
diff --git a/example/xhr_benchmark.js b/example/xhr_benchmark.js
index a6ce6c0..0cfdd26 100644
--- a/example/xhr_benchmark.js
+++ b/example/xhr_benchmark.js
@@ -22,7 +22,12 @@
 function destroyAllXHRs() {
   for (var i = 0; i < xhrs.length; ++i) {
     xhrs[i].onreadystatechange = null;
-    xhrs[i].abort();
+    // Abort XHRs if they are not yet DONE state.
+    // Calling abort() here (i.e. in onreadystatechange handler) 
+    // causes "NetworkError" messages in DevTools in sync mode,
+    // even if it is after transition to DONE state.
+    if (xhrs[i].readyState != XMLHttpRequest.DONE)
+      xhrs[i].abort();
   }
   xhrs = [];
   // gc() might be needed for Chrome/Blob