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/mscom/EnsureMTA.h"
#include "mozilla/mscom/InterceptorLog.h"
#include "mozilla/WindowsVersion.h"
#include "Accessible2.h"
#include "Accessible2_2.h"
@ -49,31 +48,6 @@ PlatformChild::PlatformChild()
, mMiscTypelib(mozilla::mscom::RegisterTypelib(L"Accessible.tlb"))
, 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::RegisterArrayData(sPlatformChildArrayData);

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

@ -7,8 +7,6 @@
#ifndef mozilla_a11y_PlatformChild_h
#define mozilla_a11y_PlatformChild_h
#include "mozilla/mscom/ActivationContext.h"
#include "mozilla/mscom/Ptr.h"
#include "mozilla/mscom/Registration.h"
namespace mozilla {
@ -25,8 +23,6 @@ public:
PlatformChild& operator=(PlatformChild&&) = delete;
private:
UniquePtr<mozilla::mscom::ActivationContextRegion> mActCtxMain;
mscom::MTADeletePtr<mozilla::mscom::ActivationContextRegion> mActCtxMTA;
UniquePtr<mozilla::mscom::RegisteredProxy> mCustomProxy;
UniquePtr<mozilla::mscom::RegisteredProxy> mIA2Proxy;
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
# also depends on COMPtrTypes.h), but not the C++.
IPDL_SOURCES += ['PDocAccessible.ipdl']
EXPORTS.mozilla.a11y += [
'COMPtrTypes.h',
]
EXPORTS.mozilla.a11y += ['COMPtrTypes.h']
if CONFIG['ACCESSIBILITY']:
if not CONFIG['HAVE_64BIT_BUILD']:
EXPORTS += [
'IAccessible32.manifest',
]
EXPORTS += [
'IAccessible64.manifest',
]
EXPORTS.mozilla.a11y += [
'DocAccessibleChild.h',
'HandlerProvider.h',

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

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

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

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

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

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

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

@ -45,15 +45,36 @@ extern "C" {
// in rpcproxy.h, so we need this declaration.
void RPC_ENTRY GetProxyDllInfo(const ProxyFileInfo*** aInfo, const CLSID** aId);
#if defined(_MSC_VER)
extern IMAGE_DOS_HEADER __ImageBase;
#endif
}
namespace mozilla {
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
GetContainingLibPath(wchar_t* aBuffer, size_t aBufferLen)
{
HMODULE thisModule = reinterpret_cast<HMODULE>(GetContainingModuleHandle());
HMODULE thisModule = GetContainingModule();
if (!thisModule) {
return false;
}
@ -178,7 +199,10 @@ RegisterProxy(const wchar_t* aLeafName, RegistrationFlags aFlags)
// Instantiate an activation context so that CoGetClassObject will use any
// 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)>(
GetProcAddress(proxyDll, "GetProxyDllInfo"));

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

@ -16,11 +16,6 @@
#include <objbase.h>
#include <objidl.h>
#include <winnt.h>
#if defined(_MSC_VER)
extern "C" IMAGE_DOS_HEADER __ImageBase;
#endif
namespace mozilla {
namespace mscom {
@ -81,23 +76,6 @@ IsValidGUID(REFGUID aCheckGuid)
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)
void

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

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

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

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