Bug 860473 part 3. Root ErrorResult::ThrowJSException. r=evilpie,smaug
authorBoris Zbarsky <bzbarsky@mit.edu>
Thu, 11 Apr 2013 14:31:06 -0400
changeset 140267 fc32e1f944e3ff2dc8f4696a3536e7fd36330f29
parent 140266 df6981fad6a230cbfc557a791d850d02ad66a462
child 140268 e1fd922ead11a7da6e17decb049356a7ac7709a9
push id350
push userbbajaj@mozilla.com
push dateMon, 29 Jul 2013 23:00:49 +0000
treeherdermozilla-release@064965b37dbd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersevilpie, smaug
bugs860473
milestone23.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 860473 part 3. Root ErrorResult::ThrowJSException. r=evilpie,smaug
dom/bindings/BindingUtils.cpp
dom/bindings/CallbackObject.cpp
dom/bindings/ErrorResult.h
--- a/dom/bindings/BindingUtils.cpp
+++ b/dom/bindings/BindingUtils.cpp
@@ -116,17 +116,17 @@ ErrorResult::ClearMessage()
 {
   if (IsTypeError()) {
     delete mMessage;
     mMessage = nullptr;
   }
 }
 
 void
-ErrorResult::ThrowJSException(JSContext* cx, JS::Value exn)
+ErrorResult::ThrowJSException(JSContext* cx, JS::Handle<JS::Value> exn)
 {
   MOZ_ASSERT(mMightHaveUnreportedJSException,
              "Why didn't you tell us you planned to throw a JS exception?");
 
   if (IsTypeError()) {
     delete mMessage;
   }
 
--- a/dom/bindings/CallbackObject.cpp
+++ b/dom/bindings/CallbackObject.cpp
@@ -140,18 +140,18 @@ CallbackObject::CallSetup::~CallSetup()
   // errors on it, unless we were told to re-throw them.
   if (mCx) {
     bool dealtWithPendingException = false;
     if (mExceptionHandling == eRethrowExceptions) {
       // Restore the old context options
       JS_SetOptions(mCx, mSavedJSContextOptions);
       mErrorResult.MightThrowJSException();
       if (JS_IsExceptionPending(mCx)) {
-        JS::Value exn;
-        if (JS_GetPendingException(mCx, &exn)) {
+        JS::Rooted<JS::Value> exn(mCx);
+        if (JS_GetPendingException(mCx, exn.address())) {
           mErrorResult.ThrowJSException(mCx, exn);
           JS_ClearPendingException(mCx);
           dealtWithPendingException = true;
         }
       }
     }
 
     if (!dealtWithPendingException) {
--- a/dom/bindings/ErrorResult.h
+++ b/dom/bindings/ErrorResult.h
@@ -61,17 +61,17 @@ public:
   void ClearMessage();
   bool IsTypeError() const { return ErrorCode() == NS_ERROR_TYPE_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 as needed must
   // first call WouldReportJSException even if this ErrorResult has not failed.
-  void ThrowJSException(JSContext* cx, JS::Value exn);
+  void ThrowJSException(JSContext* cx, JS::Handle<JS::Value> exn);
   void ReportJSException(JSContext* cx);
   bool IsJSException() const { return ErrorCode() == NS_ERROR_DOM_JS_EXCEPTION; }
   void MOZ_ALWAYS_INLINE MightThrowJSException()
   {
 #ifdef DEBUG
     mMightHaveUnreportedJSException = true;
 #endif
   }