Bug 914014: Use WrapObject to wrap nsIExceptions rather than manual XPConnect gunk. r=bz

This commit is contained in:
Kyle Huey 2013-09-23 11:35:09 +08:00
parent 9a3bd8e476
commit b7e9e474ac

View File

@ -58,21 +58,12 @@ ThrowExceptionObject(JSContext* aCx, nsIException* aException)
return false; return false;
} }
nsCOMPtr<nsIXPConnectJSObjectHolder> holder; JS::Rooted<JS::Value> val(aCx);
nsresult rv = nsContentUtils::XPConnect()->WrapNative(aCx, glob, aException, if (!WrapObject(aCx, glob, aException, &NS_GET_IID(nsIException), &val)) {
NS_GET_IID(nsIException),
getter_AddRefs(holder));
if (NS_FAILED(rv) ||! holder) {
return false; return false;
} }
JS::RootedObject obj(aCx, holder->GetJSObject()); JS_SetPendingException(aCx, val);
if (!obj) {
return false;
}
JS::RootedValue exn(aCx, JS::ObjectOrNullValue(obj));
JS_SetPendingException(aCx, exn);
return true; return true;
} }