Backed out 3 changesets (bug 1354077) for assertions in AccessibleWrap.cpp a=backout CLOSED TREE

Backed out changeset 1380fe0f701b (bug 1354077)
Backed out changeset 2b5602bd352a (bug 1354077)
Backed out changeset a0fc3a1a9122 (bug 1354077)

MozReview-Commit-ID: ABHV3evXKrG
This commit is contained in:
Wes Kocher 2017-06-12 16:54:10 -07:00
Родитель f3bf820bfd
Коммит 3ee39c3f47
12 изменённых файлов: 45 добавлений и 251 удалений

Просмотреть файл

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity type="win32" name="Mozilla.Firefox.xul" version="1.0.0.0" />
<file name="xul.dll" />
<comInterfaceExternalProxyStub
iid="{618736E0-3C3D-11CF-810C-00AA00389B71}"
proxyStubClsid32="{00020424-0000-0000-C000-000000000046}"
name="IAccessible"
tlbid="{1EA4DBF0-3C3B-11CF-810C-00AA00389B71}"
/>
</assembly>

Просмотреть файл

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity type="win32" name="Mozilla.Firefox.xul" version="1.0.0.0" />
<file name="xul.dll" />
<comInterfaceExternalProxyStub
iid="{618736E0-3C3D-11CF-810C-00AA00389B71}"
proxyStubClsid32="{03022430-ABC4-11D0-BDE2-00AA001A1953}"
name="IAccessible"
/>
</assembly>

Просмотреть файл

