Bug 658909 - Remove GWNOJO from JSValToXPCException. r=mrbkap
authorBobby Holley <bobbyholley@gmail.com>
Thu, 21 Mar 2013 08:20:44 -0700
changeset 125814 7149b64f78c974429d95822528634933eadaf7e0
parent 125813 7bccfe486f988984f85d4a162b15c6d35b74e73b
child 125815 ddd198e0e288a9ed7f0c12cb009f4a3a0e2af09c
push id24464
push useremorley@mozilla.com
push dateFri, 22 Mar 2013 14:00:12 +0000
treeherdermozilla-central@3825fdbcec62 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmrbkap
bugs658909
milestone22.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 658909 - Remove GWNOJO from JSValToXPCException. r=mrbkap
js/xpconnect/src/XPCConvert.cpp
--- a/js/xpconnect/src/XPCConvert.cpp
+++ b/js/xpconnect/src/XPCConvert.cpp
@@ -1172,19 +1172,22 @@ XPCConvert::JSValToXPCException(XPCCallC
         JSObject* obj = JSVAL_TO_OBJECT(s);
 
         if (!obj) {
             NS_ERROR("when is an object not an object?");
             return NS_ERROR_FAILURE;
         }
 
         // is this really a native xpcom object with a wrapper?
-        XPCWrappedNative* wrapper;
-        if (nullptr != (wrapper =
-                       XPCWrappedNative::GetWrappedNativeOfJSObject(cx,obj))) {
+        JSObject *unwrapped = js::UnwrapObjectChecked(obj, /* stopAtOuter = */ false);
+        if (!unwrapped)
+            return NS_ERROR_XPC_SECURITY_MANAGER_VETO;
+        XPCWrappedNative* wrapper = IS_WN_WRAPPER(unwrapped) ? XPCWrappedNative::Get(unwrapped)
+                                                             : nullptr;
+        if (wrapper) {
             nsISupports* supports = wrapper->GetIdentityObject();
             nsCOMPtr<nsIException> iface = do_QueryInterface(supports);
             if (iface) {
                 // just pass through the exception (with extra ref and all)
                 nsIException* temp = iface;
                 NS_ADDREF(temp);
                 *exceptn = temp;
                 return NS_OK;