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;
|
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;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user