Esempio n. 1
0
bool ToJSValue(JSContext* aCx, ErrorResult& aArgument,
               JS::MutableHandle<JS::Value> aValue) {
  MOZ_ASSERT(aArgument.Failed());
  MOZ_ASSERT(
      !aArgument.IsUncatchableException(),
      "Doesn't make sense to convert uncatchable exception to a JS value!");
  MOZ_ALWAYS_TRUE(aArgument.MaybeSetPendingException(aCx));
  MOZ_ALWAYS_TRUE(JS_GetPendingException(aCx, aValue));
  JS_ClearPendingException(aCx);
  return true;
}
Esempio n. 2
0
bool
ToJSValue(JSContext* aCx,
          ErrorResult& aArgument,
          JS::MutableHandle<JS::Value> aValue)
{
  MOZ_ASSERT(aArgument.Failed());
  MOZ_ASSERT(!aArgument.IsUncatchableException(),
             "Doesn't make sense to convert uncatchable exception to a JS value!");
  AutoForceSetExceptionOnContext forceExn(aCx);
  DebugOnly<bool> throwResult = aArgument.MaybeSetPendingException(aCx);
  MOZ_ASSERT(throwResult);
  DebugOnly<bool> getPendingResult = JS_GetPendingException(aCx, aValue);
  MOZ_ASSERT(getPendingResult);
  JS_ClearPendingException(aCx);
  return true;
}