From ab0288a76e7c6f7d31f7f85869309c34eee97b7c Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Wed, 25 Jul 2012 22:49:24 +0200 Subject: [PATCH] Bug 718260 - Fix a crash in DispatchPrematureAbortEvent; r=bent --- dom/workers/XMLHttpRequest.cpp | 6 +++++- dom/workers/test/test_xhrAbort.html | 10 ++-------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/dom/workers/XMLHttpRequest.cpp b/dom/workers/XMLHttpRequest.cpp index 98c089d2f40b..dadb358da8fa 100644 --- a/dom/workers/XMLHttpRequest.cpp +++ b/dom/workers/XMLHttpRequest.cpp @@ -1604,10 +1604,14 @@ XMLHttpRequest::DispatchPrematureAbortEvent(JSObject* aTarget, 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]); diff --git a/dom/workers/test/test_xhrAbort.html b/dom/workers/test/test_xhrAbort.html index 988dab26edff..0f4b93c5a789 100644 --- a/dom/workers/test/test_xhrAbort.html +++ b/dom/workers/test/test_xhrAbort.html @@ -35,15 +35,9 @@ Tests of DOM Worker Threads XHR(Bug 450452 ) 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();