From b7e9e474acdae951928c46554dd24f71ee810440 Mon Sep 17 00:00:00 2001 From: Kyle Huey Date: Mon, 23 Sep 2013 11:35:09 +0800 Subject: [PATCH] Bug 914014: Use WrapObject to wrap nsIExceptions rather than manual XPConnect gunk. r=bz --- dom/bindings/Exceptions.cpp | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/dom/bindings/Exceptions.cpp b/dom/bindings/Exceptions.cpp index 368d0cddcfca..5ed5fe0dcd6a 100644 --- a/dom/bindings/Exceptions.cpp +++ b/dom/bindings/Exceptions.cpp @@ -58,21 +58,12 @@ ThrowExceptionObject(JSContext* aCx, nsIException* aException) return false; } - nsCOMPtr holder; - nsresult rv = nsContentUtils::XPConnect()->WrapNative(aCx, glob, aException, - NS_GET_IID(nsIException), - getter_AddRefs(holder)); - if (NS_FAILED(rv) ||! holder) { + JS::Rooted 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; }