Backed out changeset c14bbafbc6a6 (bug 1306200) for linux debug sm-arm bustage
authorCarsten "Tomcat" Book <cbook@mozilla.com>
Wed, 19 Apr 2017 09:22:26 +0200
changeset 565154 61ff36c046fab1fc70772472371e509b363c3302
parent 565153 190af5fd48018397d193a623d09d4b2ce260e8dd
child 565155 085e1f764ab0fd79893ef4e425b555206a10b6cd
push id54802
push userdgottwald@mozilla.com
push dateWed, 19 Apr 2017 15:26:27 +0000
bugs1306200
milestone55.0a1
backs outc14bbafbc6a6606f42ac0d23dcde9f05485c41d2
Backed out changeset c14bbafbc6a6 (bug 1306200) for linux debug sm-arm bustage
js/src/vm/Debugger.cpp
js/src/vm/ErrorReporting.cpp
js/src/vm/ErrorReporting.h
--- a/js/src/vm/Debugger.cpp
+++ b/js/src/vm/Debugger.cpp
@@ -1348,16 +1348,36 @@ Debugger::unwrapPropertyDescriptor(JSCon
                 return false;
         }
         desc.setSetterObject(set);
     }
 
     return true;
 }
 
+namespace {
+class MOZ_STACK_CLASS ReportExceptionClosure : public ScriptEnvironmentPreparer::Closure
+{
+public:
+    explicit ReportExceptionClosure(RootedValue& exn)
+        : exn_(exn)
+    {
+    }
+
+    bool operator()(JSContext* cx) override
+    {
+        cx->setPendingException(exn_);
+        return false;
+    }
+
+private:
+    RootedValue& exn_;
+};
+} // anonymous namespace
+
 JSTrapStatus
 Debugger::reportUncaughtException(Maybe<AutoCompartment>& ac)
 {
     JSContext* cx = ac->context();
 
     // Uncaught exceptions arise from Debugger code, and so we must already be
     // in an NX section.
     MOZ_ASSERT(EnterDebuggeeNoExecute::isLockedInStack(cx, *this));
@@ -1370,21 +1390,23 @@ Debugger::reportUncaughtException(Maybe<
          * is the debugger compartment, so reported errors won't get
          * reported to various onerror handlers in debuggees) and as part of
          * that "execution" simply throw our exception so the embedding can
          * deal.
          */
         RootedValue exn(cx);
         if (cx->getPendingException(&exn)) {
             /*
-             * Clear the exception, because ReportErrorToGlobal will assert that
-             * we don't have one.
+             * Clear the exception, because
+             * PrepareScriptEnvironmentAndInvoke will assert that we don't
+             * have one.
              */
             cx->clearPendingException();
-            ReportErrorToGlobal(cx, cx->global(), exn);
+            ReportExceptionClosure reportExn(exn);
+            PrepareScriptEnvironmentAndInvoke(cx, cx->global(), reportExn);
         }
         /*
          * And if not, or if PrepareScriptEnvironmentAndInvoke somehow left
          * an exception on cx (which it totally shouldn't do), just give
          * up.
          */
         cx->clearPendingException();
     }
--- a/js/src/vm/ErrorReporting.cpp
+++ b/js/src/vm/ErrorReporting.cpp
@@ -7,22 +7,19 @@
 #include "vm/ErrorReporting.h"
 
 #include "mozilla/Move.h"
 
 #include <stdarg.h>
 
 #include "jscntxt.h"
 #include "jsexn.h"
-#include "jsfriendapi.h"
 
 using mozilla::Move;
 
-using JS::HandleObject;
-using JS::HandleValue;
 using JS::UniqueTwoByteChars;
 
 void
 js::CallWarningReporter(JSContext* cx, JSErrorReport* reportp)
 {
     MOZ_ASSERT(reportp);
     MOZ_ASSERT(JSREPORT_IS_WARNING(reportp->flags));
 
@@ -116,45 +113,8 @@ js::ReportCompileError(JSContext* cx, Er
                                 nullptr, ArgumentsAreLatin1, err, args))
     {
         return;
     }
 
     if (!cx->helperThread())
         err->throwError(cx);
 }
-
-namespace {
-
-class MOZ_STACK_CLASS ReportExceptionClosure
-  : public ScriptEnvironmentPreparer::Closure
-{
-  public:
-    explicit ReportExceptionClosure(HandleValue& exn)
-      : exn_(exn)
-    {
-    }
-
-    bool operator()(JSContext* cx) override
-    {
-        cx->setPendingException(exn_);
-        return false;
-    }
-
-  private:
-    HandleValue& exn_;
-};
-
-} // anonymous namespace
-
-void
-js::ReportErrorToGlobal(JSContext* cx, HandleObject global, HandleValue error)
-{
-    MOZ_ASSERT(!cx->isExceptionPending());
-#ifdef DEBUG
-    // No assertSameCompartment version that doesn't take JSContext...
-    if (error.isObject()) {
-        AssertSameCompartment(global, &error.toObject());
-    }
-#endif // DEBUG
-    ReportExceptionClosure report(error);
-    PrepareScriptEnvironmentAndInvoke(cx, global, report);
-}
--- a/js/src/vm/ErrorReporting.h
+++ b/js/src/vm/ErrorReporting.h
@@ -81,19 +81,11 @@ ReportCompileError(JSContext* cx, ErrorM
  *
  * This function DOES NOT respect an existing werror option.  If the caller
  * wishes such option to be respected, it must do so itself.
  */
 extern MOZ_MUST_USE bool
 ReportCompileWarning(JSContext* cx, ErrorMetadata&& metadata, UniquePtr<JSErrorNotes> notes,
                      unsigned flags, unsigned errorNumber, va_list args);
 
-/**
- * Report the given error Value to the given global.  The JSContext is not
- * assumed to be in any particular compartment, but the global and error are
- * expected to be same-compartment.
- */
-extern void
-ReportErrorToGlobal(JSContext* cx, JS::HandleObject global, JS::HandleValue error);
-
 } // namespace js
 
 #endif /* vm_ErrorReporting_h */