mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-14 13:55:43 +00:00
Bug 914014: Use WrapObject to wrap nsIExceptions rather than manual XPConnect gunk. r=bz
This commit is contained in:
parent
9a3bd8e476
commit
b7e9e474ac
@ -58,21 +58,12 @@ ThrowExceptionObject(JSContext* aCx, nsIException* aException)
|
||||
return false;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIXPConnectJSObjectHolder> holder;
|
||||
nsresult rv = nsContentUtils::XPConnect()->WrapNative(aCx, glob, aException,
|
||||
NS_GET_IID(nsIException),
|
||||
getter_AddRefs(holder));
|
||||
if (NS_FAILED(rv) ||! holder) {
|
||||
JS::Rooted<JS::Value> val(aCx);
|
||||
if (!WrapObject(aCx, glob, aException, &NS_GET_IID(nsIException), &val)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
JS::RootedObject obj(aCx, holder->GetJSObject());
|
||||
if (!obj) {
|
||||
return false;
|
||||
}
|
||||
|
||||
JS::RootedValue exn(aCx, JS::ObjectOrNullValue(obj));
|
||||
JS_SetPendingException(aCx, exn);
|
||||
JS_SetPendingException(aCx, val);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user