Bug 1011810. Return the right type from getIccById. r=htsai,smaug

This commit is contained in:
Boris Zbarsky 2014-05-19 13:20:21 -04:00
parent 9a622cefe4
commit 8e2f0fbfc3
4 changed files with 10 additions and 10 deletions

View File

@ -26,11 +26,10 @@ public:
void
Shutdown();
already_AddRefed<Icc>
Icc*
GetIcc()
{
nsRefPtr<Icc> icc = mIcc;
return icc.forget();
return mIcc;
}
private:
@ -49,4 +48,4 @@ private:
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_IccListener_h
#endif // mozilla_dom_IccListener_h

View File

@ -102,21 +102,21 @@ IccManager::GetIccIds(nsTArray<nsString>& aIccIds)
{
nsTArray<nsRefPtr<IccListener>>::size_type i;
for (i = 0; i < mIccListeners.Length(); ++i) {
nsRefPtr<Icc> icc = mIccListeners[i]->GetIcc();
Icc* icc = mIccListeners[i]->GetIcc();
if (icc) {
aIccIds.AppendElement(icc->GetIccId());
}
}
}
already_AddRefed<nsISupports>
Icc*
IccManager::GetIccById(const nsAString& aIccId) const
{
nsTArray<nsRefPtr<IccListener>>::size_type i;
for (i = 0; i < mIccListeners.Length(); ++i) {
nsRefPtr<Icc> icc = mIccListeners[i]->GetIcc();
Icc* icc = mIccListeners[i]->GetIcc();
if (icc && aIccId == icc->GetIccId()) {
return icc.forget();
return icc;
}
}
return nullptr;

View File

@ -14,6 +14,7 @@ namespace mozilla {
namespace dom {
class IccListener;
class Icc;
class IccManager MOZ_FINAL : public DOMEventTargetHelper
{
@ -42,7 +43,7 @@ public:
void
GetIccIds(nsTArray<nsString>& aIccIds);
already_AddRefed<nsISupports>
Icc*
GetIccById(const nsAString& aIccId) const;
nsPIDOMWindow*

View File

@ -239,7 +239,7 @@ interface MozIccManager : EventTarget
*
* @return see MozIcc.webidl for the detail.
*/
nsISupports getIccById(DOMString iccId);
MozIcc? getIccById(DOMString iccId);
/**
* 'oniccdetected' event is notified whenever a new ICC is detected.