diff --git a/uriloader/exthandler/android/nsAndroidHandlerApp.cpp b/uriloader/exthandler/android/nsAndroidHandlerApp.cpp index 47f4dff8847f..4c7ffff484f0 100644 --- a/uriloader/exthandler/android/nsAndroidHandlerApp.cpp +++ b/uriloader/exthandler/android/nsAndroidHandlerApp.cpp @@ -55,20 +55,19 @@ nsAndroidHandlerApp::SetDetailedDescription(const nsAString & aDescription) return NS_OK; } +// XXX Workaround for bug 986975 to maintain the existing broken semantics +template<> +struct nsISharingHandlerApp::COMTypeInfo { + static const nsIID kIID; +}; +const nsIID nsISharingHandlerApp::COMTypeInfo::kIID = NS_IHANDLERAPP_IID; + NS_IMETHODIMP nsAndroidHandlerApp::Equals(nsIHandlerApp *aHandlerApp, bool *aRetval) { - *aRetval = false; - if (!aHandlerApp) { - return NS_OK; - } - - nsAutoString name; - nsAutoString detailedDescription; - aHandlerApp->GetName(name); - aHandlerApp->GetDetailedDescription(detailedDescription); - - *aRetval = name.Equals(mName) && detailedDescription.Equals(mDescription); + nsCOMPtr aApp = do_QueryInterface(aHandlerApp); + *aRetval = aApp && aApp->mName.Equals(mName) && + aApp->mDescription.Equals(mDescription); return NS_OK; } diff --git a/uriloader/exthandler/android/nsMIMEInfoAndroid.cpp b/uriloader/exthandler/android/nsMIMEInfoAndroid.cpp index 6a42289ba90c..ee9bc8570da5 100644 --- a/uriloader/exthandler/android/nsMIMEInfoAndroid.cpp +++ b/uriloader/exthandler/android/nsMIMEInfoAndroid.cpp @@ -380,13 +380,11 @@ nsMIMEInfoAndroid::nsMIMEInfoAndroid(const nsACString& aMIMEType) : mHandlerApps->AppendElement(mPrefApp, false); } -#define SYSTEMCHOOSER_NAME u"Android chooser" -#define SYSTEMCHOOSER_DESCRIPTION u"Android's default handler application chooser" - NS_IMPL_ISUPPORTS(nsMIMEInfoAndroid::SystemChooser, nsIHandlerApp) + nsresult nsMIMEInfoAndroid::SystemChooser::GetName(nsAString & aName) { - aName.AssignLiteral(SYSTEMCHOOSER_NAME); + aName.AssignLiteral(u"Android chooser"); return NS_OK; } @@ -397,7 +395,7 @@ nsMIMEInfoAndroid::SystemChooser::SetName(const nsAString&) { nsresult nsMIMEInfoAndroid::SystemChooser::GetDetailedDescription(nsAString & aDesc) { - aDesc.AssignLiteral(SYSTEMCHOOSER_DESCRIPTION); + aDesc.AssignLiteral(u"Android's default handler application chooser"); return NS_OK; } @@ -406,20 +404,19 @@ nsMIMEInfoAndroid::SystemChooser::SetDetailedDescription(const nsAString&) { return NS_OK; } +// XXX Workaround for bug 986975 to maintain the existing broken semantics +template<> +struct nsIHandlerApp::COMTypeInfo { + static const nsIID kIID; +}; +const nsIID nsIHandlerApp::COMTypeInfo::kIID = NS_IHANDLERAPP_IID; + nsresult nsMIMEInfoAndroid::SystemChooser::Equals(nsIHandlerApp *aHandlerApp, bool *aRetVal) { + nsCOMPtr info = do_QueryInterface(aHandlerApp); + if (info) + return mOuter->Equals(info->mOuter, aRetVal); *aRetVal = false; - if (!aHandlerApp) { - return NS_OK; - } - - nsAutoString name; - nsAutoString detailedDescription; - aHandlerApp->GetName(name); - aHandlerApp->GetDetailedDescription(detailedDescription); - - *aRetVal = name.EqualsLiteral(SYSTEMCHOOSER_NAME) && - detailedDescription.EqualsLiteral(SYSTEMCHOOSER_DESCRIPTION); return NS_OK; }