Backed out changeset 1c68eb288c85 for mochitest timeouts.
authorBen Turner <bent.mozilla@gmail.com>
Tue, 30 Dec 2008 17:35:43 -0600
changeset 23203 a5227b4f2814c6e40d99587819ba502a548207c4
parent 23202 1c68eb288c858e52c028007c6023d202c87e7244
child 23204 eba3f74d77345eaa11d7474c92c1667c0cfb53ab
push id4388
push userbturner@mozilla.com
push dateTue, 30 Dec 2008 23:36:00 +0000
treeherdermozilla-central@a5227b4f2814 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone1.9.2a1pre
backs out1c68eb288c858e52c028007c6023d202c87e7244
Backed out changeset 1c68eb288c85 for mochitest timeouts.
dom/public/idl/threads/nsIDOMWorkers.idl
dom/src/threads/nsDOMThreadService.cpp
dom/src/threads/nsDOMWorker.cpp
dom/src/threads/nsDOMWorker.h
dom/src/threads/nsDOMWorkerEvents.cpp
dom/src/threads/nsDOMWorkerEvents.h
dom/src/threads/test/Makefile.in
dom/src/threads/test/errorPropagation_worker1.js
dom/src/threads/test/importScripts_worker_imported1.js
dom/src/threads/test/importScripts_worker_imported2.js
dom/src/threads/test/relativeLoad_worker.js
dom/src/threads/test/scopeOnerror_worker.js
dom/src/threads/test/test_errorPropagation.html
dom/src/threads/test/test_recursion.html
dom/src/threads/test/test_scopeOnerror.html
dom/src/threads/test/test_simpleThread.html
--- a/dom/public/idl/threads/nsIDOMWorkers.idl
+++ b/dom/public/idl/threads/nsIDOMWorkers.idl
@@ -62,48 +62,30 @@ interface nsIWorkerMessageEvent : nsIDOM
   void initMessageEvent(in DOMString aTypeArg,
                         in boolean aCanBubbleArg,
                         in boolean aCancelableArg,
                         in DOMString aDataArg,
                         in DOMString aOriginArg,
                         in nsISupports aSourceArg);
 };
 
-[scriptable, uuid(73d82c1d-05de-49c9-a23b-7121ff09a67a)]
-interface nsIWorkerErrorEvent : nsIDOMEvent
-{
-  readonly attribute DOMString message;
-  readonly attribute DOMString filename;
-
-  readonly attribute unsigned long lineno;
-
-  void initErrorEvent(in DOMString aTypeArg,
-                      in boolean aCanBubbleArg,
-                      in boolean aCancelableArg,
-                      in DOMString aMessageArg,
-                      in DOMString aFilenameArg,
-                      in unsigned long aLinenoArg);
-};
-
 [scriptable, uuid(74fb665a-e477-4ce2-b3c6-c58b1b28b6c3)]
 interface nsIWorkerNavigator : nsISupports
 {
   readonly attribute DOMString appName;
   readonly attribute DOMString appVersion;
   readonly attribute DOMString platform;
   readonly attribute DOMString userAgent;
 };
 
