From 1bbf15b3f68d56deda7b3dbf4045fa2032f88eb5 Mon Sep 17 00:00:00 2001 From: Aaron Klotz Date: Thu, 14 Sep 2017 13:05:26 -0600 Subject: [PATCH] Bug 1383501: Modify a11y::IsHandlerRegistered to include check of path to handler binary; r=eeejay --- accessible/windows/msaa/Platform.cpp | 29 +++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/accessible/windows/msaa/Platform.cpp b/accessible/windows/msaa/Platform.cpp index 679644bc646c..2a1d841ae471 100644 --- a/accessible/windows/msaa/Platform.cpp +++ b/accessible/windows/msaa/Platform.cpp @@ -20,6 +20,8 @@ #include "mozilla/mscom/Utils.h" #include "mozilla/StaticPtr.h" #include "mozilla/WindowsVersion.h" +#include "nsDirectoryServiceDefs.h" +#include "nsDirectoryServiceUtils.h" #include "ProxyWrappers.h" using namespace mozilla; @@ -209,7 +211,32 @@ a11y::IsHandlerRegistered() return false; } - return true; + nsAutoString handlerPath; + rv = regKey->ReadStringValue(nsAutoString(), handlerPath); + if (NS_FAILED(rv)) { + return false; + } + + nsCOMPtr actualHandler; + rv = NS_NewLocalFile(handlerPath, false, getter_AddRefs(actualHandler)); + if (NS_FAILED(rv)) { + return false; + } + + nsCOMPtr expectedHandler; + rv = NS_GetSpecialDirectory(NS_GRE_DIR, getter_AddRefs(expectedHandler)); + if (NS_FAILED(rv)) { + return false; + } + + rv = expectedHandler->Append(NS_LITERAL_STRING("AccessibleHandler.dll")); + if (NS_FAILED(rv)) { + return false; + } + + bool equal; + rv = expectedHandler->Equals(actualHandler, &equal); + return NS_SUCCEEDED(rv) && equal; } void