@ -7,7 +7,6 @@
#include "mozilla/a11y/PlatformChild.h" #include "mozilla/a11y/PlatformChild.h"
#include "mozilla/mscom/EnsureMTA.h" #include "mozilla/mscom/EnsureMTA.h"
#include "mozilla/mscom/InterceptorLog.h" #include "mozilla/mscom/InterceptorLog.h"
#include "mozilla/WindowsVersion.h"
#include "Accessible2.h" #include "Accessible2.h"
#include "Accessible2_2.h" #include "Accessible2_2.h"
@ -49,31 +48,6 @@ PlatformChild::PlatformChild()
, mMiscTypelib(mozilla::mscom::RegisterTypelib(L"Accessible.tlb")) , mMiscTypelib(mozilla::mscom::RegisterTypelib(L"Accessible.tlb"))
, mSdnTypelib(mozilla::mscom::RegisterTypelib(L"AccessibleMarshal.dll")) , mSdnTypelib(mozilla::mscom::RegisterTypelib(L"AccessibleMarshal.dll"))
{ {
// 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 (IsWin10CreatorsUpdateOrLater()) {
actCtxResourceId = 64;
} else {
actCtxResourceId = 32;
}
#endif
mozilla::mscom::ActivationContext actCtx(actCtxResourceId);
mActCtxMain.reset(new mozilla::mscom::ActivationContextRegion(actCtx));
mozilla::mscom::MTADeletePtr<mozilla::mscom::ActivationContextRegion> tmpActCtxMTA;
mozilla::mscom::EnsureMTA([&actCtx, &tmpActCtxMTA]() -> void {
tmpActCtxMTA.reset(new mozilla::mscom::ActivationContextRegion(Move(actCtx)));
});
mActCtxMTA = Move(tmpActCtxMTA);
mozilla::mscom::InterceptorLog::Init(); mozilla::mscom::InterceptorLog::Init();
mozilla::mscom::RegisterArrayData(sPlatformChildArrayData); mozilla::mscom::RegisterArrayData(sPlatformChildArrayData);

Просмотреть файл

@ -7,8 +7,6 @@
#ifndef mozilla_a11y_PlatformChild_h #ifndef mozilla_a11y_PlatformChild_h
#define mozilla_a11y_PlatformChild_h #define mozilla_a11y_PlatformChild_h
#include "mozilla/mscom/ActivationContext.h"
#include "mozilla/mscom/Ptr.h"
#include "mozilla/mscom/Registration.h" #include "mozilla/mscom/Registration.h"
namespace mozilla { namespace mozilla {
@ -25,8 +23,6 @@ public:
PlatformChild& operator=(PlatformChild&&) = delete; PlatformChild& operator=(PlatformChild&&) = delete;
private: private:
UniquePtr<mozilla::mscom::ActivationContextRegion> mActCtxMain;
mscom::MTADeletePtr<mozilla::mscom::ActivationContextRegion> mActCtxMTA;
UniquePtr<mozilla::mscom::RegisteredProxy> mCustomProxy; UniquePtr<mozilla::mscom::RegisteredProxy> mCustomProxy;
UniquePtr<mozilla::mscom::RegisteredProxy> mIA2Proxy; UniquePtr<mozilla::mscom::RegisteredProxy> mIA2Proxy;
UniquePtr<mozilla::mscom::RegisteredProxy> mAccTypelib; UniquePtr<mozilla::mscom::RegisteredProxy> mAccTypelib;

Просмотреть файл

@ -13,21 +13,9 @@ if CONFIG['COMPILE_ENVIRONMENT'] and CONFIG['ACCESSIBILITY']:
# With --disable-accessibility, we need to compile PDocAccessible.ipdl (which # With --disable-accessibility, we need to compile PDocAccessible.ipdl (which
# also depends on COMPtrTypes.h), but not the C++. # also depends on COMPtrTypes.h), but not the C++.
IPDL_SOURCES += ['PDocAccessible.ipdl'] IPDL_SOURCES += ['PDocAccessible.ipdl']
EXPORTS.mozilla.a11y += ['COMPtrTypes.h']
EXPORTS.mozilla.a11y += [
'COMPtrTypes.h',
]
if CONFIG['ACCESSIBILITY']: if CONFIG['ACCESSIBILITY']:
if not CONFIG['HAVE_64BIT_BUILD']:
EXPORTS += [
'IAccessible32.manifest',
]
EXPORTS += [
'IAccessible64.manifest',
]
EXPORTS.mozilla.a11y += [ EXPORTS.mozilla.a11y += [
'DocAccessibleChild.h', 'DocAccessibleChild.h',
'HandlerProvider.h', 'HandlerProvider.h',

Просмотреть файл

@ -13,11 +13,9 @@
#include "nsIXULRuntime.h" #include "nsIXULRuntime.h"
#include "nsWinUtils.h" #include "nsWinUtils.h"
#include "mozilla/a11y/ProxyAccessible.h" #include "mozilla/a11y/ProxyAccessible.h"
#include "mozilla/mscom/ActivationContext.h"
#include "mozilla/mscom/InterceptorLog.h" #include "mozilla/mscom/InterceptorLog.h"
#include "mozilla/mscom/Registration.h" #include "mozilla/mscom/Registration.h"
#include "mozilla/StaticPtr.h" #include "mozilla/StaticPtr.h"
#include "mozilla/WindowsVersion.h"
#include "ProxyWrappers.h" #include "ProxyWrappers.h"
using namespace mozilla; using namespace mozilla;
@ -28,7 +26,6 @@ static StaticAutoPtr<RegisteredProxy> gRegCustomProxy;
static StaticAutoPtr<RegisteredProxy> gRegProxy; static StaticAutoPtr<RegisteredProxy> gRegProxy;
static StaticAutoPtr<RegisteredProxy> gRegAccTlb; static StaticAutoPtr<RegisteredProxy> gRegAccTlb;
static StaticAutoPtr<RegisteredProxy> gRegMiscTlb; static StaticAutoPtr<RegisteredProxy> gRegMiscTlb;
static StaticAutoPtr<ActivationContextRegion> gActCtxRgn;
void void
a11y::PlatformInit() a11y::PlatformInit()
@ -38,21 +35,6 @@ a11y::PlatformInit()
nsWinUtils::MaybeStartWindowEmulation(); nsWinUtils::MaybeStartWindowEmulation();
ia2AccessibleText::InitTextChangeData(); ia2AccessibleText::InitTextChangeData();
if (BrowserTabsRemoteAutostart()) { 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(); mscom::InterceptorLog::Init();
UniquePtr<RegisteredProxy> regCustomProxy( UniquePtr<RegisteredProxy> regCustomProxy(
mscom::RegisterProxy()); mscom::RegisterProxy());
@ -80,7 +62,6 @@ a11y::PlatformShutdown()
gRegProxy = nullptr; gRegProxy = nullptr;
gRegAccTlb = nullptr; gRegAccTlb = nullptr;
gRegMiscTlb = nullptr; gRegMiscTlb = nullptr;
gActCtxRgn = nullptr;
} }
void void

Просмотреть файл

@ -8,123 +8,38 @@
#include "mozilla/Assertions.h" #include "mozilla/Assertions.h"
#include "mozilla/DebugOnly.h" #include "mozilla/DebugOnly.h"
#include "mozilla/mscom/Utils.h"
namespace mozilla { namespace mozilla {
namespace mscom { namespace mscom {
ActivationContext::ActivationContext(WORD aResourceId) ActivationContext::ActivationContext(HMODULE aLoadFromModule)
: ActivationContext(reinterpret_cast<HMODULE>(GetContainingModuleHandle()),
aResourceId)
{
}
ActivationContext::ActivationContext(HMODULE aLoadFromModule, WORD aResourceId)
: mActCtx(INVALID_HANDLE_VALUE) : mActCtx(INVALID_HANDLE_VALUE)
, mActivationCookie(0)
{ {
ACTCTX actCtx = {sizeof(actCtx)}; ACTCTX actCtx = {sizeof(actCtx)};
actCtx.dwFlags = ACTCTX_FLAG_RESOURCE_NAME_VALID | ACTCTX_FLAG_HMODULE_VALID; actCtx.dwFlags = ACTCTX_FLAG_RESOURCE_NAME_VALID | ACTCTX_FLAG_HMODULE_VALID;
actCtx.lpResourceName = MAKEINTRESOURCE(aResourceId); actCtx.lpResourceName = MAKEINTRESOURCE(2);
actCtx.hModule = aLoadFromModule; actCtx.hModule = aLoadFromModule;
Init(actCtx); mActCtx = ::CreateActCtx(&actCtx);
}
void
ActivationContext::Init(ACTCTX& aActCtx)
{
MOZ_ASSERT(mActCtx == INVALID_HANDLE_VALUE);
mActCtx = ::CreateActCtx(&aActCtx);
MOZ_ASSERT(mActCtx != INVALID_HANDLE_VALUE); MOZ_ASSERT(mActCtx != INVALID_HANDLE_VALUE);
}
void
ActivationContext::AddRef()
{
if (mActCtx == INVALID_HANDLE_VALUE) {
return;
}
::AddRefActCtx(mActCtx);
}
ActivationContext::ActivationContext(ActivationContext&& aOther)
: mActCtx(aOther.mActCtx)
{
aOther.mActCtx = INVALID_HANDLE_VALUE;
}
ActivationContext&
ActivationContext::operator=(ActivationContext&& aOther)
{
Release();
mActCtx = aOther.mActCtx;
aOther.mActCtx = INVALID_HANDLE_VALUE;
return *this;
}
ActivationContext::ActivationContext(const ActivationContext& aOther)
: mActCtx(aOther.mActCtx)
{
AddRef();
}
ActivationContext&
ActivationContext::operator=(const ActivationContext& aOther)
{
Release();
mActCtx = aOther.mActCtx;
AddRef();
return *this;
}
void
ActivationContext::Release()
{
if (mActCtx == INVALID_HANDLE_VALUE) { if (mActCtx == INVALID_HANDLE_VALUE) {
return; return;
} }
if (!::ActivateActCtx(mActCtx, &mActivationCookie)) {
::ReleaseActCtx(mActCtx); ::ReleaseActCtx(mActCtx);
mActCtx = INVALID_HANDLE_VALUE; mActCtx = INVALID_HANDLE_VALUE;
}
} }
ActivationContext::~ActivationContext() ActivationContext::~ActivationContext()
{ {
Release(); if (mActCtx == INVALID_HANDLE_VALUE) {
}
ActivationContextRegion::ActivationContextRegion(const ActivationContext& aActCtx)
: mActCtx(aActCtx)
, mActCookie(0)
{
if (aActCtx.mActCtx == INVALID_HANDLE_VALUE) {
return; return;
} }
DebugOnly<BOOL> deactivated = ::DeactivateActCtx(0, mActivationCookie);
DebugOnly<BOOL> activated = ::ActivateActCtx(aActCtx.mActCtx, &mActCookie);
MOZ_ASSERT(activated);
}
ActivationContextRegion::ActivationContextRegion(ActivationContext&& aActCtx)
: mActCtx(Move(aActCtx))
, mActCookie(0)
{
if (aActCtx.mActCtx == INVALID_HANDLE_VALUE) {
return;
}
DebugOnly<BOOL> activated = ::ActivateActCtx(aActCtx.mActCtx, &mActCookie);
MOZ_ASSERT(activated);
}
ActivationContextRegion::~ActivationContextRegion()
{
if (!mActCookie) {
return;
}
DebugOnly<BOOL> deactivated = ::DeactivateActCtx(0, mActCookie);
MOZ_ASSERT(deactivated); MOZ_ASSERT(deactivated);
::ReleaseActCtx(mActCtx);
} }
} // namespace mscom } // namespace mscom

Просмотреть файл

@ -8,25 +8,16 @@
#define mozilla_mscom_ActivationContext_h #define mozilla_mscom_ActivationContext_h
#include "mozilla/Attributes.h" #include "mozilla/Attributes.h"
#include "mozilla/Move.h"
#include <windows.h> #include <windows.h>
namespace mozilla { namespace mozilla {
namespace mscom { namespace mscom {
class ActivationContext final class MOZ_RAII ActivationContext
{ {
public: public:
explicit ActivationContext(WORD aResourceId); explicit ActivationContext(HMODULE aLoadFromModule);
explicit ActivationContext(HMODULE aLoadFromModule, WORD aResourceId = 2);
ActivationContext(ActivationContext&& aOther);
ActivationContext& operator=(ActivationContext&& aOther);
ActivationContext(const ActivationContext& aOther);
ActivationContext& operator=(const ActivationContext& aOther);
~ActivationContext(); ~ActivationContext();
explicit operator bool() const explicit operator bool() const
@ -34,39 +25,14 @@ public:
return mActCtx != INVALID_HANDLE_VALUE; return mActCtx != INVALID_HANDLE_VALUE;
} }
private: ActivationContext(const ActivationContext&) = delete;
void Init(ACTCTX& aActCtx); ActivationContext(ActivationContext&&) = delete;
void AddRef(); ActivationContext& operator=(const ActivationContext&) = delete;
void Release(); ActivationContext& operator=(ActivationContext&&) = delete;
private: private:
HANDLE mActCtx; HANDLE mActCtx;
ULONG_PTR mActivationCookie;
friend class ActivationContextRegion;
};
class MOZ_NON_TEMPORARY_CLASS ActivationContextRegion final
{
public:
template <typename... Args>
explicit ActivationContextRegion(Args... aArgs)
: mActCtx(Forward<Args>(aArgs)...)
, mActCookie(0)
{
}
explicit ActivationContextRegion(const ActivationContext& aActCtx);
explicit ActivationContextRegion(ActivationContext&& aActCtx);
~ActivationContextRegion();
ActivationContextRegion(const ActivationContextRegion&) = delete;
ActivationContextRegion(ActivationContextRegion&&) = delete;
ActivationContextRegion& operator=(const ActivationContextRegion&) = delete;
ActivationContextRegion& operator=(ActivationContextRegion&&) = delete;
private:
ActivationContext mActCtx;
ULONG_PTR mActCookie;
}; };
} // namespace mscom } // namespace mscom

Просмотреть файл

@ -45,15 +45,36 @@ extern "C" {
// in rpcproxy.h, so we need this declaration. // in rpcproxy.h, so we need this declaration.
void RPC_ENTRY GetProxyDllInfo(const ProxyFileInfo*** aInfo, const CLSID** aId); void RPC_ENTRY GetProxyDllInfo(const ProxyFileInfo*** aInfo, const CLSID** aId);
#if defined(_MSC_VER)
extern IMAGE_DOS_HEADER __ImageBase;
#endif
} }
namespace mozilla { namespace mozilla {
namespace mscom { namespace mscom {
static HMODULE
GetContainingModule()
{
HMODULE thisModule = nullptr;
#if defined(_MSC_VER)
thisModule = reinterpret_cast<HMODULE>(&__ImageBase);
#else
if (!GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS |
GET_MODULE_HANDLE_EX_UNCHANGED_REFCOUNT,
reinterpret_cast<LPCTSTR>(&GetContainingModule),
&thisModule)) {
return nullptr;
}
#endif
return thisModule;
}
static bool static bool
GetContainingLibPath(wchar_t* aBuffer, size_t aBufferLen) GetContainingLibPath(wchar_t* aBuffer, size_t aBufferLen)
{ {
HMODULE thisModule = reinterpret_cast<HMODULE>(GetContainingModuleHandle()); HMODULE thisModule = GetContainingModule();
if (!thisModule) { if (!thisModule) {
return false; return false;
} }
@ -178,7 +199,10 @@ RegisterProxy(const wchar_t* aLeafName, RegistrationFlags aFlags)
// Instantiate an activation context so that CoGetClassObject will use any // Instantiate an activation context so that CoGetClassObject will use any
// COM metadata embedded in proxyDll's manifest to resolve CLSIDs. // COM metadata embedded in proxyDll's manifest to resolve CLSIDs.
ActivationContextRegion actCtxRgn(proxyDll.get()); ActivationContext actCtx(proxyDll);
if (!actCtx) {
return nullptr;
}
auto GetProxyDllInfoFn = reinterpret_cast<decltype(&GetProxyDllInfo)>( auto GetProxyDllInfoFn = reinterpret_cast<decltype(&GetProxyDllInfo)>(
GetProcAddress(proxyDll, "GetProxyDllInfo")); GetProcAddress(proxyDll, "GetProxyDllInfo"));

Просмотреть файл

@ -16,11 +16,6 @@
#include <objbase.h> #include <objbase.h>
#include <objidl.h> #include <objidl.h>
#include <winnt.h>
#if defined(_MSC_VER)
extern "C" IMAGE_DOS_HEADER __ImageBase;
#endif
namespace mozilla { namespace mozilla {
namespace mscom { namespace mscom {
@ -81,23 +76,6 @@ IsValidGUID(REFGUID aCheckGuid)
return version == 1 || version == 4; return version == 1 || version == 4;
} }
uintptr_t
GetContainingModuleHandle()
{
HMODULE thisModule = nullptr;
#if defined(_MSC_VER)
thisModule = reinterpret_cast<HMODULE>(&__ImageBase);
#else
if (!GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS |
GET_MODULE_HANDLE_EX_UNCHANGED_REFCOUNT,
reinterpret_cast<LPCTSTR>(&GetContainingModuleHandle),
&thisModule)) {
return nullptr;
}
#endif
return reinterpret_cast<uintptr_t>(thisModule);
}
#if defined(MOZILLA_INTERNAL_API) #if defined(MOZILLA_INTERNAL_API)
void void

Просмотреть файл

@ -21,7 +21,6 @@ namespace mscom {
bool IsCurrentThreadMTA(); bool IsCurrentThreadMTA();
bool IsProxy(IUnknown* aUnknown); bool IsProxy(IUnknown* aUnknown);
bool IsValidGUID(REFGUID aCheckGuid); bool IsValidGUID(REFGUID aCheckGuid);
uintptr_t GetContainingModuleHandle();
#if defined(MOZILLA_INTERNAL_API) #if defined(MOZILLA_INTERNAL_API)
void GUIDToString(REFGUID aGuid, nsAString& aOutString); void GUIDToString(REFGUID aGuid, nsAString& aOutString);
@ -30,12 +29,10 @@ void GUIDToString(REFGUID aGuid, nsAString& aOutString);
#if defined(ACCESSIBILITY) #if defined(ACCESSIBILITY)
bool IsVtableIndexFromParentInterface(REFIID aInterface, bool IsVtableIndexFromParentInterface(REFIID aInterface,
unsigned long aVtableIndex); unsigned long aVtableIndex);
#if defined(MOZILLA_INTERNAL_API) #if defined(MOZILLA_INTERNAL_API)
bool IsInterfaceEqualToOrInheritedFrom(REFIID aInterface, REFIID aFrom, bool IsInterfaceEqualToOrInheritedFrom(REFIID aInterface, REFIID aFrom,
unsigned long aVtableIndexHint); unsigned long aVtableIndexHint);
#endif // defined(MOZILLA_INTERNAL_API) #endif // defined(MOZILLA_INTERNAL_API)
#endif // defined(ACCESSIBILITY) #endif // defined(ACCESSIBILITY)
} // namespace mscom } // namespace mscom

Просмотреть файл

@ -6,8 +6,4 @@
#include "widget.rc" #include "widget.rc"
#ifdef ACCESSIBILITY #ifdef ACCESSIBILITY
1 typelib IGeckoCustom.tlb 1 typelib IGeckoCustom.tlb
64 RT_MANIFEST IAccessible64.manifest
#ifndef HAVE_64BIT_BUILD
32 RT_MANIFEST IAccessible32.manifest
#endif
#endif #endif