Backed out changeset ad6f632572e2 (bug 1211970)
authorCarsten "Tomcat" Book <cbook@mozilla.com>
Tue, 27 Oct 2015 16:50:13 +0100
changeset 296578 59e346e2a14e74cd819883a7eebd98ab2e81e811
parent 296577 ad6f632572e26947495a344e6cb469749c69d49d
child 296579 b5c8da05bef9d38b67b6e27d83035af210c58e23
push id5245
push userraliiev@mozilla.com
push dateThu, 29 Oct 2015 11:30:51 +0000
treeherdermozilla-beta@dac831dc1bd0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1211970
milestone43.0a2
backs outad6f632572e26947495a344e6cb469749c69d49d
Backed out changeset ad6f632572e2 (bug 1211970)
dom/workers/ScriptLoader.cpp
--- a/dom/workers/ScriptLoader.cpp
+++ b/dom/workers/ScriptLoader.cpp
@@ -17,17 +17,16 @@
 #include "nsIScriptError.h"
 #include "nsIScriptSecurityManager.h"
 #include "nsIStreamLoader.h"
 #include "nsIStreamListenerTee.h"
 #include "nsIThreadRetargetableRequest.h"
 #include "nsIURI.h"
 
 #include "jsapi.h"
-#include "jsfriendapi.h"
 #include "nsError.h"
 #include "nsContentPolicyUtils.h"
 #include "nsContentUtils.h"
 #include "nsDocShellCID.h"
 #include "nsISupportsPrimitives.h"
 #include "nsNetUtil.h"
 #include "nsIPipe.h"
 #include "nsIOutputStream.h"
@@ -314,19 +313,16 @@ private:
 
   NS_DECL_NSICANCELABLERUNNABLE
 
   void
   ShutdownScriptLoader(JSContext* aCx,
                        WorkerPrivate* aWorkerPrivate,
                        bool aResult,
                        bool aMutedError);
-
-  void LogExceptionToConsole(JSContext* aCx,
-                             WorkerPrivate* WorkerPrivate);
 };
 
 class CacheScriptLoader;
 
 class CacheCreator final : public PromiseNativeHandler
 {
 public:
   NS_DECL_ISUPPORTS
@@ -1816,55 +1812,28 @@ ScriptExecutorRunnable::ShutdownScriptLo
   if (mIsWorkerScript && aWorkerPrivate->IsServiceWorker()) {
     aWorkerPrivate->SetLoadingWorkerScript(false);
   }
 
   if (!aResult) {
     // If this error has to be muted, we have to clear the pending exception,
     // if any, and use the ErrorResult object to throw a new exception.
     if (aMutedError && JS_IsExceptionPending(aCx)) {
-      LogExceptionToConsole(aCx, aWorkerPrivate);
+      JS_ClearPendingException(aCx);
       mScriptLoader.mRv.Throw(NS_ERROR_FAILURE);
     } else {
       mScriptLoader.mRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
     }
   }
 
   aWorkerPrivate->RemoveFeature(aCx, &mScriptLoader);
   aWorkerPrivate->StopSyncLoop(mSyncLoopTarget, aResult);
 }
 
 void
-ScriptExecutorRunnable::LogExceptionToConsole(JSContext* aCx,
-                                              WorkerPrivate* aWorkerPrivate)
-{
-  aWorkerPrivate->AssertIsOnWorkerThread();
-
-  JS::Rooted<JS::Value> exn(aCx);
-  if (!JS_GetPendingException(aCx, &exn)) {
-    return;
-  }
-
-  JS_ClearPendingException(aCx);
-
-  js::ErrorReport report(aCx);
-  if (!report.init(aCx, exn)) {
-    JS_ClearPendingException(aCx);
-    return;
-  }
-
-  nsRefPtr<xpc::ErrorReport> xpcReport = new xpc::ErrorReport();
-  xpcReport->Init(report.report(), report.message(),
-                  aWorkerPrivate->IsChromeWorker(), aWorkerPrivate->WindowID());
-
-  nsRefPtr<AsyncErrorReporter> r = new AsyncErrorReporter(xpcReport);
-  NS_DispatchToMainThread(r);
-}
-
-void
 LoadAllScripts(JSContext* aCx, WorkerPrivate* aWorkerPrivate,
                nsTArray<ScriptLoadInfo>& aLoadInfos, bool aIsMainScript,
                WorkerScriptType aWorkerScriptType, ErrorResult& aRv)
 {
   aWorkerPrivate->AssertIsOnWorkerThread();
   NS_ASSERTION(!aLoadInfos.IsEmpty(), "Bad arguments!");
 
   AutoSyncLoopHolder syncLoop(aWorkerPrivate);