Bug 1354077: Push a11y activation context during mscom::MainThreadRuntime initialization; r=jimm

MozReview-Commit-ID: CU17UPWI104
This commit is contained in:
Aaron Klotz 2017-06-27 11:28:41 -07:00
parent 091386062e
commit aa1f26657e
3 changed files with 34 additions and 20 deletions

View File

@ -30,8 +30,6 @@ static StaticAutoPtr<RegisteredProxy> gRegCustomProxy;
static StaticAutoPtr<RegisteredProxy> gRegProxy;
static StaticAutoPtr<RegisteredProxy> gRegAccTlb;
static StaticAutoPtr<RegisteredProxy> gRegMiscTlb;
static StaticAutoPtr<ActivationContextRegion> gActCtxRgn;
void
a11y::PlatformInit()
{
@ -40,21 +38,6 @@ a11y::PlatformInit()
nsWinUtils::MaybeStartWindowEmulation();
ia2AccessibleText::InitTextChangeData();
if (BrowserTabsRemoteAutostart()) {
// The manifest for 32-bit Windows is embedded with resource ID 32.
// The manifest for 64-bit Windows is embedded with resource ID 64.
// Beginning with Windows 10 Creators Update, 32-bit builds use the 64-bit
// manifest.
DWORD actCtxResourceId;
#if defined(HAVE_64BIT_BUILD)
actCtxResourceId = 64;
#else
if (IsWin10CreatorsUpdateOrLater()) {
actCtxResourceId = 64;
} else {
actCtxResourceId = 32;
}
#endif
gActCtxRgn = new ActivationContextRegion(actCtxResourceId);
mscom::InterceptorLog::Init();
UniquePtr<RegisteredProxy> regCustomProxy(
mscom::RegisterProxy());
@ -82,7 +65,6 @@ a11y::PlatformShutdown()
gRegProxy = nullptr;
gRegAccTlb = nullptr;
gRegMiscTlb = nullptr;
gActCtxRgn = nullptr;
}
void

View File

@ -10,7 +10,7 @@
#include "mozilla/Assertions.h"
#include "mozilla/RefPtr.h"
#include "mozilla/UniquePtr.h"
#include "nsDebug.h"
#include "mozilla/WindowsVersion.h"
#include "nsWindowsHelpers.h"
#include "nsXULAppAPI.h"
@ -34,6 +34,29 @@ struct LocalFreeDeleter
// This API from oleaut32.dll is not declared in Windows SDK headers
extern "C" void __cdecl SetOaNoCache(void);
#if defined(ACCESSIBILITY)
static WORD
GetActCtxResourceId()
{
// The manifest for 32-bit Windows is embedded with resource ID 32.
// The manifest for 64-bit Windows is embedded with resource ID 64.
// Beginning with Windows 10 Creators Update, 32-bit builds use the 64-bit
// manifest.
WORD actCtxResourceId;
#if defined(HAVE_64BIT_BUILD)
actCtxResourceId = 64;
#else
if (mozilla::IsWin10CreatorsUpdateOrLater()) {
actCtxResourceId = 64;
} else {
actCtxResourceId = 32;
}
#endif // defined(HAVE_64BIT_BUILD)
return actCtxResourceId;
}
#endif // defined(ACCESSIBILITY)
namespace mozilla {
namespace mscom {
@ -41,6 +64,9 @@ MainThreadRuntime* MainThreadRuntime::sInstance = nullptr;
MainThreadRuntime::MainThreadRuntime()
: mInitResult(E_UNEXPECTED)
#if defined(ACCESSIBILITY)
, mActCtxRgn(::GetActCtxResourceId())
#endif // defined(ACCESSIBILITY)
{
// We must be the outermost COM initialization on this thread. The COM runtime
// cannot be configured once we start manipulating objects

View File

@ -8,6 +8,9 @@
#define mozilla_mscom_MainThreadRuntime_h
#include "mozilla/Attributes.h"
#if defined(ACCESSIBILITY)
#include "mozilla/mscom/ActivationContext.h"
#endif // defined(ACCESSIBILITY)
#include "mozilla/mscom/COMApartmentRegion.h"
#include "mozilla/mscom/MainThreadClientInfo.h"
#include "mozilla/RefPtr.h"
@ -40,8 +43,11 @@ public:
private:
HRESULT InitializeSecurity();
STARegion mStaRegion;
HRESULT mInitResult;
#if defined(ACCESSIBILITY)
ActivationContextRegion mActCtxRgn;
#endif // defined(ACCESSIBILITY)
STARegion mStaRegion;
RefPtr<MainThreadClientInfo> mClientInfo;