Bug 783867. Don't blindly assume IsDOMClass objects are nsISupports. r=peterv
authorBoris Zbarsky <bzbarsky@mit.edu>
Wed, 22 Aug 2012 12:18:46 -0700
changeset 105087 2f60f3a4bdd703c40ac2b49d9547707bcf9614c2
parent 105086 a8601aeb1d1d1cb838832fc15cd4d6d0653a6448
child 105088 41a3cdf9206337399613463f3f008b24d764d1a4
push id55
push usershu@rfrn.org
push dateThu, 30 Aug 2012 01:33:09 +0000
reviewerspeterv
bugs783867
milestone17.0a1
Bug 783867. Don't blindly assume IsDOMClass objects are nsISupports. r=peterv
js/xpconnect/src/XPCJSID.cpp
--- a/js/xpconnect/src/XPCJSID.cpp
+++ b/js/xpconnect/src/XPCJSID.cpp
@@ -480,20 +480,19 @@ nsJSIID::HasInstance(nsIXPConnectWrapped
             if (!MorphSlimWrapper(cx, obj))
                 return NS_ERROR_FAILURE;
         }
 
         nsISupports *identity;
         if (mozilla::dom::binding::instanceIsProxy(obj)) {
             identity =
                 static_cast<nsISupports*>(js::GetProxyPrivate(obj).toPrivate());
-        } else if (mozilla::dom::IsDOMClass(js::GetObjectJSClass(obj))) {
-            NS_ASSERTION(mozilla::dom::DOMJSClass::FromJSClass(
-                              js::GetObjectJSClass(obj))->mDOMObjectIsISupports,
-                         "This only works on nsISupports classes!");
+        } else if (mozilla::dom::IsDOMClass(js::GetObjectJSClass(obj)) &&
+                   mozilla::dom::DOMJSClass::FromJSClass(
+                        js::GetObjectJSClass(obj))->mDOMObjectIsISupports) {
             identity =
                 mozilla::dom::UnwrapDOMObject<nsISupports>(obj);
         } else {
             identity = nullptr;
         }
 
         if (identity) {
             nsCOMPtr<nsIClassInfo> ci = do_QueryInterface(identity);