Bug 1257892. Fix XPCConvert::JSValToXPCException to correctly detect Web IDL binding exceptions (i.e. all of them now!) when trying to check whether the value is already an XPCException. r=bholley
authorBoris Zbarsky <bzbarsky@mit.edu>
Mon, 21 Mar 2016 11:01:43 -0400
changeset 289612 3cdd3f35f65e7bc85fa2719504d55d0e3900734b
parent 289611 22a9fe577704ca1d6c9095f3b52cd380dfd17eee
child 289613 960029b66e4c3f02862d00d080a399cf15d00438
push id73909
push userbzbarsky@mozilla.com
push dateMon, 21 Mar 2016 15:02:06 +0000
treeherdermozilla-inbound@960029b66e4c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbholley
bugs1257892
milestone48.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 1257892. Fix XPCConvert::JSValToXPCException to correctly detect Web IDL binding exceptions (i.e. all of them now!) when trying to check whether the value is already an XPCException. r=bholley
js/xpconnect/src/XPCConvert.cpp
--- a/js/xpconnect/src/XPCConvert.cpp
+++ b/js/xpconnect/src/XPCConvert.cpp
@@ -1078,20 +1078,17 @@ XPCConvert::JSValToXPCException(MutableH
             NS_ERROR("when is an object not an object?");
             return NS_ERROR_FAILURE;
         }
 
         // is this really a native xpcom object with a wrapper?
         JSObject* unwrapped = js::CheckedUnwrap(obj, /* stopAtWindowProxy = */ false);
         if (!unwrapped)
             return NS_ERROR_XPC_SECURITY_MANAGER_VETO;
-        XPCWrappedNative* wrapper = IS_WN_REFLECTOR(unwrapped) ? XPCWrappedNative::Get(unwrapped)
-                                                               : nullptr;
-        if (wrapper) {
-            nsISupports* supports = wrapper->GetIdentityObject();
+        if (nsISupports* supports = UnwrapReflectorToISupports(unwrapped)) {
             nsCOMPtr<nsIException> iface = do_QueryInterface(supports);
             if (iface) {
                 // just pass through the exception (with extra ref and all)
                 nsCOMPtr<nsIException> temp = iface;
                 temp.forget(exceptn);
                 return NS_OK;
             } else {
                 // it is a wrapped native, but not an exception!