Bug 1096341 - require an exception to be set in ToJSValue overload. r=bz
authorTom Tromey <tom@tromey.com>
Mon, 10 Nov 2014 09:06:00 +0100
changeset 240035 6cec52c43496e57e70fa80e06d5c2958dfb78840
parent 240034 c52d4787634a436a31d7c20b4bfcd8e52d572828
child 240036 ea818fdbd81c5a06b063136f8ce7929d397e5e7a
push id4311
push userraliiev@mozilla.com
push dateMon, 12 Jan 2015 19:37:41 +0000
treeherdermozilla-beta@150c9fed433b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs1096341
milestone36.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 1096341 - require an exception to be set in ToJSValue overload. r=bz
dom/bindings/ToJSValue.cpp
--- a/dom/bindings/ToJSValue.cpp
+++ b/dom/bindings/ToJSValue.cpp
@@ -61,18 +61,18 @@ ToJSValue(JSContext* aCx,
 }
 
 bool
 ToJSValue(JSContext* aCx,
           ErrorResult& aArgument,
           JS::MutableHandle<JS::Value> aValue)
 {
   MOZ_ASSERT(aArgument.Failed());
-  ThrowMethodFailedWithDetails(aCx, aArgument, "", "");
-  if (!JS_GetPendingException(aCx, aValue)) {
-    return false;
-  }
+  DebugOnly<bool> throwResult = ThrowMethodFailedWithDetails(aCx, aArgument, "", "");
+  MOZ_ASSERT(!throwResult);
+  DebugOnly<bool> getPendingResult = JS_GetPendingException(aCx, aValue);
+  MOZ_ASSERT(getPendingResult);
   JS_ClearPendingException(aCx);
   return true;
 }
 
 } // namespace dom
 } // namespace mozilla