Bug 1174954 part 3. Remove ReportJSExceptionFromJSImplementation, since it no longer does anything interesting. r=bholley
authorBoris Zbarsky <bzbarsky@mit.edu>
Tue, 16 Jun 2015 16:44:11 -0400
changeset 249242 a4093b87ff57bea9a91d40043b79cfbb524aaa1d
parent 249241 b6f23bd165db2d864a5cceebc1aab2f9b98021d2
child 249243 afb4264004a3f065fbdfe47338a82e301bed712f
push id28923
push userryanvm@gmail.com
push dateWed, 17 Jun 2015 18:57:11 +0000
treeherdermozilla-central@099d6cd6725e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbholley
bugs1174954
milestone41.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1174954 part 3. Remove ReportJSExceptionFromJSImplementation, since it no longer does anything interesting. r=bholley
dom/bindings/BindingUtils.cpp
dom/bindings/BindingUtils.h
dom/bindings/Codegen.py
dom/bindings/ErrorResult.h
--- a/dom/bindings/BindingUtils.cpp
+++ b/dom/bindings/BindingUtils.cpp
@@ -272,26 +272,16 @@ ErrorResult::ReportJSException(JSContext
   js::RemoveRawValueRoot(cx, &mJSException);
 
   // We no longer have a useful exception but we do want to signal that an error
   // occured.
   mResult = NS_ERROR_FAILURE;
 }
 
 void
-ErrorResult::ReportJSExceptionFromJSImplementation(JSContext* aCx)
-{
-  MOZ_ASSERT(!mMightHaveUnreportedJSException,
-             "Why didn't you tell us you planned to handle JS exceptions?");
-
-  // Just report it.
-  ReportJSException(aCx);
-}
-
-void
 ErrorResult::StealJSException(JSContext* cx,
                               JS::MutableHandle<JS::Value> value)
 {
   MOZ_ASSERT(!mMightHaveUnreportedJSException,
              "Must call WouldReportJSException unconditionally in all codepaths that might call StealJSException");
   MOZ_ASSERT(IsJSException(), "No exception to steal");
 
   value.set(mJSException);
--- a/dom/bindings/BindingUtils.h
+++ b/dom/bindings/BindingUtils.h
@@ -96,36 +96,31 @@ ThrowInvalidThis(JSContext* aCx, const J
 bool
 ThrowInvalidThis(JSContext* aCx, const JS::CallArgs& aArgs,
                  const ErrNum aErrorNumber,
                  prototypes::ID aProtoId);
 
 inline bool
 ThrowMethodFailedWithDetails(JSContext* cx, ErrorResult& rv,
                              const char* ifaceName,
-                             const char* memberName,
-                             bool reportJSContentExceptions = false)
+                             const char* memberName)
 {
   if (rv.IsUncatchableException()) {
     // Nuke any existing exception on aCx, to make sure we're uncatchable.
     JS_ClearPendingException(cx);
     // Don't do any reporting.  Just return false, to create an
     // uncatchable exception.
     return false;
   }
   if (rv.IsErrorWithMessage()) {
     rv.ReportErrorWithMessage(cx);
     return false;
   }
   if (rv.IsJSException()) {
-    if (reportJSContentExceptions) {
-      rv.ReportJSExceptionFromJSImplementation(cx);
-    } else {
-      rv.ReportJSException(cx);
-    }
+    rv.ReportJSException(cx);
     return false;
   }
   if (rv.IsNotEnoughArgsError()) {
     rv.ReportNotEnoughArgsError(cx, ifaceName, memberName);
     return false;
   }
   rv.ReportGenericError(cx);
   return false;
--- a/dom/bindings/Codegen.py
+++ b/dom/bindings/Codegen.py
@@ -6923,23 +6923,19 @@ class CGPerSignatureCall(CGThing):
                 return ${maybeWrap}(cx, args.rval());
                 """,
                 wrapCode=wrapCode,
                 postSteps=postSteps,
                 maybeWrap=getMaybeWrapValueFuncForType(self.idlNode.type))
         return wrapCode
 
     def getErrorReport(self):
-        jsImplemented = ""
-        if self.descriptor.interface.isJSImplemented():
-            jsImplemented = ", true"
-        return CGGeneric('return ThrowMethodFailedWithDetails(cx, rv, "%s", "%s"%s);\n'
+        return CGGeneric('return ThrowMethodFailedWithDetails(cx, rv, "%s", "%s");\n'
                          % (self.descriptor.interface.identifier.name,
-                            self.idlNode.identifier.name,
-                            jsImplemented))
+                            self.idlNode.identifier.name))
 
     def define(self):
         return (self.cgRoot.define() + self.wrap_return_value())
 
 
 class CGSwitch(CGList):
     """
     A class to generate code for a switch statement.
--- a/dom/bindings/ErrorResult.h
+++ b/dom/bindings/ErrorResult.h
@@ -94,28 +94,25 @@ public:
   void ThrowTypeError(const dom::ErrNum errorNumber, ...);
   void ThrowRangeError(const dom::ErrNum errorNumber, ...);
   void ReportErrorWithMessage(JSContext* cx);
   bool IsErrorWithMessage() const { return ErrorCode() == NS_ERROR_TYPE_ERR || ErrorCode() == NS_ERROR_RANGE_ERR; }
 
   // Facilities for throwing a preexisting JS exception value via this
   // ErrorResult.  The contract is that any code which might end up calling
   // ThrowJSException() must call MightThrowJSException() even if no exception
-  // is being thrown.  Code that would call ReportJSException* or
+  // is being thrown.  Code that would call ReportJSException or
   // StealJSException as needed must first call WouldReportJSException even if
   // this ErrorResult has not failed.
   //
   // The exn argument to ThrowJSException can be in any compartment.  It does
   // not have to be in the compartment of cx.  If someone later uses it, they
   // will wrap it into whatever compartment they're working in, as needed.
   void ThrowJSException(JSContext* cx, JS::Handle<JS::Value> exn);
   void ReportJSException(JSContext* cx);
-  // Used to implement throwing exceptions from the JS implementation of
-  // bindings to callers of the binding.
-  void ReportJSExceptionFromJSImplementation(JSContext* aCx);
   bool IsJSException() const { return ErrorCode() == NS_ERROR_DOM_JS_EXCEPTION; }
 
   void ThrowNotEnoughArgsError() { mResult = NS_ERROR_XPC_NOT_ENOUGH_ARGS; }
   void ReportNotEnoughArgsError(JSContext* cx,
                                 const char* ifaceName,
                                 const char* memberName);
   bool IsNotEnoughArgsError() const { return ErrorCode() == NS_ERROR_XPC_NOT_ENOUGH_ARGS; }