Bug 1514093 part 1: A11y HandlerProvider: Don't write any payload at all (even an empty one) if the handler isn't used for the target interface. r=aklotz

We only use the handler for specific interfaces such as IAccessible* and IAccessibleHyperlink.
For interfaces which don't use the handler, we currently write an empty payload, but this still adds bytes to the stream.
This seems to break marshaling such an interface in a VT_UNKNOWN in a VARIANT.
To fix this, just don't write any payload at all when we aren't using the handler for the target interface.

Differential Revision: https://phabricator.services.mozilla.com/D16662

--HG--
extra : moz-landing-system : lando
This commit is contained in:
James Teh 2019-01-16 08:08:05 +00:00
Родитель db69c1ddb2
Коммит 27ee39f62b
1 изменённых файлов: 7 добавлений и 2 удалений

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

@ -135,8 +135,8 @@ HandlerProvider::GetHandlerPayloadSize(
MOZ_ASSERT(mscom::IsCurrentThreadMTA());
if (!IsTargetInterfaceCacheable()) {
*aOutPayloadSize = mscom::StructToStream::GetEmptySize();
return S_OK;
// No handler, so no payload for this instance.
return E_NOTIMPL;
}
MutexAutoLock lock(mMutex);
@ -378,6 +378,11 @@ bool HandlerProvider::IsTargetInterfaceCacheable() {
HRESULT
HandlerProvider::WriteHandlerPayload(NotNull<mscom::IInterceptor*> aInterceptor,
NotNull<IStream*> aStream) {
if (!IsTargetInterfaceCacheable()) {
// No handler, so no payload for this instance.
return E_NOTIMPL;
}
MutexAutoLock lock(mMutex);
if (!mSerializer || !(*mSerializer)) {