Bug 718260 - Fix a crash in DispatchPrematureAbortEvent; r=bent a=lsblakk
authorMs2ger <ms2ger@gmail.com>
Wed, 25 Jul 2012 22:49:24 +0200
changeset 100501 a310ea157435ceeb8a7dbfa951b287d2b9aa5d87
parent 100500 325bc77183074ad956549371e841f0170a6d21f9
child 100502 7488058a7c3f9798454b5587dc7732b2203506e9
push id1273
push useremorley@mozilla.com
push dateTue, 14 Aug 2012 14:53:37 +0000
treeherdermozilla-beta@a310ea157435 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbent, lsblakk
bugs718260
milestone15.0
Bug 718260 - Fix a crash in DispatchPrematureAbortEvent; r=bent a=lsblakk
dom/workers/XMLHttpRequest.cpp
dom/workers/test/test_xhrAbort.html
--- a/dom/workers/XMLHttpRequest.cpp
+++ b/dom/workers/XMLHttpRequest.cpp
@@ -1593,20 +1593,24 @@ XMLHttpRequest::MaybeDispatchPrematureAb
 
 void
 XMLHttpRequest::DispatchPrematureAbortEvent(JSObject* aTarget,
                                             uint8_t aEventType,
                                             bool aUploadTarget,
                                             ErrorResult& aRv)
 {
   mWorkerPrivate->AssertIsOnWorkerThread();
-  MOZ_ASSERT(mProxy);
   MOZ_ASSERT(aTarget);
   MOZ_ASSERT(aEventType <= STRING_COUNT);
 
+  if (!mProxy) {
+    aRv.Throw(NS_ERROR_FAILURE);
+    return;
+  }
+
   JSContext* cx = GetJSContext();
 
   JSString* type = JS_NewStringCopyZ(cx, sEventStrings[aEventType]);
   if (!type) {
     aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
     return;
   }
 
--- a/dom/workers/test/test_xhrAbort.html
+++ b/dom/workers/test/test_xhrAbort.html
@@ -30,21 +30,15 @@ Tests of DOM Worker Threads XHR(Bug 4504
     worker.onmessage = function(event) {
       is (data.toString(), event.data.toString(), "Got different results!");
       SimpleTest.finish();
     };
 
     worker.postMessage("start");
   }
 
-  SimpleTest.waitForExplicitFinish();
+  runTest();
 
-  const isWinXP = navigator.userAgent.indexOf("Windows NT 5.1") != -1;
-  if (isWinXP){
-    todo(false, "Test disabled on WinXP due to bug 718260 crashes");
-    SimpleTest.finish();
-  } else {
-    runTest();
-  }
+  SimpleTest.waitForExplicitFinish();
 </script>
 </pre>
 </body>
 </html>