-[scriptable, uuid(d7d7cf59-6c8a-4598-8753-630953ae7409)]
+[scriptable, uuid(a41ac154-ba18-4926-8954-cd6973ea490e)]
 interface nsIWorkerGlobalScope : nsISupports
 {
   readonly attribute nsIWorkerGlobalScope self;
   readonly attribute nsIWorkerNavigator navigator;
-
-  attribute nsIDOMEventListener onerror;
 };
 
 [scriptable, uuid(d30a2f61-86e2-434e-837f-4f1985efa865)]
 interface nsIWorkerScope : nsIWorkerGlobalScope
 {
   void postMessage(/* in JSObject aMessage */);
 
   attribute nsIDOMEventListener onmessage;
--- a/dom/src/threads/nsDOMThreadService.cpp
+++ b/dom/src/threads/nsDOMThreadService.cpp
@@ -155,18 +155,17 @@ private:
 /**
  * This class is used as to post an error to the worker's outer handler.
  */
 class nsReportErrorRunnable : public nsIRunnable
 {
 public:
   NS_DECL_ISUPPORTS
 
-  nsReportErrorRunnable(nsDOMWorker* aWorker,
-                        nsIScriptError* aScriptError)
+  nsReportErrorRunnable(nsDOMWorker* aWorker, nsIScriptError* aScriptError)
   : mWorker(aWorker), mWorkerWN(aWorker->GetWrappedNative()),
     mScriptError(aScriptError) {
       NS_ASSERTION(aScriptError, "Null pointer!");
     }
 
   NS_IMETHOD Run() {
     if (mWorker->IsCanceled()) {
       return NS_OK;
@@ -187,47 +186,44 @@ public:
         nsDOMWorker* currentWorker = (nsDOMWorker*)JS_GetContextPrivate(cx);
         NS_ASSERTION(currentWorker == parent, "Wrong worker!");
       }
     }
 #endif
 
     NS_NAMED_LITERAL_STRING(errorStr, "error");
 
-    nsresult rv;
+    PRBool hasListener = PR_FALSE, stopPropagation = PR_FALSE;
+    nsresult rv = NS_OK;
 
     if (mWorker->mOuterHandler->HasListeners(errorStr)) {
-      // Construct the error event.
-      nsString message;
-      rv = mScriptError->GetErrorMessage(message);
-      NS_ENSURE_SUCCESS(rv, rv);
-
-      nsString filename;
-      rv = mScriptError->GetSourceName(filename);
-      NS_ENSURE_SUCCESS(rv, rv);
-
-      PRUint32 lineno;
-      rv = mScriptError->GetLineNumber(&lineno);
-      NS_ENSURE_SUCCESS(rv, rv);
+      hasListener = PR_TRUE;
+      nsRefPtr<nsDOMWorkerMessageEvent> event(new nsDOMWorkerMessageEvent());
+      if (event) {
+        nsCString errorMessage;
+        rv = mScriptError->ToString(errorMessage);
+        if (NS_SUCCEEDED(rv)) {
+          rv = event->InitMessageEvent(errorStr, PR_FALSE, PR_FALSE,
+                                       NS_ConvertUTF8toUTF16(errorMessage),
+                                       EmptyString(), nsnull);
+          if (NS_SUCCEEDED(rv)) {
+            event->SetTarget(mWorker);
+            rv = mWorker->DispatchEvent(static_cast<nsDOMWorkerEvent*>(event),
+                                        &stopPropagation);
+            if (NS_FAILED(rv)) {
+              stopPropagation = PR_FALSE;
+            }
+          }
+        }
+      }
+    }
+    NS_ENSURE_SUCCESS(rv, rv);
 
-      nsRefPtr<nsDOMWorkerErrorEvent> event(new nsDOMWorkerErrorEvent());
-      NS_ENSURE_TRUE(event, NS_ERROR_OUT_OF_MEMORY);
-
-      rv = event->InitErrorEvent(errorStr, PR_FALSE, PR_TRUE, message,
-                                 filename, lineno);
-      NS_ENSURE_SUCCESS(rv, rv);
-
-      event->SetTarget(mWorker);
-
-      PRBool stopPropagation = PR_FALSE;
-      rv = mWorker->DispatchEvent(static_cast<nsDOMWorkerEvent*>(event),
-                                  &stopPropagation);
-      if (NS_SUCCEEDED(rv) && stopPropagation) {
-        return NS_OK;
-      }
+    if (stopPropagation) {
+      return NS_OK;
     }
 
     nsRefPtr<nsDOMWorker> parent = mWorker->GetParent();
     if (!parent) {
       NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
       nsCOMPtr<nsIConsoleService> consoleService =
         do_GetService(NS_CONSOLESERVICE_CONTRACTID);
       if (consoleService) {
@@ -503,41 +499,16 @@ DOMWorkerErrorReporter(JSContext* aCx,
     reinterpret_cast<const PRUnichar*>(aReport->uclinebuf);
 
   PRUint32 column = aReport->uctokenptr - aReport->uclinebuf;
 
   rv = scriptError->Init(message, filename.get(), line, aReport->lineno,
                          column, aReport->flags, "DOM Worker javascript");
   NS_ENSURE_SUCCESS(rv,);
 
-  // Try the onerror handler for the worker's scope.
-  nsCOMPtr<nsIDOMEventListener> handler =
-    worker->mInnerHandler->GetOnXListener(NS_LITERAL_STRING("error"));
-
-  if (handler) {
-    nsRefPtr<nsDOMWorkerErrorEvent> event(new nsDOMWorkerErrorEvent());
-    NS_ENSURE_TRUE(event,);
-
-    rv = event->InitErrorEvent(NS_LITERAL_STRING("error"), PR_FALSE, PR_TRUE,
-                               nsDependentString(message), filename,
-                               aReport->lineno);
-    NS_ENSURE_SUCCESS(rv,);
-
-    NS_ASSERTION(worker->GetInnerScope(), "Null scope!");
-    event->SetTarget(worker->GetInnerScope());
-
-    rv = handler->HandleEvent(static_cast<nsDOMWorkerEvent*>(event));
-    NS_ENSURE_SUCCESS(rv,);
-
-    if (event->PreventDefaultCalled()) {
-      return;
-    }
-  }
-
-  // Still unhandled, fire at the onerror handler on the worker.
   nsCOMPtr<nsIRunnable> runnable =
     new nsReportErrorRunnable(worker, scriptError);
   NS_ENSURE_TRUE(runnable,);
 
   nsRefPtr<nsDOMWorker> parent = worker->GetParent();
 
   // If this worker has a parent then we need to send the message through the
   // thread service to be run on the parent's thread. Otherwise it is a
--- a/dom/src/threads/nsDOMWorker.cpp
+++ b/dom/src/threads/nsDOMWorker.cpp
@@ -517,22 +517,39 @@ GetStringForArgument(nsAString& aString,
   writer.FlushBuffer();
 
   aString.Assign(writer.mOutputString);
   *aIsJSON = PR_TRUE;
 
   return NS_OK;
 }
 
-nsDOMWorkerScope::nsDOMWorkerScope(nsDOMWorker* aWorker)
-: mWorker(aWorker),
-  mHasOnerror(PR_FALSE)
+class nsDOMWorkerScope : public nsIWorkerScope,
+                         public nsIDOMEventTarget,
+                         public nsIXPCScriptable,
+                         public nsIClassInfo
 {
-  NS_ASSERTION(aWorker, "Null pointer!");
-}
+public:
+  NS_DECL_ISUPPORTS
+  NS_DECL_NSIWORKERGLOBALSCOPE
+  NS_DECL_NSIWORKERSCOPE
+  NS_DECL_NSIDOMEVENTTARGET
+  NS_DECL_NSIXPCSCRIPTABLE
+  NS_DECL_NSICLASSINFO
+
+  nsDOMWorkerScope(nsDOMWorker* aWorker)
+  : mWorker(aWorker) {
+    NS_ASSERTION(aWorker, "Null pointer!");
+  }
+
+private:
+  nsDOMWorker* mWorker;
+
+  nsRefPtr<nsDOMWorkerNavigator> mNavigator;
+};
 
 NS_IMPL_THREADSAFE_ISUPPORTS5(nsDOMWorkerScope, nsIWorkerScope,
                                                 nsIWorkerGlobalScope,
                                                 nsIDOMEventTarget,
                                                 nsIXPCScriptable,
                                                 nsIClassInfo)
 
 NS_IMPL_CI_INTERFACE_GETTER4(nsDOMWorkerScope, nsIWorkerScope,
@@ -596,66 +613,16 @@ nsDOMWorkerScope::GetNavigator(nsIWorker
     NS_ENSURE_TRUE(mNavigator, NS_ERROR_OUT_OF_MEMORY);
   }
 
   NS_ADDREF(*_retval = mNavigator);
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsDOMWorkerScope::GetOnerror(nsIDOMEventListener** aOnerror)
-{
-  NS_ASSERTION(!NS_IsMainThread(), "Wrong thread!");
-  NS_ENSURE_ARG_POINTER(aOnerror);
-
-  if (mWorker->IsCanceled()) {
-    return NS_ERROR_ABORT;
-  }
-
-  if (!mHasOnerror) {
-    // Spec says we have to return 'undefined' until something is set here.
-    nsIXPConnect* xpc = nsContentUtils::XPConnect();
-    NS_ENSURE_TRUE(xpc, NS_ERROR_UNEXPECTED);
-
-    nsAXPCNativeCallContext* cc;
-    nsresult rv = xpc->GetCurrentNativeCallContext(&cc);
-    NS_ENSURE_SUCCESS(rv, rv);
-    NS_ENSURE_TRUE(cc, NS_ERROR_UNEXPECTED);
-
-    jsval* retval;
-    rv = cc->GetRetValPtr(&retval);
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    *retval = JSVAL_VOID;
-    return cc->SetReturnValueWasSet(PR_TRUE);
-  }
-
-  nsCOMPtr<nsIDOMEventListener> listener =
-    mWorker->mInnerHandler->GetOnXListener(NS_LITERAL_STRING("error"));
-  listener.forget(aOnerror);
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsDOMWorkerScope::SetOnerror(nsIDOMEventListener* aOnerror)
-{
-  NS_ASSERTION(!NS_IsMainThread(), "Wrong thread!");
-
-  if (mWorker->IsCanceled()) {
-    return NS_ERROR_ABORT;
-  }
-
-  mHasOnerror = PR_TRUE;
-
-  return mWorker->mInnerHandler->SetOnXListener(NS_LITERAL_STRING("error"),
-                                                aOnerror);
-}
-
-NS_IMETHODIMP
 nsDOMWorkerScope::PostMessage(/* JSObject aMessage */)
 {
   NS_ASSERTION(!NS_IsMainThread(), "Wrong thread!");
 
   if (mWorker->IsCanceled()) {
     return NS_ERROR_ABORT;
   }
 
--- a/dom/src/threads/nsDOMWorker.h
+++ b/dom/src/threads/nsDOMWorker.h
@@ -49,50 +49,27 @@
 #include "jsapi.h"
 #include "nsAutoPtr.h"
 #include "nsCOMPtr.h"
 #include "nsTPtrArray.h"
 #include "prlock.h"
 
 #include "nsDOMWorkerMessageHandler.h"
 
-class nsDOMWorker;
-class nsDOMWorkerFeature;
 class nsDOMWorkerMessageHandler;
-class nsDOMWorkerNavigator;
 class nsDOMWorkerPool;
+class nsDOMWorkerScope;
 class nsDOMWorkerTimeout;
 class nsICancelable;
 class nsIDOMEventListener;
 class nsIEventTarget;
 class nsIScriptGlobalObject;
 class nsIXPConnectWrappedNative;
 
-class nsDOMWorkerScope : public nsIWorkerScope,
-                         public nsIDOMEventTarget,
-                         public nsIXPCScriptable,
-                         public nsIClassInfo
-{
-public:
-  NS_DECL_ISUPPORTS
-  NS_DECL_NSIWORKERGLOBALSCOPE
-  NS_DECL_NSIWORKERSCOPE
-  NS_DECL_NSIDOMEVENTTARGET
-  NS_DECL_NSIXPCSCRIPTABLE
-  NS_DECL_NSICLASSINFO
-
-  nsDOMWorkerScope(nsDOMWorker* aWorker);
-
-private:
-  nsDOMWorker* mWorker;
-
-  nsRefPtr<nsDOMWorkerNavigator> mNavigator;
-
-  PRPackedBool mHasOnerror;
-};
+class nsDOMWorkerFeature;
 
 class nsDOMWorker : public nsIWorker,
                     public nsIJSNativeInitializer,
                     public nsIXPCScriptable
 {
   friend class nsDOMWorkerFeature;
   friend class nsDOMWorkerFunctions;
   friend class nsDOMWorkerRefPtr;
--- a/dom/src/threads/nsDOMWorkerEvents.cpp
+++ b/dom/src/threads/nsDOMWorkerEvents.cpp
@@ -51,32 +51,30 @@
 
 NS_DEFINE_STATIC_IID_ACCESSOR(nsIDOMWorkerPrivateEvent,
                               NS_IDOMWORKERPRIVATEEVENT_IID)
 
 nsDOMWorkerPrivateEvent::nsDOMWorkerPrivateEvent(nsIDOMEvent* aEvent)
 : mEvent(aEvent),
   mProgressEvent(do_QueryInterface(aEvent)),
   mMessageEvent(do_QueryInterface(aEvent)),
-  mErrorEvent(do_QueryInterface(aEvent)),
   mPreventDefaultCalled(PR_FALSE)
 {
   NS_ASSERTION(aEvent, "Null pointer!");
 }
 
 NS_IMPL_THREADSAFE_ADDREF(nsDOMWorkerPrivateEvent)
 NS_IMPL_THREADSAFE_RELEASE(nsDOMWorkerPrivateEvent)
 
 NS_INTERFACE_MAP_BEGIN(nsDOMWorkerPrivateEvent)
   NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMWorkerPrivateEvent)
   NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsIDOMEvent, nsIDOMWorkerPrivateEvent)
   NS_INTERFACE_MAP_ENTRY(nsIDOMWorkerPrivateEvent)
   NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsIDOMProgressEvent, mProgressEvent)
   NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsIWorkerMessageEvent, mMessageEvent)
-  NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsIWorkerErrorEvent, mErrorEvent)
   NS_INTERFACE_MAP_ENTRY(nsIClassInfo)
 NS_INTERFACE_MAP_END
 
 NS_IMPL_CI_INTERFACE_GETTER1(nsDOMWorkerPrivateEvent, nsIDOMEvent)
 
 NS_IMPL_THREADSAFE_DOM_CI_HELPER(nsDOMWorkerPrivateEvent)
 NS_IMPL_THREADSAFE_DOM_CI_ALL_THE_REST(nsDOMWorkerPrivateEvent)
 
@@ -88,23 +86,17 @@ nsDOMWorkerPrivateEvent::GetInterfaces(P
     return ci->GetInterfaces(aCount, aArray);
   }
   return NS_CI_INTERFACE_GETTER_NAME(nsDOMWorkerPrivateEvent)(aCount, aArray);
 }
 
 NS_IMETHODIMP
 nsDOMWorkerPrivateEvent::PreventDefault()
 {
-  PRBool cancelable = PR_FALSE;
-  mEvent->GetCancelable(&cancelable);
-
-  if (cancelable) {
-    mPreventDefaultCalled = PR_TRUE;
-  }
-
+  mPreventDefaultCalled = PR_TRUE;
   return mEvent->PreventDefault();
 }
 
 NS_IMETHODIMP
 nsDOMWorkerPrivateEvent::InitEvent(const nsAString& aEventType,
                                    PRBool aCanBubble,
                                    PRBool aCancelable)
 {
@@ -139,31 +131,16 @@ nsDOMWorkerPrivateEvent::InitMessageEven
   NS_ASSERTION(mMessageEvent, "Impossible!");
 
   mPreventDefaultCalled = PR_FALSE;
   return mMessageEvent->InitMessageEvent(aTypeArg, aCanBubbleArg,
                                          aCancelableArg, aDataArg, aOriginArg,
                                          aSourceArg);
 }
 
-NS_IMETHODIMP
-nsDOMWorkerPrivateEvent::InitErrorEvent(const nsAString& aTypeArg,
-                                        PRBool aCanBubbleArg,
-                                        PRBool aCancelableArg,
-                                        const nsAString& aMessageArg,
-                                        const nsAString& aFilenameArg,
-                                        PRUint32 aLinenoArg)
-{
-  NS_ASSERTION(mErrorEvent, "Impossible!");
-
-  mPreventDefaultCalled = PR_FALSE;
-  return mErrorEvent->InitErrorEvent(aTypeArg, aCanBubbleArg, aCancelableArg,
-                                     aMessageArg, aFilenameArg, aLinenoArg);
-}
-
 PRBool
 nsDOMWorkerPrivateEvent::PreventDefaultCalled()
 {
   return mPreventDefaultCalled;
 }
 
 NS_IMPL_THREADSAFE_ISUPPORTS2(nsDOMWorkerEvent, nsIDOMEvent,
                                                 nsIClassInfo)
@@ -557,52 +534,8 @@ nsDOMWorkerXHREvent::Run()
   nsresult rv = mXHRProxy->HandleWorkerEvent(this, mUploadEvent);
 
   // Prevent reference cycles by releasing this here.
   mXHRProxy = nsnull;
 
   NS_ENSURE_SUCCESS(rv, rv);
   return NS_OK;
 }
-
-NS_IMPL_ISUPPORTS_INHERITED1(nsDOMWorkerErrorEvent, nsDOMWorkerEvent,
-                                                    nsIWorkerErrorEvent)
-
-NS_IMPL_CI_INTERFACE_GETTER2(nsDOMWorkerErrorEvent, nsIDOMEvent,
-                                                    nsIWorkerErrorEvent)
-
-NS_IMPL_THREADSAFE_DOM_CI_GETINTERFACES(nsDOMWorkerErrorEvent)
-
-nsresult
-nsDOMWorkerErrorEvent::GetMessage(nsAString& aMessage)
-{
-  aMessage.Assign(mMessage);
-  return NS_OK;
-}
-
-nsresult
-nsDOMWorkerErrorEvent::GetFilename(nsAString& aFilename)
-{
-  aFilename.Assign(mFilename);
-  return NS_OK;
-}
-
-nsresult
-nsDOMWorkerErrorEvent::GetLineno(PRUint32* aLineno)
-{
-  NS_ENSURE_ARG_POINTER(aLineno);
-  *aLineno = mLineno;
-  return NS_OK;
-}
-
-nsresult
-nsDOMWorkerErrorEvent::InitErrorEvent(const nsAString& aTypeArg,
-                                      PRBool aCanBubbleArg,
-                                      PRBool aCancelableArg,
-                                      const nsAString& aMessageArg,
-                                      const nsAString& aFilenameArg,
-                                      PRUint32 aLinenoArg)
-{
-  mMessage.Assign(aMessageArg);
-  mFilename.Assign(aFilenameArg);
-  mLineno = aLinenoArg;
-  return InitEvent(aTypeArg, aCanBubbleArg, aCancelableArg);
-}
--- a/dom/src/threads/nsDOMWorkerEvents.h
+++ b/dom/src/threads/nsDOMWorkerEvents.h
@@ -103,36 +103,26 @@ public:
 #define NS_FORWARD_NSIWORKERMESSAGEEVENT_SPECIAL                              \
   NS_IMETHOD GetData(nsAString& aData)                                        \
     { return mMessageEvent->GetData(aData); }                                 \
   NS_IMETHOD GetOrigin(nsAString& aOrigin)                                    \
     { return mMessageEvent->GetOrigin(aOrigin); }                             \
   NS_IMETHOD GetSource(nsISupports** aSource)                                 \
     { return mMessageEvent->GetSource(aSource); }
 
-#define NS_FORWARD_NSIWORKERERROREVENT_SPECIAL                                \
-  NS_IMETHOD GetMessage(nsAString& aMessage)                                  \
-    { return mErrorEvent->GetMessage(aMessage); }                             \
-  NS_IMETHOD GetFilename(nsAString& aFilename)                                \
-    { return mErrorEvent->GetFilename(aFilename); }                           \
-  NS_IMETHOD GetLineno(PRUint32* aLineno)                                     \
-    { return mErrorEvent->GetLineno(aLineno); }
-
 class nsDOMWorkerPrivateEvent : public nsIDOMWorkerPrivateEvent,
                                 public nsIDOMProgressEvent,
                                 public nsIWorkerMessageEvent,
-                                public nsIWorkerErrorEvent,
                                 public nsIClassInfo
 {
 public:
   NS_DECL_ISUPPORTS
   NS_FORWARD_NSIDOMEVENT_SPECIAL
   NS_FORWARD_NSIWORKERMESSAGEEVENT_SPECIAL
   NS_FORWARD_NSIDOMPROGRESSEVENT_SPECIAL
-  NS_FORWARD_NSIWORKERERROREVENT_SPECIAL
   NS_DECL_NSICLASSINFO
 
   nsDOMWorkerPrivateEvent(nsIDOMEvent* aEvent);
 
   NS_IMETHOD PreventDefault();
 
   NS_IMETHOD InitEvent(const nsAString& aEventType,
                        PRBool aCanBubble,
@@ -147,30 +137,22 @@ public:
 
   NS_IMETHOD InitMessageEvent(const nsAString& aTypeArg,
                               PRBool aCanBubbleArg,
                               PRBool aCancelableArg,
                               const nsAString& aDataArg,
                               const nsAString& aOriginArg,
                               nsISupports* aSourceArg);
 
-  NS_IMETHOD InitErrorEvent(const nsAString& aTypeArg,
-                            PRBool aCanBubbleArg,
-                            PRBool aCancelableArg,
-                            const nsAString& aMessageArg,
-                            const nsAString& aFilenameArg,
-                            PRUint32 aLinenoArg);
-
   virtual PRBool PreventDefaultCalled();
 
 private:
   nsCOMPtr<nsIDOMEvent> mEvent;
   nsCOMPtr<nsIDOMProgressEvent> mProgressEvent;
   nsCOMPtr<nsIWorkerMessageEvent> mMessageEvent;
-  nsCOMPtr<nsIWorkerErrorEvent> mErrorEvent;
   PRBool mPreventDefaultCalled;
 };
 
 class nsDOMWorkerEvent : public nsIDOMEvent,
                          public nsIClassInfo
 {
 public:
   NS_DECL_ISUPPORTS
@@ -180,20 +162,16 @@ public:
   nsDOMWorkerEvent()
   : mEventPhase(nsIDOMEvent::AT_TARGET), mTimeStamp(0), mBubbles(PR_FALSE),
     mCancelable(PR_FALSE), mPreventDefaultCalled(PR_FALSE) { }
 
   void SetTarget(nsIDOMEventTarget* aTarget) {
     mTarget = aTarget;
   }
 
-  PRBool PreventDefaultCalled() {
-    return PRBool(mPreventDefaultCalled);
-  }
-
 protected:
   virtual ~nsDOMWorkerEvent() { }
 
   nsString mType;
   nsCOMPtr<nsIDOMEventTarget> mTarget;
   PRUint16 mEventPhase;
   DOMTimeStamp mTimeStamp;
   PRPackedBool mBubbles;
@@ -317,27 +295,9 @@ protected:
   nsCOMPtr<nsIXPConnectWrappedNative> mXHRWN;
   nsRefPtr<nsDOMWorkerXHRState> mState;
   PRUint32 mXHREventType;
   PRInt32 mChannelID;
   PRPackedBool mUploadEvent;
   PRPackedBool mProgressEvent;
 };
 
-class nsDOMWorkerErrorEvent : public nsDOMWorkerEvent,
-                              public nsIWorkerErrorEvent
-{
-public:
-  NS_DECL_ISUPPORTS_INHERITED
-  NS_FORWARD_NSIDOMEVENT(nsDOMWorkerEvent::)
-  NS_DECL_NSIWORKERERROREVENT
-  NS_DECL_NSICLASSINFO_GETINTERFACES
-
-  nsDOMWorkerErrorEvent()
-  : mLineno(0) { }
-
-protected:
-  nsString mMessage;
-  nsString mFilename;
-  PRUint32 mLineno;
-};
-
 #endif /* __NSDOMWORKEREVENTS_H__ */
--- a/dom/src/threads/test/Makefile.in
+++ b/dom/src/threads/test/Makefile.in
@@ -65,18 +65,16 @@ include $(topsrcdir)/config/rules.mk
   test_recursion.html \
   recursion_worker.js \
   test_regExpStatics.html \
   regExpStatics_worker.js \
   test_relativeLoad.html \
   relativeLoad_worker.js \
   relativeLoad_worker2.js \
   relativeLoad_import.js \
-  test_scopeOnerror.html \
-  scopeOnerror_worker.js \
   test_simpleThread.html \
   simpleThread_worker.js \
   test_terminate.html \
   terminate_worker.js \
   test_threadErrors.html \
   threadErrors_worker1.js \
   threadErrors_worker2.js \
   threadErrors_worker3.js \
--- a/dom/src/threads/test/errorPropagation_worker1.js
+++ b/dom/src/threads/test/errorPropagation_worker1.js
@@ -5,21 +5,21 @@ worker.onerror = function(event) {
   switch (errorCount++) {
     case 0:
     case 1:
       // Let it propagate.
       break;
     case 2:
       // Stop and rethrow.
       event.preventDefault();
-      throw event.message;
+      throw event.data;
       break;
     case 3:
       event.preventDefault();
-      postMessage(event.message);
+      postMessage(event.data);
       worker.onerror = null;
       break;
     default:
   }
 };
 
 onmessage = function(event) {
   worker.postMessage(event.data);
--- a/dom/src/threads/test/importScripts_worker_imported1.js
+++ b/dom/src/threads/test/importScripts_worker_imported1.js
@@ -1,6 +1,7 @@
 // This caused security exceptions in the past, make sure it doesn't!
 var myConstructor = {}.constructor;
 
 // Try to call a function defined in the imported script.
 function importedScriptFunction() {
+  dump("running importedScriptFunction\n");
 }
--- a/dom/src/threads/test/importScripts_worker_imported2.js
+++ b/dom/src/threads/test/importScripts_worker_imported2.js
@@ -1,6 +1,7 @@
 // This caused security exceptions in the past, make sure it doesn't!
 var myConstructor2 = {}.constructor;
 
 // Try to call a function defined in the imported script.
 function importedScriptFunction2() {
+  dump("running importedScriptFunction2\n");
 }
--- a/dom/src/threads/test/relativeLoad_worker.js
+++ b/dom/src/threads/test/relativeLoad_worker.js
@@ -1,14 +1,15 @@
 const importURL = "relativeLoad_import.js";
 
 onmessage = function(event) {
   var xhr = new XMLHttpRequest();
   xhr.open("GET", "testXHR.txt", false);
   xhr.send(null);
+  dump("XXXben: " + xhr.responseText + "\n");
   if (xhr.status != 200 ||
       xhr.responseText != "A noisy noise annoys an oyster.") {
     throw "Couldn't get xhr text from where we wanted it!";
   }
 
   importScripts(importURL);
   var worker = new Worker("relativeLoad_worker2.js");
   worker.onerror = function(event) {
deleted file mode 100644
--- a/dom/src/threads/test/scopeOnerror_worker.js
+++ /dev/null
@@ -1,25 +0,0 @@
-if (onerror !== undefined || typeof(onerror) != "undefined") {
-  throw "Undefined onerror has bad type!";
-}
-
-onerror = function(event) {
-  if (!event.cancelable) {
-    throw "Error event is not cancelable!";
-  }
-
-  if (event.target != this) {
-    throw "Error event is targeted at the wrong object!";
-  }
-
-  if (event.message == "uncaught exception: This error should not make it back out") {
-    event.preventDefault();
-    setTimeout("postMessage('Done');", 10);
-  }
-}
-
-onmessage = function(event) {
-  if (onerror === undefined || typeof(onerror) == "undefined") {
-    throw "onerror has a bad type!";
-  }
-  throw event.data;
-}
--- a/dom/src/threads/test/test_errorPropagation.html
+++ b/dom/src/threads/test/test_errorPropagation.html
@@ -30,30 +30,32 @@ Tests of DOM Worker Threads
   ];
 
   var errorIndex = -1;
 
   var worker = new Worker("errorPropagation_worker1.js");
 
   worker.onmessage = function(event) {
     is(event.target, worker);
-    isnot(-1, event.data.indexOf(errors[errorIndex]));
+    ok(event.data.indexOf(errors[errorIndex]) != -1,
+       "Wrong message!");
     ok(errorIndex == errors.length - 1, "Wrong number of errors seen!");
     SimpleTest.finish();
   }
 
   function nextError() {
     worker.postMessage(errors[++errorIndex]);
   }
 
   function errorHandler(event) {
     netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
 
     is(event.target, worker);
-    isnot(-1, event.message.indexOf(errors[errorIndex]));
+    ok(event.data.indexOf(errors[errorIndex]) != -1,
+       "Wrong message!");
 
     switch (errorIndex) {
       case 1:
         consoleService.unregisterListener(consoleListener);
         consoleService.reset();
         consoleListener = null;
         nextError();
         break;
@@ -72,19 +74,17 @@ Tests of DOM Worker Threads
       netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
 
       if (this.count++) {
         ok(false, "Seen too many errors!");
         SimpleTest.finish();
         return;
       }
 
-      is(message.message,
-         '[JavaScript Error: "uncaught exception: This exception should show ' +
-         'up in the JS console"]');
+      ok(message.message.indexOf(errors[errorIndex]) != -1, "Wrong message!");
       worker.onerror = errorHandler;
       nextError();
     },
 
     QueryInterface: function(iid) {
       netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
       if (iid.equals(Ci.nsIConsoleListener) ||
           iid.equals(Ci.nsISupports)) {
--- a/dom/src/threads/test/test_recursion.html
+++ b/dom/src/threads/test/test_recursion.html
@@ -15,17 +15,19 @@ Tests of DOM Worker Threads
 
 </div>
 <pre id="test">
 <script class="testbody" type="text/javascript">
 
   var worker = new Worker("recursion_worker.js");
 
   worker.onerror = function(event) {
-    is(event.message, "too much recursion");
+    is(event.data,
+       '[JavaScript Error: "too much recursion" {file: "http://localhost:8888' +
+       '/tests/dom/src/threads/test/recursion_worker.js" line: 2}]');
     SimpleTest.finish();
   }
 
   worker.postMessage("start");
 
   SimpleTest.waitForExplicitFinish();
 
 </script>
deleted file mode 100644
--- a/dom/src/threads/test/test_scopeOnerror.html
+++ /dev/null
@@ -1,89 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-Tests of DOM Worker Threads
--->
-<head>
-  <title>Test for DOM Worker Threads</title>
-  <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
-  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
-</head>
-<body>
-<pre id="test">
-<script class="testbody" type="text/javascript">
-
-  netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
-
-  const Cc = Components.classes;
-  const Ci = Components.interfaces;
-  const Cr = Components.results;
-
-  var errors = [
-    "This exception should make it to onerror",
-    "This error should not make it back out"
-  ];
-
-  var worker = new Worker("scopeOnError_worker.js");
-
-  worker.onmessage = function(event) {
-    ok(event.data == "Done");
-
-    if (consoleListener) {
-      netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
-      consoleService.unregisterListener(consoleListener);
-      consoleService.reset();
-      consoleListener = null;
-    }
-
-    SimpleTest.finish();
-  }
-
-  worker.onerror = function(event) {
-    is(event.target, worker);
-    is(event.message,
-       "uncaught exception: This exception should make it to onerror");
-    event.preventDefault();
-  };
-
-  var consoleListener = {
-    observe: function(message) {
-      ok(false, "An error made it to the console: " + message);
-
-      if (consoleListener) {
-        netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
-        consoleService.unregisterListener(consoleListener);
-        consoleService.reset();
-        consoleListener = null;
-      }
-
-      SimpleTest.finish();
-    },
-
-    QueryInterface: function(iid) {
-      netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
-      if (iid.equals(Ci.nsIConsoleListener) ||
-          iid.equals(Ci.nsISupports)) {
-        return this;
-      }
-      throw Cr.NS_NOINTERFACE;
-    }
-  };
-
-  var consoleService =
-    Cc["@mozilla.org/consoleservice;1"].getService(Ci.nsIConsoleService);
-
-  consoleService.reset();
-  consoleService.registerListener(consoleListener);
-
-  for (var index in errors) {
-    worker.postMessage(errors[index]);
-  }
-
-  SimpleTest.waitForExplicitFinish();
-
-</script>
-</pre>
-</body>
-</html>
-
--- a/dom/src/threads/test/test_simpleThread.html
+++ b/dom/src/threads/test/test_simpleThread.html
@@ -38,25 +38,29 @@ Tests of DOM Worker Threads (Bug 437152)
         ok(false, "Unexpected message:" + event.data);
         SimpleTest.finish();
     }
   }, false);
 
   var gotErrors = false;
   worker.onerror = function(event) {
     is(event.target, worker);
-    is(event.message, "uncaught exception: Bad message: asdf");
+    is(event.data,
+       '[JavaScript Error: "uncaught exception: Bad message: asdf"]');
 
     worker.onerror = function(otherEvent) {
       is(otherEvent.target, worker);
-      is(otherEvent.message, "Components is not defined");
+      is(otherEvent.data,
+         '[JavaScript Error: "Components is not defined" {file: ' +
+         '"http://localhost:8888/tests/dom/src/threads/test/' +
+         'simpleThread_worker.js" line: 6}]');
         gotErrors = true;
 
       worker.onerror = function(oneMoreEvent) {
-        ok(false, "Worker had an error:" + oneMoreEvent.message);
+        ok(false, "Worker had an error:" + oneMoreEvent.data);
         SimpleTest.finish();
       };
     };
   };
 
   worker.postMessage("asdf");
   worker.postMessage("components");
   worker.postMessage("start");