Bug 1080059: Explicitly QueryInterface to nsIIccInfo rather than downcasting, because the canonical nsIIccInfo pointer is not the same as the canonical subclass pointer. r=edgar
authorKyle Huey <khuey@kylehuey.com>
Thu, 09 Oct 2014 10:50:37 -0700
changeset 209675 b418ec650903fbde9019dc1a1a83e671ac02c2ed
parent 209674 710dfba5acb50bd387d63a63a04fb9ce2c0f2d4b
child 209676 9876fd1d7c9271454ccafd4801cb87380a406c06
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersedgar
bugs1080059
milestone35.0a1
Bug 1080059: Explicitly QueryInterface to nsIIccInfo rather than downcasting, because the canonical nsIIccInfo pointer is not the same as the canonical subclass pointer. r=edgar
dom/icc/IccInfo.cpp
--- a/dom/icc/IccInfo.cpp
+++ b/dom/icc/IccInfo.cpp
@@ -148,17 +148,20 @@ NS_IMPL_RELEASE_INHERITED(GsmIccInfo, Ic
 GsmIccInfo::GsmIccInfo(nsPIDOMWindow* aWindow)
   : IccInfo(aWindow)
 {
 }
 
 void
 GsmIccInfo::Update(nsIGsmIccInfo* aInfo)
 {
-  IccInfo::Update(aInfo);
+  nsCOMPtr<nsIIccInfo> iccInfo = do_QueryInterface(aInfo);
+  MOZ_ASSERT(iccInfo);
+
+  IccInfo::Update(iccInfo);
   mGsmIccInfo = aInfo;
 }
 
 JSObject*
 GsmIccInfo::WrapObject(JSContext* aCx)
 {
   return MozGsmIccInfoBinding::Wrap(aCx, this);
 }
@@ -187,17 +190,20 @@ NS_IMPL_RELEASE_INHERITED(CdmaIccInfo, I
 CdmaIccInfo::CdmaIccInfo(nsPIDOMWindow* aWindow)
   : IccInfo(aWindow)
 {
 }
 
 void
 CdmaIccInfo::Update(nsICdmaIccInfo* aInfo)
 {
-  IccInfo::Update(aInfo);
+  nsCOMPtr<nsIIccInfo> iccInfo = do_QueryInterface(aInfo);
+  MOZ_ASSERT(iccInfo);
+
+  IccInfo::Update(iccInfo);
   mCdmaIccInfo = aInfo;
 }
 
 JSObject*
 CdmaIccInfo::WrapObject(JSContext* aCx)
 {
   return MozCdmaIccInfoBinding::Wrap(aCx, this);
 }